@antv/l7-map 2.9.32-alpha.1 → 2.9.32-alpha.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 -84
  3. package/es/camera.js +0 -765
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -421
  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 -28
  14. package/es/geo/mercator.js +0 -91
  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 -28
  18. package/es/geo/simple.js +0 -90
  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 -129
  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 -134
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -3
  96. package/es/index.js +0 -3
  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 -463
  101. package/es/util.d.ts +0 -18
  102. package/es/util.js +0 -84
  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 -533
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -278
  116. package/lib/geo/edge_insets.js +0 -76
  117. package/lib/geo/lng_lat.js +0 -73
  118. package/lib/geo/lng_lat_bounds.js +0 -138
  119. package/lib/geo/mercator.js +0 -91
  120. package/lib/geo/point.js +0 -176
  121. package/lib/geo/simple.js +0 -87
  122. package/lib/geo/transform.js +0 -503
  123. package/lib/handler/IHandler.js +0 -17
  124. package/lib/handler/blockable_map_event.js +0 -71
  125. package/lib/handler/box_zoom.js +0 -139
  126. package/lib/handler/click_zoom.js +0 -59
  127. package/lib/handler/events/event.js +0 -38
  128. package/lib/handler/events/index.js +0 -38
  129. package/lib/handler/events/map_mouse_event.js +0 -44
  130. package/lib/handler/events/map_touch_event.js +0 -48
  131. package/lib/handler/events/map_wheel_event.js +0 -36
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -149
  134. package/lib/handler/handler_manager.js +0 -455
  135. package/lib/handler/handler_util.js +0 -35
  136. package/lib/handler/keyboard.js +0 -131
  137. package/lib/handler/map_event.js +0 -91
  138. package/lib/handler/mouse/index.js +0 -38
  139. package/lib/handler/mouse/mouse_handler.js +0 -103
  140. package/lib/handler/mouse/mousepan_handler.js +0 -48
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -47
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -47
  143. package/lib/handler/mouse/util.js +0 -44
  144. package/lib/handler/scroll_zoom.js +0 -225
  145. package/lib/handler/shim/dblclick_zoom.js +0 -46
  146. package/lib/handler/shim/drag_pan.js +0 -55
  147. package/lib/handler/shim/drag_rotate.js +0 -49
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -71
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -102
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -106
  151. package/lib/handler/tap/tap_recognizer.js +0 -66
  152. package/lib/handler/tap/tap_zoom.js +0 -99
  153. package/lib/handler/touch/index.js +0 -41
  154. package/lib/handler/touch/touch_pan.js +0 -110
  155. package/lib/handler/touch/touch_pitch.js +0 -86
  156. package/lib/handler/touch/touch_rotate.js +0 -65
  157. package/lib/handler/touch/touch_zoom.js +0 -56
  158. package/lib/handler/touch/two_touch.js +0 -105
  159. package/lib/hash.js +0 -120
  160. package/lib/index.js +0 -21
  161. package/lib/interface.js +0 -17
  162. package/lib/map.js +0 -308
  163. package/lib/util.js +0 -97
  164. package/lib/utils/Aabb.js +0 -90
  165. package/lib/utils/dom.js +0 -159
  166. package/lib/utils/performance.js +0 -80
  167. package/lib/utils/primitives.js +0 -63
  168. package/lib/utils/task_queue.js +0 -72
