@antv/l7-map 2.18.0 → 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 +3 -3
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -718
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -369
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -108
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -73
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -154
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -84
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -224
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -87
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -961
  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 -78
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -180
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -54
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -11
  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 -64
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -95
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -50
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -26
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -157
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -577
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -9
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -143
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -125
  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 -118
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -44
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -46
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -46
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -11
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -325
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -67
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -84
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -74
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -115
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -97
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -106
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -54
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -109
  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 -110
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -93
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -77
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -54
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -125
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -134
  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 -387
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -88
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -112
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -140
  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 -47
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -89
  113. package/lib/camera.js +0 -724
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -376
  116. package/lib/geo/edge_insets.js +0 -114
  117. package/lib/geo/lng_lat.js +0 -81
  118. package/lib/geo/lng_lat_bounds.js +0 -161
  119. package/lib/geo/mercator.js +0 -100
  120. package/lib/geo/point.js +0 -231
  121. package/lib/geo/simple.js +0 -104
  122. package/lib/geo/transform.js +0 -971
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -84
  125. package/lib/handler/box_zoom.js +0 -186
  126. package/lib/handler/click_zoom.js +0 -61
  127. package/lib/handler/events/event.js +0 -20
  128. package/lib/handler/events/index.js +0 -27
  129. package/lib/handler/events/map_mouse_event.js +0 -70
  130. package/lib/handler/events/map_touch_event.js +0 -100
  131. package/lib/handler/events/map_wheel_event.js +0 -57
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -162
  134. package/lib/handler/handler_manager.js +0 -584
  135. package/lib/handler/handler_util.js +0 -15
  136. package/lib/handler/keyboard.js +0 -151
  137. package/lib/handler/map_event.js +0 -131
  138. package/lib/handler/mouse/index.js +0 -27
  139. package/lib/handler/mouse/mouse_handler.js +0 -124
  140. package/lib/handler/mouse/mousepan_handler.js +0 -49
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -51
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -51
  143. package/lib/handler/mouse/util.js +0 -22
  144. package/lib/handler/scroll_zoom.js +0 -333
  145. package/lib/handler/shim/dblclick_zoom.js +0 -74
  146. package/lib/handler/shim/drag_pan.js +0 -91
  147. package/lib/handler/shim/drag_rotate.js +0 -81
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -122
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -106
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -112
  151. package/lib/handler/tap/tap_recognizer.js +0 -63
  152. package/lib/handler/tap/tap_zoom.js +0 -115
  153. package/lib/handler/touch/index.js +0 -34
  154. package/lib/handler/touch/touch_pan.js +0 -117
  155. package/lib/handler/touch/touch_pitch.js +0 -98
  156. package/lib/handler/touch/touch_rotate.js +0 -82
  157. package/lib/handler/touch/touch_zoom.js +0 -59
  158. package/lib/handler/touch/two_touch.js +0 -131
  159. package/lib/hash.js +0 -143
  160. package/lib/index.js +0 -49
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -394
  163. package/lib/util.js +0 -108
  164. package/lib/utils/Aabb.js +0 -119
  165. package/lib/utils/dom.js +0 -147
  166. package/lib/utils/performance.js +0 -70
  167. package/lib/utils/primitives.js +0 -54
  168. package/lib/utils/task_queue.js +0 -97
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,369 +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
- 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); }; }
9
- 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; } }
10
- import { DOM, lodashUtil } from '@antv/l7-utils';
11
- import Camera from "./camera";
12
- function loadStyles(css, doc) {
13
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
14
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
15
- if (isMiniAli || isWeChatMiniProgram) {
16
- return;
17
- }
18
- if (!doc) doc = document;
19
- if (!doc) {
20
- return;
21
- }
22
- var head = doc.head || doc.getElementsByTagName('head')[0];
23
- if (!head) {
24
- head = doc.createElement('head');
25
- var body = doc.body || doc.getElementsByTagName('body')[0];
26
- if (body) {
27
- body.parentNode.insertBefore(head, body);
28
- } else {
29
- doc.documentElement.appendChild(head);
30
- }
31
- }
32
- var style = doc.createElement('style');
33
- style.type = 'text/css';
34
- if (style.styleSheet) {
35
- style.styleSheet.cssText = css;
36
- } else {
37
- style.appendChild(doc.createTextNode(css));
38
- }
39
- head.appendChild(style);
40
- return style;
41
- }
42
- 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");
43
- import LngLat from "./geo/lng_lat";
44
- import LngLatBounds from "./geo/lng_lat_bounds";
45
- // @ts-ignore
46
- import Point from "./geo/point";
47
- import HandlerManager from "./handler/handler_manager";
48
- import { renderframe } from "./util";
49
- import { PerformanceUtils } from "./utils/performance";
50
- import TaskQueue from "./utils/task_queue";
51
- var defaultMinZoom = -2;
52
- var defaultMaxZoom = 22;
53
- var merge = lodashUtil.merge;
54
- // the default values, but also the valid range
55
- var defaultMinPitch = 0;
56
- var defaultMaxPitch = 60;
57
- var DefaultOptions = {
58
- hash: false,
59
- zoom: -1,
60
- center: [112, 32],
61
- pitch: 0,
62
- bearing: 0,
63
- interactive: true,
64
- minZoom: defaultMinZoom,
65
- maxZoom: defaultMaxZoom,
66
- minPitch: defaultMinPitch,
67
- maxPitch: defaultMaxPitch,
68
- scrollZoom: true,
69
- boxZoom: true,
70
- dragRotate: true,
71
- dragPan: true,
72
- keyboard: true,
73
- doubleClickZoom: true,
74
- touchZoomRotate: true,
75
- touchPitch: true,
76
- bearingSnap: 7,
77
- clickTolerance: 3,
78
- pitchWithRotate: true,
79
- trackResize: true,
80
- renderWorldCopies: true,
81
- pitchEnabled: true,
82
- rotateEnabled: true
83
- };
84
- export var EarthMap = /*#__PURE__*/function (_Camera) {
85
- _inherits(EarthMap, _Camera);
86
- var _super = _createSuper(EarthMap);
87
- function EarthMap(options) {
88
- var _this;
89
- _classCallCheck(this, EarthMap);
90
- _this = _super.call(this, merge({}, DefaultOptions, options));
91
- _defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
92
- _defineProperty(_assertThisInitialized(_this), "trackResize", true);
93
- _defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
94
- _this.update();
95
- });
96
- _defineProperty(_assertThisInitialized(_this), "onWindowResize", function (event) {
97
- if (_this.trackResize) {
98
- _this.resize({
99
- originalEvent: event
100
- }).update();
101
- }
102
- });
103
- _this.initContainer();
104
- _this.resize();
105
- _this.handlers = new HandlerManager(_assertThisInitialized(_this), _this.options);
106
- if (typeof window !== 'undefined') {
107
- window.addEventListener('online', _this.onWindowOnline, false);
108
- window.addEventListener('resize', _this.onWindowResize, false);
109
- window.addEventListener('orientationchange', _this.onWindowResize, false);
110
- }
111
- return _this;
112
- }
113
- _createClass(EarthMap, [{
114
- key: "resize",
115
- value: function resize(eventData) {
116
- var dimensions = this.containerDimensions();
117
- var width = dimensions[0];
118
- var height = dimensions[1];
119
-
120
- // this.resizeCanvas(width, height);
121
- this.transform.resize(width, height);
122
- var fireMoving = !this.moving;
123
- if (fireMoving) {
124
- this.stop();
125
- this.emit('movestart', new Event('movestart', eventData));
126
- this.emit('move', new Event('move', eventData));
127
- }
128
- this.emit('resize', new Event('resize', eventData));
129
- if (fireMoving) {
130
- this.emit('moveend', new Event('moveend', eventData));
131
- }
132
- return this;
133
- }
134
- }, {
135
- key: "getContainer",
136
- value: function getContainer() {
137
- return this.container;
138
- }
139
- }, {
140
- key: "getCanvas",
141
- value: function getCanvas() {
142
- return this.canvas;
143
- }
144
- }, {
145
- key: "getCanvasContainer",
146
- value: function getCanvasContainer() {
147
- return this.canvasContainer;
148
- }
149
- }, {
150
- key: "project",
151
- value: function project(lngLat) {
152
- return this.transform.locationPoint(LngLat.convert(lngLat));
153
- }
154
- }, {
155
- key: "unproject",
156
- value: function unproject(point) {
157
- return this.transform.pointLocation(Point.convert(point));
158
- }
159
- }, {
160
- key: "getBounds",
161
- value: function getBounds() {
162
- return this.transform.getBounds();
163
- }
164
- }, {
165
- key: "getMaxBounds",
166
- value: function getMaxBounds() {
167
- return this.transform.getMaxBounds();
168
- }
169
- }, {
170
- key: "setMaxBounds",
171
- value: function setMaxBounds(bounds) {
172
- this.transform.setMaxBounds(LngLatBounds.convert(bounds));
173
- }
174
-
175
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
176
- }, {
177
- key: "setStyle",
178
- value: function setStyle(style) {
179
- return;
180
- }
181
- }, {
182
- key: "setMinZoom",
183
- value: function setMinZoom(minZoom) {
184
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
185
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
186
- this.transform.minZoom = minZoom;
187
- if (this.getZoom() < minZoom) {
188
- this.setZoom(minZoom);
189
- }
190
- return this;
191
- } else {
192
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
193
- }
194
- }
195
- }, {
196
- key: "getMinZoom",
197
- value: function getMinZoom() {
198
- return this.transform.minZoom;
199
- }
200
- }, {
201
- key: "setMaxZoom",
202
- value: function setMaxZoom(maxZoom) {
203
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
204
- if (maxZoom >= this.transform.minZoom) {
205
- this.transform.maxZoom = maxZoom;
206
- if (this.getZoom() > maxZoom) {
207
- this.setZoom(maxZoom);
208
- }
209
- return this;
210
- } else {
211
- throw new Error('maxZoom must be greater than the current minZoom');
212
- }
213
- }
214
- }, {
215
- key: "getMaxZoom",
216
- value: function getMaxZoom() {
217
- return this.transform.maxZoom;
218
- }
219
- }, {
220
- key: "setMinPitch",
221
- value: function setMinPitch(minPitch) {
222
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
223
- if (minPitch < defaultMinPitch) {
224
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
225
- }
226
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
227
- this.transform.minPitch = minPitch;
228
- if (this.getPitch() < minPitch) {
229
- this.setPitch(minPitch);
230
- }
231
- return this;
232
- } else {
233
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
234
- }
235
- }
236
- }, {
237
- key: "getMinPitch",
238
- value: function getMinPitch() {
239
- return this.transform.minPitch;
240
- }
241
- }, {
242
- key: "setMaxPitch",
243
- value: function setMaxPitch(maxPitch) {
244
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
245
- if (maxPitch > defaultMaxPitch) {
246
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
247
- }
248
- if (maxPitch >= this.transform.minPitch) {
249
- this.transform.maxPitch = maxPitch;
250
- if (this.getPitch() > maxPitch) {
251
- this.setPitch(maxPitch);
252
- }
253
- return this;
254
- } else {
255
- throw new Error('maxPitch must be greater than the current minPitch');
256
- }
257
- }
258
- }, {
259
- key: "getMaxPitch",
260
- value: function getMaxPitch() {
261
- return this.transform.maxPitch;
262
- }
263
- }, {
264
- key: "getRenderWorldCopies",
265
- value: function getRenderWorldCopies() {
266
- return this.transform.renderWorldCopies;
267
- }
268
- }, {
269
- key: "setRenderWorldCopies",
270
- value: function setRenderWorldCopies(renderWorldCopies) {
271
- this.transform.renderWorldCopies = !!renderWorldCopies;
272
- }
273
- }, {
274
- key: "remove",
275
- value: function remove() {
276
- if (this.frame) {
277
- this.frame.cancel();
278
- this.frame = null;
279
- }
280
- this.renderTaskQueue.clear();
281
- }
282
- }, {
283
- key: "requestRenderFrame",
284
- value: function requestRenderFrame(cb) {
285
- this.update();
286
- return this.renderTaskQueue.add(cb);
287
- }
288
- }, {
289
- key: "cancelRenderFrame",
290
- value: function cancelRenderFrame(id) {
291
- return this.renderTaskQueue.remove(id);
292
- }
293
- }, {
294
- key: "triggerRepaint",
295
- value: function triggerRepaint() {
296
- var _this2 = this;
297
- if (!this.frame) {
298
- this.frame = renderframe(function (paintStartTimeStamp) {
299
- PerformanceUtils.frame(paintStartTimeStamp);
300
- _this2.frame = null;
301
- _this2.update(paintStartTimeStamp);
302
- });
303
- }
304
- }
305
- }, {
306
- key: "update",
307
- value: function update(time) {
308
- var _this3 = this;
309
- if (!this.frame) {
310
- this.frame = renderframe(function (paintStartTimeStamp) {
311
- PerformanceUtils.frame(paintStartTimeStamp);
312
- _this3.frame = null;
313
- _this3.renderTaskQueue.run(time);
314
- });
315
- }
316
- }
317
- }, {
318
- key: "initContainer",
319
- value: function initContainer() {
320
- if (typeof this.options.container === 'string') {
321
- this.container = window.document.getElementById(this.options.container);
322
- if (!this.container) {
323
- throw new Error("Container '".concat(this.options.container, "' not found."));
324
- }
325
- } else if (this.options.container instanceof HTMLElement) {
326
- this.container = this.options.container;
327
- } else {
328
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
329
- }
330
- var container = this.container;
331
- container.classList.add('l7-map');
332
- var canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
333
- if (this.options.interactive) {
334
- canvasContainer.classList.add('l7-interactive');
335
- }
336
-
337
- // this.canvas = DOM.create(
338
- // 'canvas',
339
- // 'l7-canvas',
340
- // canvasContainer,
341
- // ) as HTMLCanvasElement;
342
- // this.canvas.setAttribute('tabindex', '-');
343
- // this.canvas.setAttribute('aria-label', 'Map');
344
- }
345
- }, {
346
- key: "containerDimensions",
347
- value: function containerDimensions() {
348
- var width = 0;
349
- var height = 0;
350
- if (this.container) {
351
- width = this.container.clientWidth || 400;
352
- height = this.container.clientHeight || 300;
353
- }
354
- return [width, height];
355
- }
356
- }, {
357
- key: "resizeCanvas",
358
- value: function resizeCanvas(width, height) {
359
- var pixelRatio = DOM.DPR || 1;
360
- this.canvas.width = pixelRatio * width;
361
- this.canvas.height = pixelRatio * height;
362
-
363
- // Maintain the same canvas size, potentially downscaling it for HiDPI displays
364
- this.canvas.style.width = "".concat(width, "px");
365
- this.canvas.style.height = "".concat(height, "px");
366
- }
367
- }]);
368
- return EarthMap;
369
- }(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
- }
@@ -1,108 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- // @ts-ignore
4
- import { clamp, interpolate as _interpolate } from "../util";
5
- import Point from "./point";
6
-
7
- /**
8
- * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
9
- * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
10
- * on top of the map and having the vanishing point shift as UI elements resize.
11
- *
12
- * @param {number} [top=0]
13
- * @param {number} [bottom=0]
14
- * @param {number} [left=0]
15
- * @param {number} [right=0]
16
- */
17
- var EdgeInsets = /*#__PURE__*/function () {
18
- function EdgeInsets() {
19
- var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
20
- var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
21
- var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
22
- var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
23
- _classCallCheck(this, EdgeInsets);
24
- if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
25
- throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
26
- }
27
- this.top = top;
28
- this.bottom = bottom;
29
- this.left = left;
30
- this.right = right;
31
- }
32
-
33
- /**
34
- * Interpolates the inset in-place.
35
- * This maintains the current inset value for any inset not present in `target`.
36
- *
37
- * @param {PaddingOptions} target
38
- * @param {number} t
39
- * @returns {EdgeInsets}
40
- * @memberof EdgeInsets
41
- */
42
- _createClass(EdgeInsets, [{
43
- key: "interpolate",
44
- value: function interpolate(start, target, t) {
45
- if (target.top != null && start.top != null) {
46
- this.top = _interpolate(start.top, target.top, t);
47
- }
48
- if (target.bottom != null && start.bottom != null) {
49
- this.bottom = _interpolate(start.bottom, target.bottom, t);
50
- }
51
- if (target.left != null && start.left != null) {
52
- this.left = _interpolate(start.left, target.left, t);
53
- }
54
- if (target.right != null && start.right != null) {
55
- this.right = _interpolate(start.right, target.right, t);
56
- }
57
- return this;
58
- }
59
-
60
- /**
61
- * Utility method that computes the new apprent center or vanishing point after applying insets.
62
- * This is in pixels and with the top left being (0.0) and +y being downwards.
63
- *
64
- * @param {number} width
65
- * @param {number} height
66
- * @returns {Point}
67
- * @memberof EdgeInsets
68
- */
69
- }, {
70
- key: "getCenter",
71
- value: function getCenter(width, height) {
72
- // Clamp insets so they never overflow width/height and always calculate a valid center
73
- var x = clamp((this.left + width - this.right) / 2, 0, width);
74
- var y = clamp((this.top + height - this.bottom) / 2, 0, height);
75
- return new Point(x, y);
76
- }
77
- }, {
78
- key: "equals",
79
- value: function equals(other) {
80
- return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
81
- }
82
- }, {
83
- key: "clone",
84
- value: function clone() {
85
- return new EdgeInsets(this.top, this.bottom, this.left, this.right);
86
- }
87
-
88
- /**
89
- * Returns the current sdtate as json, useful when you want to have a
90
- * read-only representation of the inset.
91
- *
92
- * @returns {PaddingOptions}
93
- * @memberof EdgeInsets
94
- */
95
- }, {
96
- key: "toJSON",
97
- value: function toJSON() {
98
- return {
99
- top: this.top,
100
- bottom: this.bottom,
101
- left: this.left,
102
- right: this.right
103
- };
104
- }
105
- }]);
106
- return EdgeInsets;
107
- }();
108
- export { EdgeInsets as default };