@antv/l7-map 2.21.1 → 2.21.3

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 (158) hide show
  1. package/es/camera.js +595 -674
  2. package/es/earthmap.js +313 -276
  3. package/es/geo/edge_insets.js +57 -72
  4. package/es/geo/lng_lat.js +50 -64
  5. package/es/geo/lng_lat_bounds.js +101 -137
  6. package/es/geo/mercator.js +23 -35
  7. package/es/geo/point.js +150 -221
  8. package/es/geo/simple.js +22 -34
  9. package/es/geo/transform.js +839 -905
  10. package/es/handler/blockable_map_event.js +46 -66
  11. package/es/handler/box_zoom.js +125 -143
  12. package/es/handler/click_zoom.js +37 -51
  13. package/es/handler/events/event.js +11 -9
  14. package/es/handler/events/map_mouse_event.js +39 -54
  15. package/es/handler/events/map_touch_event.js +54 -73
  16. package/es/handler/events/map_wheel_event.js +22 -38
  17. package/es/handler/events/render_event.js +6 -23
  18. package/es/handler/handler_inertia.js +98 -113
  19. package/es/handler/handler_manager.js +349 -437
  20. package/es/handler/handler_util.js +2 -2
  21. package/es/handler/keyboard.js +98 -110
  22. package/es/handler/map_event.js +81 -117
  23. package/es/handler/mouse/mouse_handler.js +81 -100
  24. package/es/handler/mouse/mousepan_handler.js +16 -39
  25. package/es/handler/mouse/mousepitch_hander.js +18 -40
  26. package/es/handler/mouse/mouserotate_hander.js +18 -40
  27. package/es/handler/mouse/util.js +7 -5
  28. package/es/handler/scroll_zoom.js +221 -231
  29. package/es/handler/shim/dblclick_zoom.js +36 -47
  30. package/es/handler/shim/drag_pan.js +41 -50
  31. package/es/handler/shim/drag_rotate.js +38 -48
  32. package/es/handler/shim/touch_zoom_rotate.js +68 -79
  33. package/es/handler/tap/single_tap_recognizer.js +60 -80
  34. package/es/handler/tap/tap_drag_zoom.js +72 -89
  35. package/es/handler/tap/tap_recognizer.js +37 -45
  36. package/es/handler/tap/tap_zoom.js +67 -95
  37. package/es/handler/touch/touch_pan.js +77 -96
  38. package/es/handler/touch/touch_pitch.js +61 -79
  39. package/es/handler/touch/touch_rotate.js +47 -67
  40. package/es/handler/touch/touch_zoom.js +29 -46
  41. package/es/handler/touch/two_touch.js +79 -104
  42. package/es/hash.js +75 -88
  43. package/es/map.js +318 -284
  44. package/es/util.js +18 -37
  45. package/es/utils/Aabb.js +60 -100
  46. package/es/utils/dom.js +32 -55
  47. package/es/utils/performance.js +25 -29
  48. package/es/utils/primitives.js +33 -42
  49. package/es/utils/task_queue.js +47 -76
  50. package/lib/camera.d.ts +86 -0
  51. package/lib/camera.js +597 -672
  52. package/lib/earthmap.d.ts +69 -0
  53. package/lib/earthmap.js +314 -276
  54. package/lib/geo/edge_insets.d.ts +54 -0
  55. package/lib/geo/edge_insets.js +58 -70
  56. package/lib/geo/lng_lat.d.ts +18 -0
  57. package/lib/geo/lng_lat.js +50 -62
  58. package/lib/geo/lng_lat_bounds.d.ts +25 -0
  59. package/lib/geo/lng_lat_bounds.js +102 -136
  60. package/lib/geo/mercator.d.ts +30 -0
  61. package/lib/geo/mercator.js +26 -37
  62. package/lib/geo/point.d.ts +40 -0
  63. package/lib/geo/point.js +151 -220
  64. package/lib/geo/simple.d.ts +30 -0
  65. package/lib/geo/simple.js +25 -36
  66. package/lib/geo/transform.d.ts +198 -0
  67. package/lib/geo/transform.js +844 -907
  68. package/lib/handler/IHandler.d.ts +34 -0
  69. package/lib/handler/blockable_map_event.d.ts +17 -0
  70. package/lib/handler/blockable_map_event.js +48 -65
  71. package/lib/handler/box_zoom.d.ts +59 -0
  72. package/lib/handler/box_zoom.js +126 -143
  73. package/lib/handler/click_zoom.d.ts +16 -0
  74. package/lib/handler/click_zoom.js +38 -50
  75. package/lib/handler/events/event.d.ts +4 -0
  76. package/lib/handler/events/event.js +12 -9
  77. package/lib/handler/events/index.d.ts +4 -0
  78. package/lib/handler/events/index.js +3 -3
  79. package/lib/handler/events/map_mouse_event.d.ts +34 -0
  80. package/lib/handler/events/map_mouse_event.js +41 -52
  81. package/lib/handler/events/map_touch_event.d.ts +57 -0
  82. package/lib/handler/events/map_touch_event.js +56 -71
  83. package/lib/handler/events/map_wheel_event.d.ts +33 -0
  84. package/lib/handler/events/map_wheel_event.js +23 -37
  85. package/lib/handler/events/render_event.d.ts +5 -0
  86. package/lib/handler/events/render_event.js +7 -22
  87. package/lib/handler/handler_inertia.d.ts +23 -0
  88. package/lib/handler/handler_inertia.js +102 -112
  89. package/lib/handler/handler_manager.d.ts +61 -0
  90. package/lib/handler/handler_manager.js +351 -437
  91. package/lib/handler/handler_util.d.ts +4 -0
  92. package/lib/handler/handler_util.js +2 -2
  93. package/lib/handler/keyboard.d.ts +36 -0
  94. package/lib/handler/keyboard.js +98 -110
  95. package/lib/handler/map_event.d.ts +29 -0
  96. package/lib/handler/map_event.js +83 -116
  97. package/lib/handler/mouse/index.d.ts +4 -0
  98. package/lib/handler/mouse/index.js +3 -3
  99. package/lib/handler/mouse/mouse_handler.d.ts +22 -0
  100. package/lib/handler/mouse/mouse_handler.js +83 -99
  101. package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
  102. package/lib/handler/mouse/mousepan_handler.js +19 -38
  103. package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
  104. package/lib/handler/mouse/mousepitch_hander.js +21 -39
  105. package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
  106. package/lib/handler/mouse/mouserotate_hander.js +21 -39
  107. package/lib/handler/mouse/util.d.ts +6 -0
  108. package/lib/handler/mouse/util.js +7 -6
  109. package/lib/handler/scroll_zoom.d.ts +93 -0
  110. package/lib/handler/scroll_zoom.js +221 -231
  111. package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
  112. package/lib/handler/shim/dblclick_zoom.js +37 -46
  113. package/lib/handler/shim/drag_pan.d.ts +61 -0
  114. package/lib/handler/shim/drag_pan.js +42 -49
  115. package/lib/handler/shim/drag_rotate.d.ts +46 -0
  116. package/lib/handler/shim/drag_rotate.js +39 -47
  117. package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
  118. package/lib/handler/shim/touch_zoom_rotate.js +69 -78
  119. package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
  120. package/lib/handler/tap/single_tap_recognizer.js +63 -79
  121. package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
  122. package/lib/handler/tap/tap_drag_zoom.js +74 -88
  123. package/lib/handler/tap/tap_recognizer.d.ts +17 -0
  124. package/lib/handler/tap/tap_recognizer.js +41 -47
  125. package/lib/handler/tap/tap_zoom.d.ts +22 -0
  126. package/lib/handler/tap/tap_zoom.js +69 -94
  127. package/lib/handler/touch/index.d.ts +5 -0
  128. package/lib/handler/touch/index.js +4 -4
  129. package/lib/handler/touch/touch_pan.d.ts +30 -0
  130. package/lib/handler/touch/touch_pan.js +79 -95
  131. package/lib/handler/touch/touch_pitch.d.ts +13 -0
  132. package/lib/handler/touch/touch_pitch.js +64 -78
  133. package/lib/handler/touch/touch_rotate.d.ts +12 -0
  134. package/lib/handler/touch/touch_rotate.js +50 -66
  135. package/lib/handler/touch/touch_zoom.d.ts +12 -0
  136. package/lib/handler/touch/touch_zoom.js +32 -45
  137. package/lib/handler/touch/two_touch.d.ts +23 -0
  138. package/lib/handler/touch/two_touch.js +81 -103
  139. package/lib/hash.d.ts +14 -0
  140. package/lib/hash.js +75 -88
  141. package/lib/index.d.ts +4 -0
  142. package/lib/index.js +4 -4
  143. package/lib/interface.d.ts +34 -0
  144. package/lib/map.d.ts +70 -0
  145. package/lib/map.js +319 -284
  146. package/lib/util.d.ts +25 -0
  147. package/lib/util.js +20 -36
  148. package/lib/utils/Aabb.d.ts +12 -0
  149. package/lib/utils/Aabb.js +61 -99
  150. package/lib/utils/dom.d.ts +4 -0
  151. package/lib/utils/dom.js +34 -55
  152. package/lib/utils/performance.d.ts +17 -0
  153. package/lib/utils/performance.js +25 -29
  154. package/lib/utils/primitives.d.ts +6 -0
  155. package/lib/utils/primitives.js +34 -41
  156. package/lib/utils/task_queue.d.ts +13 -0
  157. package/lib/utils/task_queue.js +47 -76
  158. package/package.json +25 -32
package/es/earthmap.js CHANGED
@@ -1,12 +1,4 @@
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
1
  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
2
  import { DOM, lodashUtil } from '@antv/l7-utils';
11
3
  import Camera from "./camera";
12
4
  function loadStyles(css, doc) {
@@ -39,7 +31,102 @@ function loadStyles(css, doc) {
39
31
  head.appendChild(style);
40
32
  return style;
41
33
  }
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");
34
+ loadStyles(`.l7-map {
35
+ font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
36
+ overflow: hidden;
37
+ position: relative;
38
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
39
+ }
40
+
41
+ .l7-canvas {
42
+ position: absolute;
43
+ left: 0;
44
+ top: 0;
45
+ }
46
+
47
+ .l7-map:-webkit-full-screen {
48
+ width: 100%;
49
+ height: 100%;
50
+ }
51
+
52
+ .l7-canary {
53
+ background-color: salmon;
54
+ }
55
+
56
+ .l7-canvas-container.l7-interactive,
57
+ .l7-ctrl-group button.l7-ctrl-compass {
58
+ cursor: grab;
59
+ -moz-user-select: none;
60
+ -webkit-user-select: none;
61
+ -ms-user-select: none;
62
+ user-select: none;
63
+ }
64
+
65
+ .l7-canvas-container.l7-interactive.l7-track-pointer {
66
+ cursor: pointer;
67
+ }
68
+
69
+ .l7-canvas-container.l7-interactive:active,
70
+ .l7-ctrl-group button.l7-ctrl-compass:active {
71
+ cursor: grabbing;
72
+ }
73
+
74
+ .l7-canvas-container.l7-touch-zoom-rotate,
75
+ .l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
76
+ touch-action: pan-x pan-y;
77
+ }
78
+
79
+ .l7-canvas-container.l7-touch-drag-pan,
80
+ .l7-canvas-container.l7-touch-drag-pan .l7-canvas {
81
+ touch-action: pinch-zoom;
82
+ }
83
+
84
+ .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
85
+ .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
86
+ touch-action: none;
87
+ }
88
+
89
+ .l7-ctrl-top-left,
90
+ .l7-ctrl-top-right,
91
+ .l7-ctrl-bottom-left,
92
+ .l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }
93
+ .l7-ctrl-top-left { top: 0; left: 0; }
94
+ .l7-ctrl-top-right { top: 0; right: 0; }
95
+ .l7-ctrl-bottom-left { bottom: 0; left: 0; }
96
+ .l7-ctrl-bottom-right { right: 0; bottom: 0; }
97
+
98
+ .l7-ctrl {
99
+ clear: both;
100
+ pointer-events: auto;
101
+
102
+ /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
103
+ -webkit-transform: translate(0, 0);
104
+ transform: translate(0, 0);
105
+ }
106
+ .l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }
107
+ .l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }
108
+ .l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }
109
+ .l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }
110
+
111
+
112
+ .l7-crosshair,
113
+ .l7-crosshair .l7-interactive,
114
+ .l7-crosshair .l7-interactive:active {
115
+ cursor: crosshair;
116
+ }
117
+
118
+ .l7-boxzoom {
119
+ position: absolute;
120
+ top: 0;
121
+ left: 0;
122
+ width: 0;
123
+ height: 0;
124
+ background: #fff;
125
+ border: 2px dotted #202020;
126
+ opacity: 0.5;
127
+ z-index: 10;
128
+ }
129
+ `);
43
130
  import LngLat from "./geo/lng_lat";
44
131
  import LngLatBounds from "./geo/lng_lat_bounds";
45
132
  // @ts-ignore
@@ -49,13 +136,15 @@ import HandlerManager from "./handler/handler_manager";
49
136
  import { renderframe } from "./util";
50
137
  import { PerformanceUtils } from "./utils/performance";
51
138
  import TaskQueue from "./utils/task_queue";
52
- var defaultMinZoom = -2;
53
- var defaultMaxZoom = 22;
54
- var merge = lodashUtil.merge;
139
+ const defaultMinZoom = -2;
140
+ const defaultMaxZoom = 22;
141
+ const {
142
+ merge
143
+ } = lodashUtil;
55
144
  // the default values, but also the valid range
56
- var defaultMinPitch = 0;
57
- var defaultMaxPitch = 60;
58
- var DefaultOptions = {
145
+ const defaultMinPitch = 0;
146
+ const defaultMaxPitch = 60;
147
+ const DefaultOptions = {
59
148
  hash: false,
60
149
  zoom: -1,
61
150
  center: [112, 32],
@@ -82,296 +171,244 @@ var DefaultOptions = {
82
171
  pitchEnabled: true,
83
172
  rotateEnabled: true
84
173
  };
85
- export var EarthMap = /*#__PURE__*/function (_Camera) {
86
- _inherits(EarthMap, _Camera);
87
- var _super = _createSuper(EarthMap);
88
- function EarthMap(options) {
89
- var _this;
90
- _classCallCheck(this, EarthMap);
91
- _this = _super.call(this, merge({}, DefaultOptions, options));
92
- _defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
93
- _defineProperty(_assertThisInitialized(_this), "trackResize", true);
94
- _defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
95
- _this.update();
174
+ export class EarthMap extends Camera {
175
+ constructor(options) {
176
+ super(merge({}, DefaultOptions, options));
177
+ _defineProperty(this, "doubleClickZoom", void 0);
178
+ _defineProperty(this, "dragRotate", void 0);
179
+ _defineProperty(this, "dragPan", void 0);
180
+ _defineProperty(this, "touchZoomRotate", void 0);
181
+ _defineProperty(this, "scrollZoom", void 0);
182
+ _defineProperty(this, "keyboard", void 0);
183
+ _defineProperty(this, "touchPitch", void 0);
184
+ _defineProperty(this, "boxZoom", void 0);
185
+ _defineProperty(this, "handlers", void 0);
186
+ _defineProperty(this, "container", void 0);
187
+ _defineProperty(this, "canvas", void 0);
188
+ _defineProperty(this, "canvasContainer", void 0);
189
+ _defineProperty(this, "renderTaskQueue", new TaskQueue());
190
+ _defineProperty(this, "frame", void 0);
191
+ _defineProperty(this, "trackResize", true);
192
+ _defineProperty(this, "onWindowOnline", () => {
193
+ this.update();
96
194
  });
97
- _defineProperty(_assertThisInitialized(_this), "onWindowResize", function (event) {
98
- if (_this.trackResize) {
99
- _this.resize({
195
+ _defineProperty(this, "onWindowResize", event => {
196
+ if (this.trackResize) {
197
+ this.resize({
100
198
  originalEvent: event
101
199
  }).update();
102
200
  }
103
201
  });
104
- _this.initContainer();
105
- _this.resize();
106
- _this.handlers = new HandlerManager(_assertThisInitialized(_this), _this.options);
202
+ this.initContainer();
203
+ this.resize();
204
+ this.handlers = new HandlerManager(this, this.options);
107
205
  if (typeof window !== 'undefined') {
108
- window.addEventListener('online', _this.onWindowOnline, false);
109
- window.addEventListener('resize', _this.onWindowResize, false);
110
- window.addEventListener('orientationchange', _this.onWindowResize, false);
206
+ window.addEventListener('online', this.onWindowOnline, false);
207
+ window.addEventListener('resize', this.onWindowResize, false);
208
+ window.addEventListener('orientationchange', this.onWindowResize, false);
111
209
  }
112
- return _this;
113
- }
114
- _createClass(EarthMap, [{
115
- key: "resize",
116
- value: function resize(eventData) {
117
- var dimensions = this.containerDimensions();
118
- var width = dimensions[0];
119
- var height = dimensions[1];
210
+ }
211
+ resize(eventData) {
212
+ const dimensions = this.containerDimensions();
213
+ const width = dimensions[0];
214
+ const height = dimensions[1];
120
215
 
121
- // this.resizeCanvas(width, height);
122
- this.transform.resize(width, height);
123
- var fireMoving = !this.moving;
124
- if (fireMoving) {
125
- this.stop();
126
- this.emit('movestart', new Event('movestart', eventData));
127
- this.emit('move', new Event('move', eventData));
128
- }
129
- this.emit('resize', new Event('resize', eventData));
130
- if (fireMoving) {
131
- this.emit('moveend', new Event('moveend', eventData));
132
- }
133
- return this;
134
- }
135
- }, {
136
- key: "getContainer",
137
- value: function getContainer() {
138
- return this.container;
139
- }
140
- }, {
141
- key: "getCanvas",
142
- value: function getCanvas() {
143
- return this.canvas;
144
- }
145
- }, {
146
- key: "getCanvasContainer",
147
- value: function getCanvasContainer() {
148
- return this.canvasContainer;
216
+ // this.resizeCanvas(width, height);
217
+ this.transform.resize(width, height);
218
+ const fireMoving = !this.moving;
219
+ if (fireMoving) {
220
+ this.stop();
221
+ this.emit('movestart', new Event('movestart', eventData));
222
+ this.emit('move', new Event('move', eventData));
149
223
  }
150
- }, {
151
- key: "project",
152
- value: function project(lngLat) {
153
- return this.transform.locationPoint(LngLat.convert(lngLat));
154
- }
155
- }, {
156
- key: "unproject",
157
- value: function unproject(point) {
158
- return this.transform.pointLocation(Point.convert(point));
159
- }
160
- }, {
161
- key: "getBounds",
162
- value: function getBounds() {
163
- return this.transform.getBounds();
164
- }
165
- }, {
166
- key: "getMaxBounds",
167
- value: function getMaxBounds() {
168
- return this.transform.getMaxBounds();
169
- }
170
- }, {
171
- key: "setMaxBounds",
172
- value: function setMaxBounds(bounds) {
173
- this.transform.setMaxBounds(LngLatBounds.convert(bounds));
224
+ this.emit('resize', new Event('resize', eventData));
225
+ if (fireMoving) {
226
+ this.emit('moveend', new Event('moveend', eventData));
174
227
  }
228
+ return this;
229
+ }
230
+ getContainer() {
231
+ return this.container;
232
+ }
233
+ getCanvas() {
234
+ return this.canvas;
235
+ }
236
+ getCanvasContainer() {
237
+ return this.canvasContainer;
238
+ }
239
+ project(lngLat) {
240
+ return this.transform.locationPoint(LngLat.convert(lngLat));
241
+ }
242
+ unproject(point) {
243
+ return this.transform.pointLocation(Point.convert(point));
244
+ }
245
+ getBounds() {
246
+ return this.transform.getBounds();
247
+ }
248
+ getMaxBounds() {
249
+ return this.transform.getMaxBounds();
250
+ }
251
+ setMaxBounds(bounds) {
252
+ this.transform.setMaxBounds(LngLatBounds.convert(bounds));
253
+ }
175
254
 
176
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
177
- }, {
178
- key: "setStyle",
179
- value: function setStyle(style) {
180
- return;
181
- }
182
- }, {
183
- key: "setMinZoom",
184
- value: function setMinZoom(minZoom) {
185
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
186
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
187
- this.transform.minZoom = minZoom;
188
- if (this.getZoom() < minZoom) {
189
- this.setZoom(minZoom);
190
- }
191
- return this;
192
- } else {
193
- throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
255
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
256
+ setStyle(style) {
257
+ return;
258
+ }
259
+ setMinZoom(minZoom) {
260
+ minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
261
+ if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
262
+ this.transform.minZoom = minZoom;
263
+ if (this.getZoom() < minZoom) {
264
+ this.setZoom(minZoom);
194
265
  }
266
+ return this;
267
+ } else {
268
+ throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);
195
269
  }
196
- }, {
197
- key: "getMinZoom",
198
- value: function getMinZoom() {
199
- return this.transform.minZoom;
200
- }
201
- }, {
202
- key: "setMaxZoom",
203
- value: function setMaxZoom(maxZoom) {
204
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
205
- if (maxZoom >= this.transform.minZoom) {
206
- this.transform.maxZoom = maxZoom;
207
- if (this.getZoom() > maxZoom) {
208
- this.setZoom(maxZoom);
209
- }
210
- return this;
211
- } else {
212
- throw new Error('maxZoom must be greater than the current minZoom');
270
+ }
271
+ getMinZoom() {
272
+ return this.transform.minZoom;
273
+ }
274
+ setMaxZoom(maxZoom) {
275
+ maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
276
+ if (maxZoom >= this.transform.minZoom) {
277
+ this.transform.maxZoom = maxZoom;
278
+ if (this.getZoom() > maxZoom) {
279
+ this.setZoom(maxZoom);
213
280
  }
281
+ return this;
282
+ } else {
283
+ throw new Error('maxZoom must be greater than the current minZoom');
214
284
  }
215
- }, {
216
- key: "getMaxZoom",
217
- value: function getMaxZoom() {
218
- return this.transform.maxZoom;
285
+ }
286
+ getMaxZoom() {
287
+ return this.transform.maxZoom;
288
+ }
289
+ setMinPitch(minPitch) {
290
+ minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
291
+ if (minPitch < defaultMinPitch) {
292
+ throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);
219
293
  }
220
- }, {
221
- key: "setMinPitch",
222
- value: function setMinPitch(minPitch) {
223
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
224
- if (minPitch < defaultMinPitch) {
225
- throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
226
- }
227
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
228
- this.transform.minPitch = minPitch;
229
- if (this.getPitch() < minPitch) {
230
- this.setPitch(minPitch);
231
- }
232
- return this;
233
- } else {
234
- throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
294
+ if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
295
+ this.transform.minPitch = minPitch;
296
+ if (this.getPitch() < minPitch) {
297
+ this.setPitch(minPitch);
235
298
  }
299
+ return this;
300
+ } else {
301
+ throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);
236
302
  }
237
- }, {
238
- key: "getMinPitch",
239
- value: function getMinPitch() {
240
- return this.transform.minPitch;
303
+ }
304
+ getMinPitch() {
305
+ return this.transform.minPitch;
306
+ }
307
+ setMaxPitch(maxPitch) {
308
+ maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
309
+ if (maxPitch > defaultMaxPitch) {
310
+ throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
241
311
  }
242
- }, {
243
- key: "setMaxPitch",
244
- value: function setMaxPitch(maxPitch) {
245
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
246
- if (maxPitch > defaultMaxPitch) {
247
- throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
312
+ if (maxPitch >= this.transform.minPitch) {
313
+ this.transform.maxPitch = maxPitch;
314
+ if (this.getPitch() > maxPitch) {
315
+ this.setPitch(maxPitch);
248
316
  }
249
- if (maxPitch >= this.transform.minPitch) {
250
- this.transform.maxPitch = maxPitch;
251
- if (this.getPitch() > maxPitch) {
252
- this.setPitch(maxPitch);
253
- }
254
- return this;
255
- } else {
256
- throw new Error('maxPitch must be greater than the current minPitch');
257
- }
258
- }
259
- }, {
260
- key: "getMaxPitch",
261
- value: function getMaxPitch() {
262
- return this.transform.maxPitch;
317
+ return this;
318
+ } else {
319
+ throw new Error('maxPitch must be greater than the current minPitch');
263
320
  }
264
- }, {
265
- key: "getRenderWorldCopies",
266
- value: function getRenderWorldCopies() {
267
- return this.transform.renderWorldCopies;
321
+ }
322
+ getMaxPitch() {
323
+ return this.transform.maxPitch;
324
+ }
325
+ getRenderWorldCopies() {
326
+ return this.transform.renderWorldCopies;
327
+ }
328
+ setRenderWorldCopies(renderWorldCopies) {
329
+ this.transform.renderWorldCopies = !!renderWorldCopies;
330
+ }
331
+ remove() {
332
+ if (this.frame) {
333
+ this.frame.cancel();
334
+ this.frame = null;
268
335
  }
269
- }, {
270
- key: "setRenderWorldCopies",
271
- value: function setRenderWorldCopies(renderWorldCopies) {
272
- this.transform.renderWorldCopies = !!renderWorldCopies;
336
+ this.renderTaskQueue.clear();
337
+ //销毁事件
338
+ this.handlers.destroy();
339
+ if (typeof window !== 'undefined') {
340
+ window.removeEventListener('online', this.onWindowOnline, false);
341
+ window.removeEventListener('resize', this.onWindowResize, false);
342
+ window.removeEventListener('orientationchange', this.onWindowResize, false);
273
343
  }
274
- }, {
275
- key: "remove",
276
- value: function remove() {
277
- if (this.frame) {
278
- this.frame.cancel();
344
+ }
345
+ requestRenderFrame(cb) {
346
+ this.update();
347
+ return this.renderTaskQueue.add(cb);
348
+ }
349
+ cancelRenderFrame(id) {
350
+ return this.renderTaskQueue.remove(id);
351
+ }
352
+ triggerRepaint() {
353
+ if (!this.frame) {
354
+ this.frame = renderframe(paintStartTimeStamp => {
355
+ PerformanceUtils.frame(paintStartTimeStamp);
279
356
  this.frame = null;
280
- }
281
- this.renderTaskQueue.clear();
282
- //销毁事件
283
- this.handlers.destroy();
284
- if (typeof window !== 'undefined') {
285
- window.removeEventListener('online', this.onWindowOnline, false);
286
- window.removeEventListener('resize', this.onWindowResize, false);
287
- window.removeEventListener('orientationchange', this.onWindowResize, false);
288
- }
289
- }
290
- }, {
291
- key: "requestRenderFrame",
292
- value: function requestRenderFrame(cb) {
293
- this.update();
294
- return this.renderTaskQueue.add(cb);
357
+ this.update(paintStartTimeStamp);
358
+ });
295
359
  }
296
- }, {
297
- key: "cancelRenderFrame",
298
- value: function cancelRenderFrame(id) {
299
- return this.renderTaskQueue.remove(id);
360
+ }
361
+ update(time) {
362
+ if (!this.frame) {
363
+ this.frame = renderframe(paintStartTimeStamp => {
364
+ PerformanceUtils.frame(paintStartTimeStamp);
365
+ this.frame = null;
366
+ this.renderTaskQueue.run(time);
367
+ });
300
368
  }
301
- }, {
302
- key: "triggerRepaint",
303
- value: function triggerRepaint() {
304
- var _this2 = this;
305
- if (!this.frame) {
306
- this.frame = renderframe(function (paintStartTimeStamp) {
307
- PerformanceUtils.frame(paintStartTimeStamp);
308
- _this2.frame = null;
309
- _this2.update(paintStartTimeStamp);
310
- });
369
+ }
370
+ initContainer() {
371
+ if (typeof this.options.container === 'string') {
372
+ this.container = window.document.getElementById(this.options.container);
373
+ if (!this.container) {
374
+ throw new Error(`Container '${this.options.container}' not found.`);
311
375
  }
376
+ } else if (this.options.container instanceof HTMLElement) {
377
+ this.container = this.options.container;
378
+ } else {
379
+ throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
312
380
  }
313
- }, {
314
- key: "update",
315
- value: function update(time) {
316
- var _this3 = this;
317
- if (!this.frame) {
318
- this.frame = renderframe(function (paintStartTimeStamp) {
319
- PerformanceUtils.frame(paintStartTimeStamp);
320
- _this3.frame = null;
321
- _this3.renderTaskQueue.run(time);
322
- });
323
- }
381
+ const container = this.container;
382
+ container.classList.add('l7-map');
383
+ const canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
384
+ if (this.options.interactive) {
385
+ canvasContainer.classList.add('l7-interactive');
324
386
  }
325
- }, {
326
- key: "initContainer",
327
- value: function initContainer() {
328
- if (typeof this.options.container === 'string') {
329
- this.container = window.document.getElementById(this.options.container);
330
- if (!this.container) {
331
- throw new Error("Container '".concat(this.options.container, "' not found."));
332
- }
333
- } else if (this.options.container instanceof HTMLElement) {
334
- this.container = this.options.container;
335
- } else {
336
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
337
- }
338
- var container = this.container;
339
- container.classList.add('l7-map');
340
- var canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
341
- if (this.options.interactive) {
342
- canvasContainer.classList.add('l7-interactive');
343
- }
344
387
 
345
- // this.canvas = DOM.create(
346
- // 'canvas',
347
- // 'l7-canvas',
348
- // canvasContainer,
349
- // ) as HTMLCanvasElement;
350
- // this.canvas.setAttribute('tabindex', '-');
351
- // this.canvas.setAttribute('aria-label', 'Map');
352
- }
353
- }, {
354
- key: "containerDimensions",
355
- value: function containerDimensions() {
356
- var width = 0;
357
- var height = 0;
358
- if (this.container) {
359
- width = this.container.clientWidth || 400;
360
- height = this.container.clientHeight || 300;
361
- }
362
- return [width, height];
388
+ // this.canvas = DOM.create(
389
+ // 'canvas',
390
+ // 'l7-canvas',
391
+ // canvasContainer,
392
+ // ) as HTMLCanvasElement;
393
+ // this.canvas.setAttribute('tabindex', '-');
394
+ // this.canvas.setAttribute('aria-label', 'Map');
395
+ }
396
+ containerDimensions() {
397
+ let width = 0;
398
+ let height = 0;
399
+ if (this.container) {
400
+ width = this.container.clientWidth || 400;
401
+ height = this.container.clientHeight || 300;
363
402
  }
364
- }, {
365
- key: "resizeCanvas",
366
- value: function resizeCanvas(width, height) {
367
- var pixelRatio = DOM.DPR || 1;
368
- this.canvas.width = pixelRatio * width;
369
- this.canvas.height = pixelRatio * height;
403
+ return [width, height];
404
+ }
405
+ resizeCanvas(width, height) {
406
+ const pixelRatio = DOM.DPR || 1;
407
+ this.canvas.width = pixelRatio * width;
408
+ this.canvas.height = pixelRatio * height;
370
409
 
371
- // Maintain the same canvas size, potentially downscaling it for HiDPI displays
372
- this.canvas.style.width = "".concat(width, "px");
373
- this.canvas.style.height = "".concat(height, "px");
374
- }
375
- }]);
376
- return EarthMap;
377
- }(Camera);
410
+ // Maintain the same canvas size, potentially downscaling it for HiDPI displays
411
+ this.canvas.style.width = `${width}px`;
412
+ this.canvas.style.height = `${height}px`;
413
+ }
414
+ }