package/lib/map.js DELETED
@@ -1,308 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/map.ts
23
- var map_exports = {};
24
- __export(map_exports, {
25
- Map: () => Map
26
- });
27
- module.exports = __toCommonJS(map_exports);
28
- var import_l7_utils = require("@antv/l7-utils");
29
- var import_lodash = require("lodash");
30
- var import_camera = __toESM(require("./camera"));
31
- var import_l7 = require("./css/l7.css");
32
- var import_lng_lat = __toESM(require("./geo/lng_lat"));
33
- var import_lng_lat_bounds = __toESM(require("./geo/lng_lat_bounds"));
34
- var import_point = __toESM(require("./geo/point"));
35
- var import_handler_manager = __toESM(require("./handler/handler_manager"));
36
- var import_hash = __toESM(require("./hash"));
37
- var import_util = require("./util");
38
- var import_performance = require("./utils/performance");
39
- var import_task_queue = __toESM(require("./utils/task_queue"));
40
- var defaultMinZoom = -2;
41
- var defaultMaxZoom = 22;
42
- var defaultMinPitch = 0;
43
- var defaultMaxPitch = 60;
44
- var DefaultOptions = {
45
- hash: false,
46
- zoom: -1,
47
- center: [112, 32],
48
- pitch: 0,
49
- bearing: 0,
50
- interactive: true,
51
- minZoom: defaultMinZoom,
52
- maxZoom: defaultMaxZoom,
53
- minPitch: defaultMinPitch,
54
- maxPitch: defaultMaxPitch,
55
- scrollZoom: true,
56
- boxZoom: true,
57
- dragRotate: true,
58
- dragPan: true,
59
- keyboard: true,
60
- doubleClickZoom: true,
61
- touchZoomRotate: true,
62
- touchPitch: true,
63
- bearingSnap: 7,
64
- clickTolerance: 3,
65
- pitchWithRotate: true,
66
- trackResize: true,
67
- renderWorldCopies: true,
68
- pitchEnabled: true,
69
- rotateEnabled: true
70
- };
71
- var Map = class extends import_camera.default {
72
- constructor(options) {
73
- super((0, import_lodash.merge)({}, DefaultOptions, options));
74
- this.renderTaskQueue = new import_task_queue.default();
75
- this.trackResize = true;
76
- this.onWindowOnline = () => {
77
- this.update();
78
- };
79
- this.onWindowResize = (event) => {
80
- if (this.trackResize) {
81
- this.resize({ originalEvent: event }).update();
82
- }
83
- };
84
- if (import_l7_utils.isMini) {
85
- this.initMiniContainer();
86
- } else {
87
- this.initContainer();
88
- }
89
- this.resize();
90
- this.handlers = new import_handler_manager.default(this, this.options);
91
- if (typeof window !== "undefined") {
92
- window.addEventListener("online", this.onWindowOnline, false);
93
- window.addEventListener("resize", this.onWindowResize, false);
94
- window.addEventListener("orientationchange", this.onWindowResize, false);
95
- }
96
- if (!import_l7_utils.isMini) {
97
- const hashName = typeof options.hash === "string" && options.hash || void 0;
98
- if (options.hash) {
99
- this.hash = new import_hash.default(hashName).addTo(this);
100
- }
101
- }
102
- if (!this.hash || !this.hash.onHashChange()) {
103
- this.jumpTo({
104
- center: options.center,
105
- zoom: options.zoom,
106
- bearing: options.bearing,
107
- pitch: options.pitch
108
- });
109
- if (options.bounds) {
110
- this.resize();
111
- this.fitBounds(options.bounds, (0, import_lodash.merge)({}, options.fitBoundsOptions, { duration: 0 }));
112
- }
113
- }
114
- }
115
- resize(eventData) {
116
- const [width, height] = this.containerDimensions();
117
- this.transform.resize(width, height);
118
- if (import_l7_utils.isMini) {
119
- return this;
120
- }
121
- const fireMoving = !this.moving;
122
- if (fireMoving) {
123
- this.stop();
124
- this.emit("movestart", new import_l7_utils.$window.Event("movestart", eventData));
125
- this.emit("move", new import_l7_utils.$window.Event("move", eventData));
126
- }
127
- this.emit("resize", new import_l7_utils.$window.Event("resize", eventData));
128
- if (fireMoving) {
129
- this.emit("moveend", new import_l7_utils.$window.Event("moveend", eventData));
130
- }
131
- return this;
132
- }
133
- getContainer() {
134
- return this.container;
135
- }
136
- getCanvas() {
137
- return this.canvas;
138
- }
139
- getCanvasContainer() {
140
- return this.canvasContainer;
141
- }
142
- project(lngLat) {
143
- return this.transform.locationPoint(import_lng_lat.default.convert(lngLat));
144
- }
145
- unproject(point) {
146
- return this.transform.pointLocation(import_point.default.convert(point));
147
- }
148
- getBounds() {
149
- return this.transform.getBounds();
150
- }
151
- getMaxBounds() {
152
- return this.transform.getMaxBounds();
153
- }
154
- setMaxBounds(bounds) {
155
- this.transform.setMaxBounds(import_lng_lat_bounds.default.convert(bounds));
156
- }
157
- setStyle(style) {
158
- return;
159
- }
160
- setMinZoom(minZoom) {
161
- minZoom = minZoom === null || minZoom === void 0 ? defaultMinZoom : minZoom;
162
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
163
- this.transform.minZoom = minZoom;
164
- if (this.getZoom() < minZoom) {
165
- this.setZoom(minZoom);
166
- }
167
- return this;
168
- } else {
169
- throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);
170
- }
171
- }
172
- getMinZoom() {
173
- return this.transform.minZoom;
174
- }
175
- setMaxZoom(maxZoom) {
176
- maxZoom = maxZoom === null || maxZoom === void 0 ? defaultMaxZoom : maxZoom;
177
- if (maxZoom >= this.transform.minZoom) {
178
- this.transform.maxZoom = maxZoom;
179
- if (this.getZoom() > maxZoom) {
180
- this.setZoom(maxZoom);
181
- }
182
- return this;
183
- } else {
184
- throw new Error("maxZoom must be greater than the current minZoom");
185
- }
186
- }
187
- getMaxZoom() {
188
- return this.transform.maxZoom;
189
- }
190
- setMinPitch(minPitch) {
191
- minPitch = minPitch === null || minPitch === void 0 ? defaultMinPitch : minPitch;
192
- if (minPitch < defaultMinPitch) {
193
- throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);
194
- }
195
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
196
- this.transform.minPitch = minPitch;
197
- if (this.getPitch() < minPitch) {
198
- this.setPitch(minPitch);
199
- }
200
- return this;
201
- } else {
202
- throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);
203
- }
204
- }
205
- getMinPitch() {
206
- return this.transform.minPitch;
207
- }
208
- setMaxPitch(maxPitch) {
209
- maxPitch = maxPitch === null || maxPitch === void 0 ? defaultMaxPitch : maxPitch;
210
- if (maxPitch > defaultMaxPitch) {
211
- throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
212
- }
213
- if (maxPitch >= this.transform.minPitch) {
214
- this.transform.maxPitch = maxPitch;
215
- if (this.getPitch() > maxPitch) {
216
- this.setPitch(maxPitch);
217
- }
218
- return this;
219
- } else {
220
- throw new Error("maxPitch must be greater than the current minPitch");
221
- }
222
- }
223
- getMaxPitch() {
224
- return this.transform.maxPitch;
225
- }
226
- getRenderWorldCopies() {
227
- return this.transform.renderWorldCopies;
228
- }
229
- setRenderWorldCopies(renderWorldCopies) {
230
- this.transform.renderWorldCopies = !!renderWorldCopies;
231
- }
232
- remove() {
233
- this.container.removeChild(this.canvasContainer);
234
- this.canvasContainer = null;
235
- if (this.frame) {
236
- this.frame.cancel();
237
- this.frame = null;
238
- }
239
- this.renderTaskQueue.clear();
240
- }
241
- requestRenderFrame(cb) {
242
- this.update();
243
- return this.renderTaskQueue.add(cb);
244
- }
245
- cancelRenderFrame(id) {
246
- return this.renderTaskQueue.remove(id);
247
- }
248
- triggerRepaint() {
249
- if (!this.frame) {
250
- this.frame = (0, import_util.renderframe)((paintStartTimeStamp) => {
251
- import_performance.PerformanceUtils.frame(paintStartTimeStamp);
252
- this.frame = null;
253
- this.update(paintStartTimeStamp);
254
- });
255
- }
256
- }
257
- update(time) {
258
- if (!this.frame) {
259
- this.frame = (0, import_util.renderframe)((paintStartTimeStamp) => {
260
- import_performance.PerformanceUtils.frame(paintStartTimeStamp);
261
- this.frame = null;
262
- this.renderTaskQueue.run(time);
263
- });
264
- }
265
- }
266
- initContainer() {
267
- if (typeof this.options.container === "string") {
268
- this.container = window.document.getElementById(this.options.container);
269
- if (!this.container) {
270
- throw new Error(`Container '${this.options.container}' not found.`);
271
- }
272
- } else if (this.options.container instanceof HTMLElement) {
273
- this.container = this.options.container;
274
- } else {
275
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
276
- }
277
- const container = this.container;
278
- container.classList.add("l7-map");
279
- const canvasContainer = this.canvasContainer = import_l7_utils.DOM.create("div", "l7-canvas-container", container);
280
- if (this.options.interactive) {
281
- canvasContainer.classList.add("l7-interactive");
282
- }
283
- }
284
- initMiniContainer() {
285
- this.container = this.options.canvas;
286
- this.canvasContainer = this.container;
287
- }
288
- containerDimensions() {
289
- let width = 0;
290
- let height = 0;
291
- if (this.container) {
292
- if (import_l7_utils.isMini) {
293
- width = this.container.width / import_l7_utils.$window.devicePixelRatio;
294
- height = this.container.height / import_l7_utils.$window.devicePixelRatio;
295
- } else {
296
- width = this.container.clientWidth;
297
- height = this.container.clientHeight;
298
- width = width == 0 ? 400 : width;
299
- height = height === 0 ? 300 : height;
300
- }
301
- }
302
- return [width, height];
303
- }
304
- };
305
- // Annotate the CommonJS export names for ESM import in node:
306
- 0 && (module.exports = {
307
- Map
308
- });
package/lib/util.js DELETED
@@ -1,97 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/util.ts
23
- var util_exports = {};
24
- __export(util_exports, {
25
- bezier: () => bezier,
26
- cancel: () => cancel,
27
- clamp: () => clamp,
28
- ease: () => ease,
29
- interpolate: () => interpolate,
30
- now: () => now,
31
- pick: () => pick,
32
- prefersReducedMotion: () => prefersReducedMotion,
33
- raf: () => raf,
34
- renderframe: () => renderframe,
35
- wrap: () => wrap
36
- });
37
- module.exports = __toCommonJS(util_exports);
38
- var import_l7_utils = require("@antv/l7-utils");
39
- var import_unitbezier = __toESM(require("@mapbox/unitbezier"));
40
- var reducedMotionQuery;
41
- function wrap(n, min, max) {
42
- const d = max - min;
43
- const w = ((n - min) % d + d) % d + min;
44
- return w === min ? max : w;
45
- }
46
- function clamp(n, min, max) {
47
- return Math.min(max, Math.max(min, n));
48
- }
49
- function interpolate(a, b, t) {
50
- return a * (1 - t) + b * t;
51
- }
52
- function bezier(p1x, p1y, p2x, p2y) {
53
- const bez = new import_unitbezier.default(p1x, p1y, p2x, p2y);
54
- return (t) => {
55
- return bez.solve(t);
56
- };
57
- }
58
- var ease = bezier(0.25, 0.1, 0.25, 1);
59
- function prefersReducedMotion() {
60
- if (import_l7_utils.isMini || !import_l7_utils.$window.matchMedia) {
61
- return false;
62
- }
63
- if (reducedMotionQuery == null) {
64
- reducedMotionQuery = import_l7_utils.$window.matchMedia("(prefers-reduced-motion: reduce)");
65
- }
66
- return reducedMotionQuery.matches;
67
- }
68
- function pick(src, properties) {
69
- const result = {};
70
- for (const name of properties) {
71
- if (name in src) {
72
- result[name] = src[name];
73
- }
74
- }
75
- return result;
76
- }
77
- var now = import_l7_utils.isMini ? Date.now.bind(Date) : import_l7_utils.$window.performance && import_l7_utils.$window.performance.now ? import_l7_utils.$window.performance.now.bind(import_l7_utils.$window.performance) : Date.now.bind(Date);
78
- var raf = import_l7_utils.$window.requestAnimationFrame || import_l7_utils.$window.mozRequestAnimationFrame || import_l7_utils.$window.webkitRequestAnimationFrame || import_l7_utils.$window.msRequestAnimationFrame;
79
- var cancel = import_l7_utils.$window.cancelAnimationFrame || import_l7_utils.$window.mozCancelAnimationFrame || import_l7_utils.$window.webkitCancelAnimationFrame || import_l7_utils.$window.msCancelAnimationFrame;
80
- function renderframe(fn) {
81
- const frame = raf(fn);
82
- return { cancel: () => cancel(frame) };
83
- }
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- bezier,
87
- cancel,
88
- clamp,
89
- ease,
90
- interpolate,
91
- now,
92
- pick,
93
- prefersReducedMotion,
94
- raf,
95
- renderframe,
96
- wrap
97
- });
package/lib/utils/Aabb.js DELETED
@@ -1,90 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/utils/Aabb.ts
20
- var Aabb_exports = {};
21
- __export(Aabb_exports, {
22
- default: () => Aabb
23
- });
24
- module.exports = __toCommonJS(Aabb_exports);
25
- var import_gl_matrix = require("gl-matrix");
26
- var Aabb = class {
27
- constructor(min, max) {
28
- this.min = min;
29
- this.max = max;
30
- this.center = import_gl_matrix.vec3.scale(new Float32Array(3), import_gl_matrix.vec3.add(new Float32Array(3), this.min, this.max), 0.5);
31
- }
32
- quadrant(index) {
33
- const split = [index % 2 === 0, index < 2];
34
- const qMin = import_gl_matrix.vec3.clone(this.min);
35
- const qMax = import_gl_matrix.vec3.clone(this.max);
36
- for (let axis = 0; axis < split.length; axis++) {
37
- qMin[axis] = split[axis] ? this.min[axis] : this.center[axis];
38
- qMax[axis] = split[axis] ? this.center[axis] : this.max[axis];
39
- }
40
- qMax[2] = this.max[2];
41
- return new Aabb(qMin, qMax);
42
- }
43
- distanceX(point) {
44
- const pointOnAabb = Math.max(Math.min(this.max[0], point[0]), this.min[0]);
45
- return pointOnAabb - point[0];
46
- }
47
- distanceY(point) {
48
- const pointOnAabb = Math.max(Math.min(this.max[1], point[1]), this.min[1]);
49
- return pointOnAabb - point[1];
50
- }
51
- intersects(frustum) {
52
- const aabbPoints = [
53
- [this.min[0], this.min[1], 0, 1],
54
- [this.max[0], this.min[1], 0, 1],
55
- [this.max[0], this.max[1], 0, 1],
56
- [this.min[0], this.max[1], 0, 1]
57
- ];
58
- let fullyInside = true;
59
- for (const plane of frustum.planes) {
60
- let pointsInside = 0;
61
- for (const i of aabbPoints) {
62
- pointsInside += import_gl_matrix.vec4.dot(plane, i) >= 0;
63
- }
64
- if (pointsInside === 0) {
65
- return 0;
66
- }
67
- if (pointsInside !== aabbPoints.length) {
68
- fullyInside = false;
69
- }
70
- }
71
- if (fullyInside) {
72
- return 2;
73
- }
74
- for (let axis = 0; axis < 3; axis++) {
75
- let projMin = Number.MAX_VALUE;
76
- let projMax = -Number.MAX_VALUE;
77
- for (const p of frustum.points) {
78
- const projectedPoint = p[axis] - this.min[axis];
79
- projMin = Math.min(projMin, projectedPoint);
80
- projMax = Math.max(projMax, projectedPoint);
81
- }
82
- if (projMax < 0 || projMin > this.max[axis] - this.min[axis]) {
83
- return 0;
84
- }
85
- }
86
- return 1;
87
- }
88
- };
89
- // Annotate the CommonJS export names for ESM import in node:
90
- 0 && (module.exports = {});
package/lib/utils/dom.js DELETED
@@ -1,159 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
-
22
- // src/utils/dom.ts
23
- var dom_exports = {};
24
- __export(dom_exports, {
25
- default: () => dom_default
26
- });
27
- module.exports = __toCommonJS(dom_exports);
28
- var import_l7_utils = require("@antv/l7-utils");
29
- var import_point = __toESM(require("../geo/point"));
30
- var DOM = {};
31
- var dom_default = DOM;
32
- DOM.create = (tagName, className, container) => {
33
- const el = import_l7_utils.$window.document.createElement(tagName);
34
- if (className !== void 0) {
35
- el.className = className;
36
- }
37
- if (container) {
38
- container.appendChild(el);
39
- }
40
- return el;
41
- };
42
- DOM.createNS = (namespaceURI, tagName) => {
43
- const el = import_l7_utils.$window.document.createElementNS(namespaceURI, tagName);
44
- return el;
45
- };
46
- var docStyle = import_l7_utils.$window.document && import_l7_utils.$window.document.documentElement.style;
47
- function testProp(props) {
48
- if (!docStyle) {
49
- return props[0];
50
- }
51
- for (const i of props) {
52
- if (i in docStyle) {
53
- return i;
54
- }
55
- }
56
- return props[0];
57
- }
58
- var selectProp = testProp([
59
- "userSelect",
60
- "MozUserSelect",
61
- "WebkitUserSelect",
62
- "msUserSelect"
63
- ]);
64
- var userSelect;
65
- DOM.disableDrag = () => {
66
- if (docStyle && selectProp) {
67
- userSelect = docStyle[selectProp];
68
- docStyle[selectProp] = "none";
69
- }
70
- };
71
- DOM.enableDrag = () => {
72
- if (docStyle && selectProp) {
73
- docStyle[selectProp] = userSelect;
74
- }
75
- };
76
- var transformProp = testProp(["transform", "WebkitTransform"]);
77
- DOM.setTransform = (el, value) => {
78
- el.style[transformProp] = value;
79
- };
80
- var passiveSupported = false;
81
- try {
82
- const options = Object.defineProperty({}, "passive", {
83
- get() {
84
- passiveSupported = true;
85
- }
86
- });
87
- import_l7_utils.$window.addEventListener("test", options, options);
88
- import_l7_utils.$window.removeEventListener("test", options, options);
89
- } catch (err) {
90
- passiveSupported = false;
91
- }
92
- DOM.addEventListener = (target, type, callback, options = {}) => {
93
- if ("passive" in options && passiveSupported) {
94
- target.addEventListener(type, callback, options);
95
- } else {
96
- target.addEventListener(type, callback, options.capture);
97
- }
98
- };
99
- DOM.removeEventListener = (target, type, callback, options = {}) => {
100
- if ("passive" in options && passiveSupported) {
101
- target.removeEventListener(type, callback, options);
102
- } else {
103
- target.removeEventListener(type, callback, options.capture);
104
- }
105
- };
106
- var suppressClick = (e) => {
107
- e.preventDefault();
108
- e.stopPropagation();
109
- import_l7_utils.$window.removeEventListener("click", suppressClick, true);
110
- };
111
- DOM.suppressClick = () => {
112
- if (import_l7_utils.isMini) {
113
- return;
114
- }
115
- import_l7_utils.$window.addEventListener("click", suppressClick, true);
116
- setTimeout(() => {
117
- import_l7_utils.$window.removeEventListener("click", suppressClick, true);
118
- }, 0);
119
- };
120
- DOM.mousePos = (el, e) => {
121
- if (!import_l7_utils.isMini) {
122
- const rect = el.getBoundingClientRect();
123
- return new import_point.default(e.clientX - rect.left - el.clientLeft, e.clientY - rect.top - el.clientTop);
124
- } else {
125
- return new import_point.default(e.clientX - el.left - 0, e.clientY - el.top - 0);
126
- }
127
- };
128
- DOM.touchPos = (el, touches) => {
129
- if (!import_l7_utils.isMini) {
130
- const rect = el.getBoundingClientRect();
131
- const points = [];
132
- for (const touche of touches) {
133
- points.push(new import_point.default(touche.clientX - rect.left - el.clientLeft, touche.clientY - rect.top - el.clientTop));
134
- }
135
- return points;
136
- } else {
137
- const points = [];
138
- for (const touche of touches) {
139
- points.push(new import_point.default(touche.clientX - el.left, touche.clientY - el.top));
140
- }
141
- return points;
142
- }
143
- };
144
- DOM.mouseButton = (e) => {
145
- if (!import_l7_utils.isMini) {
146
- return e.button;
147
- }
148
- if (typeof import_l7_utils.$window.InstallTrigger !== "undefined" && e.button === 2 && e.ctrlKey && import_l7_utils.$window.navigator.platform.toUpperCase().indexOf("MAC") >= 0) {
149
- return 0;
150
- }
151
- return e.button;
152
- };
153
- DOM.remove = (node) => {
154
- if (node.parentNode) {
155
- node.parentNode.removeChild(node);
156
- }
157
- };
158
- // Annotate the CommonJS export names for ESM import in node:
159
- 0 && (module.exports = {});