@antv/l7-map 2.9.25 → 2.9.26-alpha.0

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
@@ -1,503 +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/geo/transform.ts
23
- var transform_exports = {};
24
- __export(transform_exports, {
25
- EXTENT: () => EXTENT,
26
- default: () => Transform
27
- });
28
- module.exports = __toCommonJS(transform_exports);
29
- var import_l7_utils = require("@antv/l7-utils");
30
- var import_gl_matrix = require("gl-matrix");
31
- var import_point = __toESM(require("../geo/point"));
32
- var import_util = require("../util");
33
- var import_edge_insets = __toESM(require("./edge_insets"));
34
- var import_lng_lat = __toESM(require("./lng_lat"));
35
- var import_lng_lat_bounds = __toESM(require("./lng_lat_bounds"));
36
- var import_mercator = __toESM(require("./mercator"));
37
- var EXTENT = 8192;
38
- var Transform = class {
39
- get minZoom() {
40
- return this._minZoom;
41
- }
42
- set minZoom(zoom) {
43
- if (this._minZoom === zoom) {
44
- return;
45
- }
46
- this._minZoom = zoom;
47
- this.zoom = Math.max(this.zoom, zoom);
48
- }
49
- get maxZoom() {
50
- return this._maxZoom;
51
- }
52
- set maxZoom(zoom) {
53
- if (this._maxZoom === zoom) {
54
- return;
55
- }
56
- this._maxZoom = zoom;
57
- this.zoom = Math.min(this.zoom, zoom);
58
- }
59
- get minPitch() {
60
- return this._minPitch;
61
- }
62
- set minPitch(pitch) {
63
- if (this._minPitch === pitch) {
64
- return;
65
- }
66
- this._minPitch = pitch;
67
- this._pitch = Math.max(this._pitch, pitch);
68
- }
69
- get maxPitch() {
70
- return this._maxPitch;
71
- }
72
- set maxPitch(pitch) {
73
- if (this._maxPitch === pitch) {
74
- return;
75
- }
76
- this._maxPitch = pitch;
77
- this._pitch = Math.min(this._pitch, pitch);
78
- }
79
- get renderWorldCopies() {
80
- return this._renderWorldCopies;
81
- }
82
- set renderWorldCopies(renderWorldCopies) {
83
- if (renderWorldCopies === void 0) {
84
- renderWorldCopies = true;
85
- } else if (renderWorldCopies === null) {
86
- renderWorldCopies = false;
87
- }
88
- this._renderWorldCopies = renderWorldCopies;
89
- }
90
- get worldSize() {
91
- return this.tileSize * this.scale;
92
- }
93
- get centerOffset() {
94
- return this.centerPoint._sub(this.size._div(2));
95
- }
96
- get size() {
97
- return new import_point.default(this.width, this.height);
98
- }
99
- get bearing() {
100
- return -this.angle / Math.PI * 180;
101
- }
102
- set bearing(bearing) {
103
- const b = -(0, import_util.wrap)(bearing, -180, 180) * Math.PI / 180;
104
- if (this.angle === b) {
105
- return;
106
- }
107
- this.unmodified = false;
108
- this.angle = b;
109
- this.calcMatrices();
110
- this.rotationMatrix = import_gl_matrix.mat2.create();
111
- import_gl_matrix.mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle);
112
- }
113
- get pitch() {
114
- return this._pitch / Math.PI * 180;
115
- }
116
- set pitch(pitch) {
117
- const p = (0, import_util.clamp)(pitch, this._minPitch, this._maxPitch) / 180 * Math.PI;
118
- if (this._pitch === p) {
119
- return;
120
- }
121
- this.unmodified = false;
122
- this._pitch = p;
123
- this.calcMatrices();
124
- }
125
- get fov() {
126
- return this._fov / Math.PI * 180;
127
- }
128
- set fov(fov) {
129
- fov = Math.max(0.01, Math.min(60, fov));
130
- if (this._fov === fov) {
131
- return;
132
- }
133
- this.unmodified = false;
134
- this._fov = fov / 180 * Math.PI;
135
- this.calcMatrices();
136
- }
137
- get zoom() {
138
- return this._zoom;
139
- }
140
- set zoom(zoom) {
141
- const z = Math.min(Math.max(zoom, this._minZoom), this._maxZoom);
142
- if (this._zoom === z) {
143
- return;
144
- }
145
- this.unmodified = false;
146
- this._zoom = z;
147
- this.scale = this.zoomScale(z);
148
- this.tileZoom = Math.floor(z);
149
- this.zoomFraction = z - this.tileZoom;
150
- this.constrain();
151
- this.calcMatrices();
152
- }
153
- get center() {
154
- return this._center;
155
- }
156
- set center(center) {
157
- if (center.lat === this._center.lat && center.lng === this._center.lng) {
158
- return;
159
- }
160
- this.unmodified = false;
161
- this._center = center;
162
- this.constrain();
163
- this.calcMatrices();
164
- }
165
- get padding() {
166
- return this.edgeInsets.toJSON();
167
- }
168
- set padding(padding) {
169
- if (this.edgeInsets.equals(padding)) {
170
- return;
171
- }
172
- this.unmodified = false;
173
- this.edgeInsets.interpolate(this.edgeInsets, padding, 1);
174
- this.calcMatrices();
175
- }
176
- get centerPoint() {
177
- return this.edgeInsets.getCenter(this.width, this.height);
178
- }
179
- get point() {
180
- return this.project(this.center);
181
- }
182
- constructor(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies) {
183
- this.tileSize = 512;
184
- this.maxValidLatitude = 85.051129;
185
- this._renderWorldCopies = renderWorldCopies === void 0 ? true : renderWorldCopies;
186
- this._minZoom = minZoom || 0;
187
- this._maxZoom = maxZoom || 22;
188
- this._minPitch = minPitch === void 0 || minPitch === null ? 0 : minPitch;
189
- this._maxPitch = maxPitch === void 0 || maxPitch === null ? 60 : maxPitch;
190
- this.setMaxBounds();
191
- this.width = 0;
192
- this.height = 0;
193
- this._center = new import_lng_lat.default(0, 0);
194
- this.zoom = 0;
195
- this.angle = 0;
196
- this._fov = 0.6435011087932844;
197
- this._pitch = 0;
198
- this.unmodified = true;
199
- this.edgeInsets = new import_edge_insets.default();
200
- this.posMatrixCache = {};
201
- this.alignedPosMatrixCache = {};
202
- }
203
- clone() {
204
- const clone = new Transform(this._minZoom, this._maxZoom, this._minPitch, this._maxPitch, this._renderWorldCopies);
205
- clone.tileSize = this.tileSize;
206
- clone.latRange = this.latRange;
207
- clone.width = this.width;
208
- clone.height = this.height;
209
- clone.center = this._center;
210
- clone.zoom = this.zoom;
211
- clone.angle = this.angle;
212
- clone.fov = this._fov;
213
- clone.pitch = this._pitch;
214
- clone.unmodified = this.unmodified;
215
- clone.edgeInsets = this.edgeInsets.clone();
216
- clone.calcMatrices();
217
- return clone;
218
- }
219
- isPaddingEqual(padding) {
220
- return this.edgeInsets.equals(padding);
221
- }
222
- interpolatePadding(start, target, t) {
223
- this.unmodified = false;
224
- this.edgeInsets.interpolate(start, target, t);
225
- this.constrain();
226
- this.calcMatrices();
227
- }
228
- coveringZoomLevel(options) {
229
- const z = (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize));
230
- return Math.max(0, z);
231
- }
232
- resize(width, height) {
233
- this.width = width;
234
- this.height = height;
235
- this.pixelsToGLUnits = [2 / width, -2 / height];
236
- this.constrain();
237
- this.calcMatrices();
238
- }
239
- zoomScale(zoom) {
240
- return Math.pow(2, zoom);
241
- }
242
- scaleZoom(scale) {
243
- return Math.log(scale) / Math.LN2;
244
- }
245
- project(lnglat) {
246
- const lat = (0, import_util.clamp)(lnglat.lat, -this.maxValidLatitude, this.maxValidLatitude);
247
- return new import_point.default((0, import_mercator.mercatorXfromLng)(lnglat.lng) * this.worldSize, (0, import_mercator.mercatorYfromLat)(lat) * this.worldSize);
248
- }
249
- unproject(point) {
250
- return new import_mercator.default(point.x / this.worldSize, point.y / this.worldSize).toLngLat();
251
- }
252
- setLocationAtPoint(lnglat, point) {
253
- const a = this.pointCoordinate(point);
254
- const b = this.pointCoordinate(this.centerPoint);
255
- const loc = this.locationCoordinate(lnglat);
256
- const newCenter = new import_mercator.default(loc.x - (a.x - b.x), loc.y - (a.y - b.y));
257
- this.center = this.coordinateLocation(newCenter);
258
- if (this._renderWorldCopies) {
259
- this.center = this.center.wrap();
260
- }
261
- }
262
- pointCoordinate(p) {
263
- const targetZ = 0;
264
- const coord0 = new Float64Array([p.x, p.y, 0, 1]);
265
- const coord1 = new Float64Array([p.x, p.y, 1, 1]);
266
- import_gl_matrix.vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse);
267
- import_gl_matrix.vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse);
268
- const w0 = coord0[3];
269
- const w1 = coord1[3];
270
- const x0 = coord0[0] / w0;
271
- const x1 = coord1[0] / w1;
272
- const y0 = coord0[1] / w0;
273
- const y1 = coord1[1] / w1;
274
- const z0 = coord0[2] / w0;
275
- const z1 = coord1[2] / w1;
276
- const t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);
277
- return new import_mercator.default((0, import_util.interpolate)(x0, x1, t) / this.worldSize, (0, import_util.interpolate)(y0, y1, t) / this.worldSize);
278
- }
279
- getBounds() {
280
- return new import_lng_lat_bounds.default().extend(this.pointLocation(new import_point.default(0, 0))).extend(this.pointLocation(new import_point.default(this.width, 0))).extend(this.pointLocation(new import_point.default(this.width, this.height))).extend(this.pointLocation(new import_point.default(0, this.height)));
281
- }
282
- getMaxBounds() {
283
- if (!this.latRange || this.latRange.length !== 2 || !this.lngRange || this.lngRange.length !== 2) {
284
- return null;
285
- }
286
- return new import_lng_lat_bounds.default([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]);
287
- }
288
- setMaxBounds(bounds) {
289
- if (bounds) {
290
- this.lngRange = [bounds.getWest(), bounds.getEast()];
291
- this.latRange = [bounds.getSouth(), bounds.getNorth()];
292
- this.constrain();
293
- } else {
294
- this.lngRange = void 0;
295
- this.latRange = [-this.maxValidLatitude, this.maxValidLatitude];
296
- }
297
- }
298
- customLayerMatrix() {
299
- return this.mercatorMatrix.slice();
300
- }
301
- maxPitchScaleFactor() {
302
- if (!this.pixelMatrixInverse) {
303
- return 1;
304
- }
305
- const coord = this.pointCoordinate(new import_point.default(0, 0));
306
- const p = new Float32Array([
307
- coord.x * this.worldSize,
308
- coord.y * this.worldSize,
309
- 0,
310
- 1
311
- ]);
312
- const topPoint = import_gl_matrix.vec4.transformMat4(p, p, this.pixelMatrix);
313
- return topPoint[3] / this.cameraToCenterDistance;
314
- }
315
- getCameraPoint() {
316
- const pitch = this._pitch;
317
- const yOffset = Math.tan(pitch) * (this.cameraToCenterDistance || 1);
318
- return this.centerPoint.add(new import_point.default(0, yOffset));
319
- }
320
- getCameraQueryGeometry(queryGeometry) {
321
- const c = this.getCameraPoint();
322
- if (queryGeometry.length === 1) {
323
- return [queryGeometry[0], c];
324
- } else {
325
- let minX = c.x;
326
- let minY = c.y;
327
- let maxX = c.x;
328
- let maxY = c.y;
329
- for (const p of queryGeometry) {
330
- minX = Math.min(minX, p.x);
331
- minY = Math.min(minY, p.y);
332
- maxX = Math.max(maxX, p.x);
333
- maxY = Math.max(maxY, p.y);
334
- }
335
- return [
336
- new import_point.default(minX, minY),
337
- new import_point.default(maxX, minY),
338
- new import_point.default(maxX, maxY),
339
- new import_point.default(minX, maxY),
340
- new import_point.default(minX, minY)
341
- ];
342
- }
343
- }
344
- coordinatePoint(coord) {
345
- const p = import_gl_matrix.vec4.fromValues(coord.x * this.worldSize, coord.y * this.worldSize, 0, 1);
346
- import_gl_matrix.vec4.transformMat4(p, p, this.pixelMatrix);
347
- return new import_point.default(p[0] / p[3], p[1] / p[3]);
348
- }
349
- locationPoint(lnglat) {
350
- return this.coordinatePoint(this.locationCoordinate(lnglat));
351
- }
352
- pointLocation(p) {
353
- return this.coordinateLocation(this.pointCoordinate(p));
354
- }
355
- locationCoordinate(lnglat) {
356
- return import_mercator.default.fromLngLat(lnglat);
357
- }
358
- coordinateLocation(coord) {
359
- return coord.toLngLat();
360
- }
361
- getProjectionMatrix() {
362
- return this.projMatrix;
363
- }
364
- constrain() {
365
- if (!this.center || !this.width || !this.height || this.constraining) {
366
- return;
367
- }
368
- this.constraining = true;
369
- let minY = -90;
370
- let maxY = 90;
371
- let minX = -180;
372
- let maxX = 180;
373
- let sy;
374
- let sx;
375
- let x2;
376
- let y2;
377
- const size = this.size;
378
- const unmodified = this.unmodified;
379
- if (this.latRange) {
380
- const latRange = this.latRange;
381
- minY = (0, import_mercator.mercatorYfromLat)(latRange[1]) * this.worldSize;
382
- maxY = (0, import_mercator.mercatorYfromLat)(latRange[0]) * this.worldSize;
383
- sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0;
384
- }
385
- if (this.lngRange) {
386
- const lngRange = this.lngRange;
387
- minX = (0, import_mercator.mercatorXfromLng)(lngRange[0]) * this.worldSize;
388
- maxX = (0, import_mercator.mercatorXfromLng)(lngRange[1]) * this.worldSize;
389
- sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;
390
- }
391
- const point = this.point;
392
- const s = Math.max(sx || 0, sy || 0);
393
- if (s) {
394
- this.center = this.unproject(new import_point.default(sx ? (maxX + minX) / 2 : point.x, sy ? (maxY + minY) / 2 : point.y));
395
- if (import_l7_utils.isMini) {
396
- this.zoom = Math.max(this.zoom, Math.max(-1, this.minZoom));
397
- } else {
398
- this.zoom += this.scaleZoom(s);
399
- }
400
- this.unmodified = unmodified;
401
- this.constraining = false;
402
- return;
403
- }
404
- if (this.latRange) {
405
- const y = point.y;
406
- const h2 = size.y / 2;
407
- if (y - h2 < minY) {
408
- y2 = minY + h2;
409
- }
410
- if (y + h2 > maxY) {
411
- y2 = maxY - h2;
412
- }
413
- }
414
- if (this.lngRange) {
415
- const x = point.x;
416
- const w2 = size.x / 2;
417
- if (x - w2 < minX) {
418
- x2 = minX + w2;
419
- }
420
- if (x + w2 > maxX) {
421
- x2 = maxX - w2;
422
- }
423
- }
424
- if (x2 !== void 0 || y2 !== void 0) {
425
- this.center = this.unproject(new import_point.default(x2 !== void 0 ? x2 : point.x, y2 !== void 0 ? y2 : point.y));
426
- }
427
- this.unmodified = unmodified;
428
- this.constraining = false;
429
- }
430
- calcMatrices() {
431
- if (!this.height) {
432
- return;
433
- }
434
- const halfFov = this._fov / 2;
435
- const offset = this.centerOffset;
436
- this.cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this.height;
437
- const groundAngle = Math.PI / 2 + this._pitch;
438
- const fovAboveCenter = this._fov * (0.5 + offset.y / this.height);
439
- const topHalfSurfaceDistance = Math.sin(fovAboveCenter) * this.cameraToCenterDistance / Math.sin((0, import_util.clamp)(Math.PI - groundAngle - fovAboveCenter, 0.01, Math.PI - 0.01));
440
- const point = this.point;
441
- const x = point.x;
442
- const y = point.y;
443
- const furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance;
444
- const farZ = furthestDistance * 1.01;
445
- const nearZ = this.height / 50;
446
- let m = new Float64Array(16);
447
- import_gl_matrix.mat4.perspective(m, this._fov, this.width / this.height, nearZ, farZ);
448
- m[8] = -offset.x * 2 / this.width;
449
- m[9] = offset.y * 2 / this.height;
450
- import_gl_matrix.mat4.scale(m, m, [1, -1, 1]);
451
- import_gl_matrix.mat4.translate(m, m, [0, 0, -this.cameraToCenterDistance]);
452
- import_gl_matrix.mat4.rotateX(m, m, this._pitch);
453
- import_gl_matrix.mat4.rotateZ(m, m, this.angle);
454
- import_gl_matrix.mat4.translate(m, m, [-x, -y, 0]);
455
- this.mercatorMatrix = import_gl_matrix.mat4.scale([], m, [
456
- this.worldSize,
457
- this.worldSize,
458
- this.worldSize
459
- ]);
460
- import_gl_matrix.mat4.scale(m, m, [
461
- 1,
462
- 1,
463
- (0, import_mercator.mercatorZfromAltitude)(1, this.center.lat) * this.worldSize,
464
- 1
465
- ]);
466
- this.projMatrix = m;
467
- this.invProjMatrix = import_gl_matrix.mat4.invert([], this.projMatrix);
468
- const xShift = this.width % 2 / 2;
469
- const yShift = this.height % 2 / 2;
470
- const angleCos = Math.cos(this.angle);
471
- const angleSin = Math.sin(this.angle);
472
- const dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift;
473
- const dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;
474
- const alignedM = new Float64Array(m);
475
- import_gl_matrix.mat4.translate(alignedM, alignedM, [
476
- dx > 0.5 ? dx - 1 : dx,
477
- dy > 0.5 ? dy - 1 : dy,
478
- 0
479
- ]);
480
- this.alignedProjMatrix = alignedM;
481
- m = import_gl_matrix.mat4.create();
482
- import_gl_matrix.mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]);
483
- import_gl_matrix.mat4.translate(m, m, [1, -1, 0]);
484
- this.labelPlaneMatrix = m;
485
- m = import_gl_matrix.mat4.create();
486
- import_gl_matrix.mat4.scale(m, m, [1, -1, 1]);
487
- import_gl_matrix.mat4.translate(m, m, [-1, -1, 0]);
488
- import_gl_matrix.mat4.scale(m, m, [2 / this.width, 2 / this.height, 1]);
489
- this.glCoordMatrix = m;
490
- this.pixelMatrix = import_gl_matrix.mat4.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix);
491
- m = import_gl_matrix.mat4.invert(new Float64Array(16), this.pixelMatrix);
492
- if (!m) {
493
- throw new Error("failed to invert matrix");
494
- }
495
- this.pixelMatrixInverse = m;
496
- this.posMatrixCache = {};
497
- this.alignedPosMatrixCache = {};
498
- }
499
- };
500
- // Annotate the CommonJS export names for ESM import in node:
501
- 0 && (module.exports = {
502
- EXTENT
503
- });
@@ -1,17 +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 __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
-
15
- // src/handler/IHandler.ts
16
- var IHandler_exports = {};
17
- module.exports = __toCommonJS(IHandler_exports);
@@ -1,71 +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/handler/blockable_map_event.ts
20
- var blockable_map_event_exports = {};
21
- __export(blockable_map_event_exports, {
22
- default: () => BlockableMapEventHandler
23
- });
24
- module.exports = __toCommonJS(blockable_map_event_exports);
25
- var import_events = require("./events");
26
- var BlockableMapEventHandler = class {
27
- constructor(map) {
28
- this.map = map;
29
- }
30
- reset() {
31
- this.delayContextMenu = false;
32
- delete this.contextMenuEvent;
33
- }
34
- mousemove(e) {
35
- this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
36
- }
37
- mousedown() {
38
- this.delayContextMenu = true;
39
- }
40
- mouseup() {
41
- this.delayContextMenu = false;
42
- if (this.contextMenuEvent) {
43
- this.map.emit("contextmenu", new import_events.MapMouseEvent("contextmenu", this.map, this.contextMenuEvent));
44
- delete this.contextMenuEvent;
45
- }
46
- }
47
- contextmenu(e) {
48
- if (this.delayContextMenu) {
49
- this.contextMenuEvent = e;
50
- } else {
51
- this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
52
- }
53
- if (this.map.listeners("contextmenu")) {
54
- e.preventDefault();
55
- }
56
- }
57
- isEnabled() {
58
- return true;
59
- }
60
- isActive() {
61
- return false;
62
- }
63
- enable() {
64
- return true;
65
- }
66
- disable() {
67
- return false;
68
- }
69
- };
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {});