@antv/l7-map 2.17.12 → 2.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/package.json +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
package/es/css/l7.css DELETED
@@ -1,98 +0,0 @@
1
- .l7-map {
2
- font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
3
- overflow: hidden;
4
- position: relative;
5
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
6
- }
7
-
8
- .l7-canvas {
9
- position: absolute;
10
- left: 0;
11
- top: 0;
12
- }
13
-
14
- .l7-map:-webkit-full-screen {
15
- width: 100%;
16
- height: 100%;
17
- }
18
-
19
- .l7-canary {
20
- background-color: salmon;
21
- }
22
-
23
- .l7-canvas-container.l7-interactive,
24
- .l7-ctrl-group button.l7-ctrl-compass {
25
- cursor: -webkit-grab;
26
- cursor: -moz-grab;
27
- cursor: grab;
28
- -moz-user-select: none;
29
- -webkit-user-select: none;
30
- -ms-user-select: none;
31
- user-select: none;
32
- }
33
-
34
- .l7-canvas-container.l7-interactive.l7-track-pointer {
35
- cursor: pointer;
36
- }
37
-
38
- .l7-canvas-container.l7-interactive:active,
39
- .l7-ctrl-group button.l7-ctrl-compass:active {
40
- cursor: -webkit-grabbing;
41
- cursor: -moz-grabbing;
42
- cursor: grabbing;
43
- }
44
-
45
- .l7-canvas-container.l7-touch-zoom-rotate,
46
- .l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
47
- touch-action: pan-x pan-y;
48
- }
49
-
50
- .l7-canvas-container.l7-touch-drag-pan,
51
- .l7-canvas-container.l7-touch-drag-pan .l7-canvas {
52
- touch-action: pinch-zoom;
53
- }
54
-
55
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
56
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
57
- touch-action: none;
58
- }
59
-
60
- .l7-ctrl-top-left,
61
- .l7-ctrl-top-right,
62
- .l7-ctrl-bottom-left,
63
- .l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }
64
- .l7-ctrl-top-left { top: 0; left: 0; }
65
- .l7-ctrl-top-right { top: 0; right: 0; }
66
- .l7-ctrl-bottom-left { bottom: 0; left: 0; }
67
- .l7-ctrl-bottom-right { right: 0; bottom: 0; }
68
-
69
- .l7-ctrl {
70
- clear: both;
71
- pointer-events: auto;
72
-
73
- /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
74
- transform: translate(0, 0);
75
- }
76
- .l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }
77
- .l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }
78
- .l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }
79
- .l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }
80
-
81
-
82
- .l7-crosshair,
83
- .l7-crosshair .l7-interactive,
84
- .l7-crosshair .l7-interactive:active {
85
- cursor: crosshair;
86
- }
87
-
88
- .l7-boxzoom {
89
- position: absolute;
90
- top: 0;
91
- left: 0;
92
- width: 0;
93
- height: 0;
94
- background: #fff;
95
- border: 2px dotted #202020;
96
- opacity: 0.5;
97
- z-index: 10;
98
- }
package/es/earthmap.d.ts DELETED
@@ -1,66 +0,0 @@
1
- import Camera from './camera';
2
- import './css/l7.css';
3
- import LngLat, { LngLatLike } from './geo/lng_lat';
4
- import LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';
5
- import Point, { PointLike } from './geo/point';
6
- import BoxZoomHandler from './handler/box_zoom';
7
- import HandlerManager from './handler/handler_manager';
8
- import KeyboardHandler from './handler/keyboard';
9
- import ScrollZoomHandler from './handler/scroll_zoom';
10
- import DoubleClickZoomHandler from './handler/shim/dblclick_zoom';
11
- import DragPanHandler from './handler/shim/drag_pan';
12
- import DragRotateHandler from './handler/shim/drag_rotate';
13
- import TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';
14
- import { TouchPitchHandler } from './handler/touch';
15
- import { IMapOptions } from './interface';
16
- import { TaskID } from './utils/task_queue';
17
- type CallBack = (_: number) => void;
18
- export declare class EarthMap extends Camera {
19
- doubleClickZoom: DoubleClickZoomHandler;
20
- dragRotate: DragRotateHandler;
21
- dragPan: DragPanHandler;
22
- touchZoomRotate: TouchZoomRotateHandler;
23
- scrollZoom: ScrollZoomHandler;
24
- keyboard: KeyboardHandler;
25
- touchPitch: TouchPitchHandler;
26
- boxZoom: BoxZoomHandler;
27
- handlers: HandlerManager;
28
- private container;
29
- private canvas;
30
- private canvasContainer;
31
- private renderTaskQueue;
32
- private frame;
33
- private trackResize;
34
- constructor(options: Partial<IMapOptions>);
35
- resize(eventData?: any): this;
36
- getContainer(): HTMLElement;
37
- getCanvas(): HTMLCanvasElement;
38
- getCanvasContainer(): HTMLElement;
39
- project(lngLat: LngLatLike): Point;
40
- unproject(point: PointLike): LngLat;
41
- getBounds(): LngLatBounds;
42
- getMaxBounds(): LngLatBounds | null;
43
- setMaxBounds(bounds: LngLatBoundsLike): void;
44
- setStyle(style: any): void;
45
- setMinZoom(minZoom?: number): this;
46
- getMinZoom(): number;
47
- setMaxZoom(maxZoom?: number): this;
48
- getMaxZoom(): number;
49
- setMinPitch(minPitch?: number): this;
50
- getMinPitch(): number;
51
- setMaxPitch(maxPitch?: number): this;
52
- getMaxPitch(): number;
53
- getRenderWorldCopies(): boolean;
54
- setRenderWorldCopies(renderWorldCopies?: boolean): void;
55
- remove(): void;
56
- requestRenderFrame(cb: CallBack): TaskID;
57
- cancelRenderFrame(id: TaskID): void;
58
- triggerRepaint(): void;
59
- update(time?: number): void;
60
- private initContainer;
61
- private containerDimensions;
62
- private resizeCanvas;
63
- private onWindowOnline;
64
- private onWindowResize;
65
- }
66
- export {};
package/es/earthmap.js DELETED
@@ -1,422 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
-
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
-
13
- import { DOM } from '@antv/l7-utils';
14
- import { merge } from 'lodash';
15
- import Camera from "./camera";
16
-
17
- function loadStyles(css, doc) {
18
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
19
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
20
-
21
- if (isMiniAli || isWeChatMiniProgram) {
22
- return;
23
- }
24
-
25
- if (!doc) doc = document;
26
-
27
- if (!doc) {
28
- return;
29
- }
30
-
31
- var head = doc.head || doc.getElementsByTagName('head')[0];
32
-
33
- if (!head) {
34
- head = doc.createElement('head');
35
- var body = doc.body || doc.getElementsByTagName('body')[0];
36
-
37
- if (body) {
38
- body.parentNode.insertBefore(head, body);
39
- } else {
40
- doc.documentElement.appendChild(head);
41
- }
42
- }
43
-
44
- var style = doc.createElement('style');
45
- style.type = 'text/css';
46
-
47
- if (style.styleSheet) {
48
- style.styleSheet.cssText = css;
49
- } else {
50
- style.appendChild(doc.createTextNode(css));
51
- }
52
-
53
- head.appendChild(style);
54
- return style;
55
- }
56
-
57
- loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n");
58
- import LngLat from "./geo/lng_lat";
59
- import LngLatBounds from "./geo/lng_lat_bounds"; // @ts-ignore
60
-
61
- import Point from "./geo/point";
62
- import HandlerManager from "./handler/handler_manager";
63
- import { renderframe } from "./util";
64
- import { PerformanceUtils } from "./utils/performance";
65
- import TaskQueue from "./utils/task_queue";
66
- var defaultMinZoom = -2;
67
- var defaultMaxZoom = 22; // the default values, but also the valid range
68
-
69
- var defaultMinPitch = 0;
70
- var defaultMaxPitch = 60;
71
- var DefaultOptions = {
72
- hash: false,
73
- zoom: -1,
74
- center: [112, 32],
75
- pitch: 0,
76
- bearing: 0,
77
- interactive: true,
78
- minZoom: defaultMinZoom,
79
- maxZoom: defaultMaxZoom,
80
- minPitch: defaultMinPitch,
81
- maxPitch: defaultMaxPitch,
82
- scrollZoom: true,
83
- boxZoom: true,
84
- dragRotate: true,
85
- dragPan: true,
86
- keyboard: true,
87
- doubleClickZoom: true,
88
- touchZoomRotate: true,
89
- touchPitch: true,
90
- bearingSnap: 7,
91
- clickTolerance: 3,
92
- pitchWithRotate: true,
93
- trackResize: true,
94
- renderWorldCopies: true,
95
- pitchEnabled: true,
96
- rotateEnabled: true
97
- };
98
- export var EarthMap = /*#__PURE__*/function (_Camera) {
99
- _inherits(EarthMap, _Camera);
100
-
101
- var _super = _createSuper(EarthMap);
102
-
103
- function EarthMap(options) {
104
- var _this;
105
-
106
- _classCallCheck(this, EarthMap);
107
-
108
- _this = _super.call(this, merge({}, DefaultOptions, options));
109
-
110
- _defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
111
-
112
- _defineProperty(_assertThisInitialized(_this), "trackResize", true);
113
-
114
- _defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
115
- _this.update();
116
- });
117
-
118
- _defineProperty(_assertThisInitialized(_this), "onWindowResize", function (event) {
119
- if (_this.trackResize) {
120
- _this.resize({
121
- originalEvent: event
122
- }).update();
123
- }
124
- });
125
-
126
- _this.initContainer();
127
-
128
- _this.resize();
129
-
130
- _this.handlers = new HandlerManager(_assertThisInitialized(_this), _this.options);
131
-
132
- if (typeof window !== 'undefined') {
133
- window.addEventListener('online', _this.onWindowOnline, false);
134
- window.addEventListener('resize', _this.onWindowResize, false);
135
- window.addEventListener('orientationchange', _this.onWindowResize, false);
136
- }
137
-
138
- return _this;
139
- }
140
-
141
- _createClass(EarthMap, [{
142
- key: "resize",
143
- value: function resize(eventData) {
144
- var dimensions = this.containerDimensions();
145
- var width = dimensions[0];
146
- var height = dimensions[1]; // this.resizeCanvas(width, height);
147
-
148
- this.transform.resize(width, height);
149
- var fireMoving = !this.moving;
150
-
151
- if (fireMoving) {
152
- this.stop();
153
- this.emit('movestart', new Event('movestart', eventData));
154
- this.emit('move', new Event('move', eventData));
155
- }
156
-
157
- this.emit('resize', new Event('resize', eventData));
158
-
159
- if (fireMoving) {
160
- this.emit('moveend', new Event('moveend', eventData));
161
- }
162
-
163
- return this;
164
- }
165
- }, {
166
- key: "getContainer",
167
- value: function getContainer() {
168
- return this.container;
169
- }
170
- }, {
171
- key: "getCanvas",
172
- value: function getCanvas() {
173
- return this.canvas;
174
- }
175
- }, {
176
- key: "getCanvasContainer",
177
- value: function getCanvasContainer() {
178
- return this.canvasContainer;
179
- }
180
- }, {
181
- key: "project",
182
- value: function project(lngLat) {
183
- return this.transform.locationPoint(LngLat.convert(lngLat));
184
- }
185
- }, {
186
- key: "unproject",
187
- value: function unproject(point) {
188
- return this.transform.pointLocation(Point.convert(point));
189
- }
190
- }, {
191
- key: "getBounds",
192
- value: function getBounds() {
193
- return this.transform.getBounds();
194
- }
195
- }, {
196
- key: "getMaxBounds",
197
- value: function getMaxBounds() {
198
- return this.transform.getMaxBounds();
199
- }
200
- }, {
201
- key: "setMaxBounds",
202
- value: function setMaxBounds(bounds) {
203
- this.transform.setMaxBounds(LngLatBounds.convert(bounds));
204
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
205
-
206
- }, {
207
- key: "setStyle",
208
- value: function setStyle(style) {
209
- return;
210
- }
211
- }, {
212
- key: "setMinZoom",
213
- value: function setMinZoom(minZoom) {
214
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
215
-
216
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
217
- this.transform.minZoom = minZoom;
218
-
219
- if (this.getZoom() < minZoom) {
220
- this.setZoom(minZoom);
221
- }
222
-
223
- return this;
224
- } else {
225
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
226
- }
227
- }
228
- }, {
229
- key: "getMinZoom",
230
- value: function getMinZoom() {
231
- return this.transform.minZoom;
232
- }
233
- }, {
234
- key: "setMaxZoom",
235
- value: function setMaxZoom(maxZoom) {
236
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
237
-
238
- if (maxZoom >= this.transform.minZoom) {
239
- this.transform.maxZoom = maxZoom;
240
-
241
- if (this.getZoom() > maxZoom) {
242
- this.setZoom(maxZoom);
243
- }
244
-
245
- return this;
246
- } else {
247
- throw new Error('maxZoom must be greater than the current minZoom');
248
- }
249
- }
250
- }, {
251
- key: "getMaxZoom",
252
- value: function getMaxZoom() {
253
- return this.transform.maxZoom;
254
- }
255
- }, {
256
- key: "setMinPitch",
257
- value: function setMinPitch(minPitch) {
258
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
259
-
260
- if (minPitch < defaultMinPitch) {
261
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
262
- }
263
-
264
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
265
- this.transform.minPitch = minPitch;
266
-
267
- if (this.getPitch() < minPitch) {
268
- this.setPitch(minPitch);
269
- }
270
-
271
- return this;
272
- } else {
273
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
274
- }
275
- }
276
- }, {
277
- key: "getMinPitch",
278
- value: function getMinPitch() {
279
- return this.transform.minPitch;
280
- }
281
- }, {
282
- key: "setMaxPitch",
283
- value: function setMaxPitch(maxPitch) {
284
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
285
-
286
- if (maxPitch > defaultMaxPitch) {
287
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
288
- }
289
-
290
- if (maxPitch >= this.transform.minPitch) {
291
- this.transform.maxPitch = maxPitch;
292
-
293
- if (this.getPitch() > maxPitch) {
294
- this.setPitch(maxPitch);
295
- }
296
-
297
- return this;
298
- } else {
299
- throw new Error('maxPitch must be greater than the current minPitch');
300
- }
301
- }
302
- }, {
303
- key: "getMaxPitch",
304
- value: function getMaxPitch() {
305
- return this.transform.maxPitch;
306
- }
307
- }, {
308
- key: "getRenderWorldCopies",
309
- value: function getRenderWorldCopies() {
310
- return this.transform.renderWorldCopies;
311
- }
312
- }, {
313
- key: "setRenderWorldCopies",
314
- value: function setRenderWorldCopies(renderWorldCopies) {
315
- this.transform.renderWorldCopies = !!renderWorldCopies;
316
- }
317
- }, {
318
- key: "remove",
319
- value: function remove() {
320
- if (this.frame) {
321
- this.frame.cancel();
322
- this.frame = null;
323
- }
324
-
325
- this.renderTaskQueue.clear();
326
- }
327
- }, {
328
- key: "requestRenderFrame",
329
- value: function requestRenderFrame(cb) {
330
- this.update();
331
- return this.renderTaskQueue.add(cb);
332
- }
333
- }, {
334
- key: "cancelRenderFrame",
335
- value: function cancelRenderFrame(id) {
336
- return this.renderTaskQueue.remove(id);
337
- }
338
- }, {
339
- key: "triggerRepaint",
340
- value: function triggerRepaint() {
341
- var _this2 = this;
342
-
343
- if (!this.frame) {
344
- this.frame = renderframe(function (paintStartTimeStamp) {
345
- PerformanceUtils.frame(paintStartTimeStamp);
346
- _this2.frame = null;
347
-
348
- _this2.update(paintStartTimeStamp);
349
- });
350
- }
351
- }
352
- }, {
353
- key: "update",
354
- value: function update(time) {
355
- var _this3 = this;
356
-
357
- if (!this.frame) {
358
- this.frame = renderframe(function (paintStartTimeStamp) {
359
- PerformanceUtils.frame(paintStartTimeStamp);
360
- _this3.frame = null;
361
-
362
- _this3.renderTaskQueue.run(time);
363
- });
364
- }
365
- }
366
- }, {
367
- key: "initContainer",
368
- value: function initContainer() {
369
- if (typeof this.options.container === 'string') {
370
- this.container = window.document.getElementById(this.options.container);
371
-
372
- if (!this.container) {
373
- throw new Error("Container '".concat(this.options.container, "' not found."));
374
- }
375
- } else if (this.options.container instanceof HTMLElement) {
376
- this.container = this.options.container;
377
- } else {
378
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
379
- }
380
-
381
- var container = this.container;
382
- container.classList.add('l7-map');
383
- var canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
384
-
385
- if (this.options.interactive) {
386
- canvasContainer.classList.add('l7-interactive');
387
- } // this.canvas = DOM.create(
388
- // 'canvas',
389
- // 'l7-canvas',
390
- // canvasContainer,
391
- // ) as HTMLCanvasElement;
392
- // this.canvas.setAttribute('tabindex', '-');
393
- // this.canvas.setAttribute('aria-label', 'Map');
394
-
395
- }
396
- }, {
397
- key: "containerDimensions",
398
- value: function containerDimensions() {
399
- var width = 0;
400
- var height = 0;
401
-
402
- if (this.container) {
403
- width = this.container.clientWidth || 400;
404
- height = this.container.clientHeight || 300;
405
- }
406
-
407
- return [width, height];
408
- }
409
- }, {
410
- key: "resizeCanvas",
411
- value: function resizeCanvas(width, height) {
412
- var pixelRatio = DOM.DPR || 1;
413
- this.canvas.width = pixelRatio * width;
414
- this.canvas.height = pixelRatio * height; // Maintain the same canvas size, potentially downscaling it for HiDPI displays
415
-
416
- this.canvas.style.width = "".concat(width, "px");
417
- this.canvas.style.height = "".concat(height, "px");
418
- }
419
- }]);
420
-
421
- return EarthMap;
422
- }(Camera);
@@ -1,54 +0,0 @@
1
- import Point from './point';
2
- /**
3
- * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
4
- * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
5
- * on top of the map and having the vanishing point shift as UI elements resize.
6
- *
7
- * @param {number} [top=0]
8
- * @param {number} [bottom=0]
9
- * @param {number} [left=0]
10
- * @param {number} [right=0]
11
- */
12
- export default class EdgeInsets {
13
- top: number;
14
- bottom: number;
15
- left: number;
16
- right: number;
17
- constructor(top?: number, bottom?: number, left?: number, right?: number);
18
- /**
19
- * Interpolates the inset in-place.
20
- * This maintains the current inset value for any inset not present in `target`.
21
- *
22
- * @param {PaddingOptions} target
23
- * @param {number} t
24
- * @returns {EdgeInsets}
25
- * @memberof EdgeInsets
26
- */
27
- interpolate(start: IPaddingOptions | EdgeInsets, target: IPaddingOptions, t: number): EdgeInsets;
28
- /**
29
- * Utility method that computes the new apprent center or vanishing point after applying insets.
30
- * This is in pixels and with the top left being (0.0) and +y being downwards.
31
- *
32
- * @param {number} width
33
- * @param {number} height
34
- * @returns {Point}
35
- * @memberof EdgeInsets
36
- */
37
- getCenter(width: number, height: number): Point;
38
- equals(other: IPaddingOptions): boolean;
39
- clone(): EdgeInsets;
40
- /**
41
- * Returns the current sdtate as json, useful when you want to have a
42
- * read-only representation of the inset.
43
- *
44
- * @returns {PaddingOptions}
45
- * @memberof EdgeInsets
46
- */
47
- toJSON(): IPaddingOptions;
48
- }
49
- export interface IPaddingOptions {
50
- top?: number;
51
- bottom?: number;
52
- right?: number;
53
- left?: number;
54
- }