@antv/l7-map 2.17.10 → 2.17.12

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 (103) hide show
  1. package/es/camera.js +148 -90
  2. package/es/earthmap.js +65 -13
  3. package/es/geo/edge_insets.js +14 -4
  4. package/es/geo/lng_lat.js +13 -5
  5. package/es/geo/lng_lat_bounds.js +17 -4
  6. package/es/geo/mercator.js +10 -2
  7. package/es/geo/point.js +7 -0
  8. package/es/geo/simple.js +11 -6
  9. package/es/geo/transform.js +132 -127
  10. package/es/handler/blockable_map_event.js +12 -7
  11. package/es/handler/box_zoom.js +30 -10
  12. package/es/handler/click_zoom.js +5 -0
  13. package/es/handler/events/event.js +2 -0
  14. package/es/handler/events/map_mouse_event.js +12 -0
  15. package/es/handler/events/map_touch_event.js +12 -2
  16. package/es/handler/events/map_wheel_event.js +12 -1
  17. package/es/handler/events/render_event.js +13 -0
  18. package/es/handler/handler_inertia.js +34 -6
  19. package/es/handler/handler_manager.js +147 -55
  20. package/es/handler/handler_util.js +2 -1
  21. package/es/handler/keyboard.js +20 -1
  22. package/es/handler/map_event.js +9 -3
  23. package/es/handler/mouse/mouse_handler.js +24 -11
  24. package/es/handler/mouse/mousepan_handler.js +11 -1
  25. package/es/handler/mouse/mousepitch_hander.js +11 -1
  26. package/es/handler/mouse/mouserotate_hander.js +11 -1
  27. package/es/handler/mouse/util.js +3 -2
  28. package/es/handler/scroll_zoom.js +71 -43
  29. package/es/handler/shim/dblclick_zoom.js +9 -4
  30. package/es/handler/shim/drag_pan.js +11 -4
  31. package/es/handler/shim/drag_rotate.js +10 -4
  32. package/es/handler/shim/touch_zoom_rotate.js +16 -6
  33. package/es/handler/tap/single_tap_recognizer.js +31 -8
  34. package/es/handler/tap/tap_drag_zoom.js +15 -7
  35. package/es/handler/tap/tap_recognizer.js +11 -3
  36. package/es/handler/tap/tap_zoom.js +7 -1
  37. package/es/handler/touch/touch_pan.js +22 -4
  38. package/es/handler/touch/touch_pitch.js +27 -10
  39. package/es/handler/touch/touch_rotate.js +19 -8
  40. package/es/handler/touch/touch_zoom.js +18 -5
  41. package/es/handler/touch/two_touch.js +32 -19
  42. package/es/hash.js +31 -9
  43. package/es/map.js +78 -16
  44. package/es/util.js +26 -18
  45. package/es/utils/Aabb.js +31 -10
  46. package/es/utils/dom.js +58 -24
  47. package/es/utils/performance.js +7 -8
  48. package/es/utils/primitives.js +11 -13
  49. package/es/utils/task_queue.js +23 -6
  50. package/lib/camera.js +169 -91
  51. package/lib/earthmap.js +80 -12
  52. package/lib/geo/edge_insets.js +18 -3
  53. package/lib/geo/lng_lat.js +18 -5
  54. package/lib/geo/lng_lat_bounds.js +20 -4
  55. package/lib/geo/mercator.js +22 -1
  56. package/lib/geo/point.js +8 -0
  57. package/lib/geo/simple.js +24 -5
  58. package/lib/geo/transform.js +164 -127
  59. package/lib/handler/blockable_map_event.js +14 -6
  60. package/lib/handler/box_zoom.js +39 -8
  61. package/lib/handler/click_zoom.js +6 -0
  62. package/lib/handler/events/event.js +5 -0
  63. package/lib/handler/events/index.js +4 -0
  64. package/lib/handler/events/map_mouse_event.js +20 -2
  65. package/lib/handler/events/map_touch_event.js +21 -2
  66. package/lib/handler/events/map_wheel_event.js +16 -1
  67. package/lib/handler/events/render_event.js +19 -0
  68. package/lib/handler/handler_inertia.js +37 -5
  69. package/lib/handler/handler_manager.js +171 -56
  70. package/lib/handler/handler_util.js +3 -1
  71. package/lib/handler/keyboard.js +22 -1
  72. package/lib/handler/map_event.js +11 -2
  73. package/lib/handler/mouse/index.js +4 -0
  74. package/lib/handler/mouse/mouse_handler.js +27 -10
  75. package/lib/handler/mouse/mousepan_handler.js +18 -1
  76. package/lib/handler/mouse/mousepitch_hander.js +17 -1
  77. package/lib/handler/mouse/mouserotate_hander.js +17 -1
  78. package/lib/handler/mouse/util.js +6 -2
  79. package/lib/handler/scroll_zoom.js +77 -43
  80. package/lib/handler/shim/dblclick_zoom.js +10 -4
  81. package/lib/handler/shim/drag_pan.js +13 -4
  82. package/lib/handler/shim/drag_rotate.js +11 -4
  83. package/lib/handler/shim/touch_zoom_rotate.js +18 -6
  84. package/lib/handler/tap/single_tap_recognizer.js +33 -8
  85. package/lib/handler/tap/tap_drag_zoom.js +18 -6
  86. package/lib/handler/tap/tap_recognizer.js +17 -2
  87. package/lib/handler/tap/tap_zoom.js +9 -0
  88. package/lib/handler/touch/index.js +5 -0
  89. package/lib/handler/touch/touch_pan.js +25 -4
  90. package/lib/handler/touch/touch_pitch.js +32 -10
  91. package/lib/handler/touch/touch_rotate.js +25 -8
  92. package/lib/handler/touch/touch_zoom.js +24 -5
  93. package/lib/handler/touch/two_touch.js +35 -18
  94. package/lib/hash.js +35 -8
  95. package/lib/index.js +8 -0
  96. package/lib/map.js +95 -15
  97. package/lib/util.js +38 -16
  98. package/lib/utils/Aabb.js +34 -10
  99. package/lib/utils/dom.js +64 -22
  100. package/lib/utils/performance.js +9 -8
  101. package/lib/utils/primitives.js +16 -13
  102. package/lib/utils/task_queue.js +24 -6
  103. package/package.json +3 -3
@@ -1,32 +1,52 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.default = exports.EXTENT = void 0;
11
+
9
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
10
14
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
11
16
  var _l7Utils = require("@antv/l7-utils");
17
+
12
18
  var _glMatrix = require("gl-matrix");
19
+
13
20
  var _point = _interopRequireDefault(require("../geo/point"));
21
+
14
22
  var _util = require("../util");
23
+
15
24
  var _edge_insets = _interopRequireDefault(require("./edge_insets"));
25
+
16
26
  var _lng_lat = _interopRequireDefault(require("./lng_lat"));
27
+
17
28
  var _lng_lat_bounds = _interopRequireDefault(require("./lng_lat_bounds"));
29
+
18
30
  var _mercator = _interopRequireWildcard(require("./mercator"));
31
+
19
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
20
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+
21
36
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
37
+
22
38
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } // @ts-ignore
39
+
40
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
+
24
42
  var EXTENT = 8192;
25
43
  exports.EXTENT = EXTENT;
44
+
26
45
  var Transform = /*#__PURE__*/function () {
27
46
  function Transform(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies) {
28
47
  (0, _classCallCheck2.default)(this, Transform);
29
48
  this.tileSize = 512; // constant
49
+
30
50
  this.maxValidLatitude = 85.051129; // constant
31
51
 
32
52
  this._renderWorldCopies = renderWorldCopies === undefined ? true : renderWorldCopies;
@@ -47,6 +67,7 @@ var Transform = /*#__PURE__*/function () {
47
67
  this.posMatrixCache = {};
48
68
  this.alignedPosMatrixCache = {};
49
69
  }
70
+
50
71
  (0, _createClass2.default)(Transform, [{
51
72
  key: "minZoom",
52
73
  get: function get() {
@@ -56,6 +77,7 @@ var Transform = /*#__PURE__*/function () {
56
77
  if (this._minZoom === zoom) {
57
78
  return;
58
79
  }
80
+
59
81
  this._minZoom = zoom;
60
82
  this.zoom = Math.max(this.zoom, zoom);
61
83
  }
@@ -68,6 +90,7 @@ var Transform = /*#__PURE__*/function () {
68
90
  if (this._maxZoom === zoom) {
69
91
  return;
70
92
  }
93
+
71
94
  this._maxZoom = zoom;
72
95
  this.zoom = Math.min(this.zoom, zoom);
73
96
  }
@@ -80,6 +103,7 @@ var Transform = /*#__PURE__*/function () {
80
103
  if (this._minPitch === pitch) {
81
104
  return;
82
105
  }
106
+
83
107
  this._minPitch = pitch;
84
108
  this._pitch = Math.max(this._pitch, pitch);
85
109
  }
@@ -92,6 +116,7 @@ var Transform = /*#__PURE__*/function () {
92
116
  if (this._maxPitch === pitch) {
93
117
  return;
94
118
  }
119
+
95
120
  this._maxPitch = pitch;
96
121
  this._pitch = Math.min(this._pitch, pitch);
97
122
  }
@@ -106,6 +131,7 @@ var Transform = /*#__PURE__*/function () {
106
131
  } else if (renderWorldCopies === null) {
107
132
  renderWorldCopies = false;
108
133
  }
134
+
109
135
  this._renderWorldCopies = renderWorldCopies;
110
136
  }
111
137
  }, {
@@ -130,15 +156,17 @@ var Transform = /*#__PURE__*/function () {
130
156
  },
131
157
  set: function set(bearing) {
132
158
  var b = -(0, _util.wrap)(bearing, -180, 180) * Math.PI / 180;
159
+
133
160
  if (this.angle === b) {
134
161
  return;
135
162
  }
163
+
136
164
  this.unmodified = false;
137
165
  this.angle = b;
138
- this.calcMatrices();
166
+ this.calcMatrices(); // 2x2 matrix for rotating points
139
167
 
140
- // 2x2 matrix for rotating points
141
168
  this.rotationMatrix = _glMatrix.mat2.create();
169
+
142
170
  _glMatrix.mat2.rotate(this.rotationMatrix, this.rotationMatrix, this.angle);
143
171
  }
144
172
  }, {
@@ -148,9 +176,11 @@ var Transform = /*#__PURE__*/function () {
148
176
  },
149
177
  set: function set(pitch) {
150
178
  var p = (0, _util.clamp)(pitch, this._minPitch, this._maxPitch) / 180 * Math.PI;
179
+
151
180
  if (this._pitch === p) {
152
181
  return;
153
182
  }
183
+
154
184
  this.unmodified = false;
155
185
  this._pitch = p;
156
186
  this.calcMatrices();
@@ -162,9 +192,11 @@ var Transform = /*#__PURE__*/function () {
162
192
  },
163
193
  set: function set(fov) {
164
194
  fov = Math.max(0.01, Math.min(60, fov));
195
+
165
196
  if (this._fov === fov) {
166
197
  return;
167
198
  }
199
+
168
200
  this.unmodified = false;
169
201
  this._fov = fov / 180 * Math.PI;
170
202
  this.calcMatrices();
@@ -176,9 +208,11 @@ var Transform = /*#__PURE__*/function () {
176
208
  },
177
209
  set: function set(zoom) {
178
210
  var z = Math.min(Math.max(zoom, this._minZoom), this._maxZoom);
211
+
179
212
  if (this._zoom === z) {
180
213
  return;
181
214
  }
215
+
182
216
  this.unmodified = false;
183
217
  this._zoom = z;
184
218
  this.scale = this.zoomScale(z);
@@ -196,6 +230,7 @@ var Transform = /*#__PURE__*/function () {
196
230
  if (center.lat === this._center.lat && center.lng === this._center.lng) {
197
231
  return;
198
232
  }
233
+
199
234
  this.unmodified = false;
200
235
  this._center = center;
201
236
  this.constrain();
@@ -210,12 +245,12 @@ var Transform = /*#__PURE__*/function () {
210
245
  if (this.edgeInsets.equals(padding)) {
211
246
  return;
212
247
  }
213
- this.unmodified = false;
214
- // Update edge-insets inplace
248
+
249
+ this.unmodified = false; // Update edge-insets inplace
250
+
215
251
  this.edgeInsets.interpolate(this.edgeInsets, padding, 1);
216
252
  this.calcMatrices();
217
253
  }
218
-
219
254
  /**
220
255
  * The center of the screen in pixels with the top-left corner being (0,0)
221
256
  * and +y axis pointing downwards. This accounts for padding.
@@ -224,6 +259,7 @@ var Transform = /*#__PURE__*/function () {
224
259
  * @type {Point}
225
260
  * @memberof Transform
226
261
  */
262
+
227
263
  }, {
228
264
  key: "centerPoint",
229
265
  get: function get() {
@@ -234,10 +270,6 @@ var Transform = /*#__PURE__*/function () {
234
270
  get: function get() {
235
271
  return this.project(this.center);
236
272
  }
237
-
238
- // tslint:disable:variable-name
239
-
240
- // tslint:enable
241
273
  }, {
242
274
  key: "clone",
243
275
  value: function clone() {
@@ -256,7 +288,6 @@ var Transform = /*#__PURE__*/function () {
256
288
  clone.calcMatrices();
257
289
  return clone;
258
290
  }
259
-
260
291
  /**
261
292
  * Returns if the padding params match
262
293
  *
@@ -264,12 +295,12 @@ var Transform = /*#__PURE__*/function () {
264
295
  * @returns {boolean}
265
296
  * @memberof Transform
266
297
  */
298
+
267
299
  }, {
268
300
  key: "isPaddingEqual",
269
301
  value: function isPaddingEqual(padding) {
270
302
  return this.edgeInsets.equals(padding);
271
303
  }
272
-
273
304
  /**
274
305
  * Helper method to upadte edge-insets inplace
275
306
  *
@@ -277,6 +308,7 @@ var Transform = /*#__PURE__*/function () {
277
308
  * @param {number} t
278
309
  * @memberof Transform
279
310
  */
311
+
280
312
  }, {
281
313
  key: "interpolatePadding",
282
314
  value: function interpolatePadding(start, target, t) {
@@ -285,7 +317,6 @@ var Transform = /*#__PURE__*/function () {
285
317
  this.constrain();
286
318
  this.calcMatrices();
287
319
  }
288
-
289
320
  /**
290
321
  * Return a zoom level that will cover all tiles the transform
291
322
  * @param {Object} options options
@@ -293,14 +324,14 @@ var Transform = /*#__PURE__*/function () {
293
324
  * @param {boolean} options.roundZoom Target zoom level. If true, the value will be rounded to the closest integer. Otherwise the value will be floored.
294
325
  * @returns {number} zoom level An integer zoom level at which all tiles will be visible.
295
326
  */
327
+
296
328
  }, {
297
329
  key: "coveringZoomLevel",
298
330
  value: function coveringZoomLevel(options) {
299
- var z = (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize));
300
- // At negative zoom levels load tiles from z0 because negative tile zoom levels don't exist.
331
+ var z = (options.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / options.tileSize)); // At negative zoom levels load tiles from z0 because negative tile zoom levels don't exist.
332
+
301
333
  return Math.max(0, z);
302
334
  }
303
-
304
335
  /**
305
336
  * Return any "wrapped" copies of a given tile coordinate that are visible
306
337
  * in the current view.
@@ -316,12 +347,10 @@ var Transform = /*#__PURE__*/function () {
316
347
  // const ubr = this.pointCoordinate(new Point(0, this.height));
317
348
  // const w0 = Math.floor(Math.min(utl.x, utr.x, ubl.x, ubr.x));
318
349
  // const w1 = Math.floor(Math.max(utl.x, utr.x, ubl.x, ubr.x));
319
-
320
350
  // // Add an extra copy of the world on each side to properly render ImageSources and CanvasSources.
321
351
  // // Both sources draw outside the tile boundaries of the tile that "contains them" so we need
322
352
  // // to add extra copies on both sides in case offscreen tiles need to draw into on-screen ones.
323
353
  // const extraWorldCopy = 1;
324
-
325
354
  // for (let w = w0 - extraWorldCopy; w <= w1 + extraWorldCopy; w++) {
326
355
  // if (w === 0) {
327
356
  // continue;
@@ -355,14 +384,12 @@ var Transform = /*#__PURE__*/function () {
355
384
  // }): OverscaledTileID[] {
356
385
  // let z = this.coveringZoomLevel(options);
357
386
  // const actualZ = z;
358
-
359
387
  // if (options.minzoom !== undefined && z < options.minzoom) {
360
388
  // return [];
361
389
  // }
362
390
  // if (options.maxzoom !== undefined && z > options.maxzoom) {
363
391
  // z = options.maxzoom;
364
392
  // }
365
-
366
393
  // const centerCoord = MercatorCoordinate.fromLngLat(this.center);
367
394
  // const numTiles = Math.pow(2, z);
368
395
  // const centerPoint = [numTiles * centerCoord.x, numTiles * centerCoord.y, 0];
@@ -371,17 +398,14 @@ var Transform = /*#__PURE__*/function () {
371
398
  // this.worldSize,
372
399
  // z,
373
400
  // );
374
-
375
401
  // // No change of LOD behavior for pitch lower than 60 and when there is no top padding: return only tile ids from the requested zoom level
376
402
  // let minZoom = options.minzoom || 0;
377
403
  // // Use 0.1 as an epsilon to avoid for explicit == 0.0 floating point checks
378
404
  // if (this._pitch <= 60.0 && this.edgeInsets.top < 0.1) {
379
405
  // minZoom = z;
380
406
  // }
381
-
382
407
  // // There should always be a certain number of maximum zoom level tiles surrounding the center location
383
408
  // const radiusOfMaxLvlLodInTiles = 3;
384
-
385
409
  // const newRootTile = (wrap: number): any => {
386
410
  // return {
387
411
  // // All tiles are on zero elevation plane => z difference is zero
@@ -396,13 +420,11 @@ var Transform = /*#__PURE__*/function () {
396
420
  // fullyVisible: false,
397
421
  // };
398
422
  // };
399
-
400
423
  // // Do a depth-first traversal to find visible tiles and proper levels of detail
401
424
  // const stack = [];
402
425
  // const result = [];
403
426
  // const maxZoom = z;
404
427
  // const overscaledZ = options.reparseOverscaled ? actualZ : z;
405
-
406
428
  // if (this._renderWorldCopies) {
407
429
  // // Render copy of the globe thrice on both sides
408
430
  // for (let i = 1; i <= 3; i++) {
@@ -410,30 +432,23 @@ var Transform = /*#__PURE__*/function () {
410
432
  // stack.push(newRootTile(i));
411
433
  // }
412
434
  // }
413
-
414
435
  // stack.push(newRootTile(0));
415
-
416
436
  // while (stack.length > 0) {
417
437
  // const it = stack.pop();
418
438
  // const x = it.x;
419
439
  // const y = it.y;
420
440
  // let fullyVisible = it.fullyVisible;
421
-
422
441
  // // Visibility of a tile is not required if any of its ancestor if fully inside the frustum
423
442
  // if (!fullyVisible) {
424
443
  // const intersectResult = it.aabb.intersects(cameraFrustum);
425
-
426
444
  // if (intersectResult === 0) {
427
445
  // continue;
428
446
  // }
429
-
430
447
  // fullyVisible = intersectResult === 2;
431
448
  // }
432
-
433
449
  // const distanceX = it.aabb.distanceX(centerPoint);
434
450
  // const distanceY = it.aabb.distanceY(centerPoint);
435
451
  // const longestDim = Math.max(Math.abs(distanceX), Math.abs(distanceY));
436
-
437
452
  // // We're using distance based heuristics to determine if a tile should be split into quadrants or not.
438
453
  // // radiusOfMaxLvlLodInTiles defines that there's always a certain number of maxLevel tiles next to the map center.
439
454
  // // Using the fact that a parent node in quadtree is twice the size of its children (per dimension)
@@ -441,7 +456,6 @@ var Transform = /*#__PURE__*/function () {
441
456
  // // f(k) = offset + 2 + 4 + 8 + 16 + ... + 2^k. This is the same as "offset+2^(k+1)-2"
442
457
  // const distToSplit =
443
458
  // radiusOfMaxLvlLodInTiles + (1 << (maxZoom - it.zoom)) - 2;
444
-
445
459
  // // Have we reached the target depth or is the tile too far away to be any split further?
446
460
  // if (
447
461
  // it.zoom === maxZoom ||
@@ -462,11 +476,9 @@ var Transform = /*#__PURE__*/function () {
462
476
  // });
463
477
  // continue;
464
478
  // }
465
-
466
479
  // for (let i = 0; i < 4; i++) {
467
480
  // const childX = (x << 1) + (i % 2);
468
481
  // const childY = (y << 1) + (i >> 1);
469
-
470
482
  // stack.push({
471
483
  // aabb: it.aabb.quadrant(i),
472
484
  // zoom: it.zoom + 1,
@@ -477,11 +489,11 @@ var Transform = /*#__PURE__*/function () {
477
489
  // });
478
490
  // }
479
491
  // }
480
-
481
492
  // return result
482
493
  // .sort((a, b) => a.distanceSq - b.distanceSq)
483
494
  // .map((a) => a.tileID);
484
495
  // }
496
+
485
497
  }, {
486
498
  key: "resize",
487
499
  value: function resize(width, height) {
@@ -520,6 +532,7 @@ var Transform = /*#__PURE__*/function () {
520
532
  var loc = this.locationCoordinate(lnglat);
521
533
  var newCenter = new _mercator.default(loc.x - (a.x - b.x), loc.y - (a.y - b.y));
522
534
  this.center = this.coordinateLocation(newCenter);
535
+
523
536
  if (this._renderWorldCopies) {
524
537
  this.center = this.center.wrap();
525
538
  }
@@ -527,18 +540,18 @@ var Transform = /*#__PURE__*/function () {
527
540
  }, {
528
541
  key: "pointCoordinate",
529
542
  value: function pointCoordinate(p) {
530
- var targetZ = 0;
531
- // since we don't know the correct projected z value for the point,
543
+ var targetZ = 0; // since we don't know the correct projected z value for the point,
532
544
  // unproject two points to get a line and then find the point on that
533
545
  // line with z=0
534
546
 
535
547
  var coord0 = new Float64Array([p.x, p.y, 0, 1]);
536
- var coord1 = new Float64Array([p.x, p.y, 1, 1]);
548
+ var coord1 = new Float64Array([p.x, p.y, 1, 1]); // @ts-ignore
549
+
550
+ _glMatrix.vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse); // @ts-ignore
551
+
537
552
 
538
- // @ts-ignore
539
- _glMatrix.vec4.transformMat4(coord0, coord0, this.pixelMatrixInverse);
540
- // @ts-ignore
541
553
  _glMatrix.vec4.transformMat4(coord1, coord1, this.pixelMatrixInverse);
554
+
542
555
  var w0 = coord0[3];
543
556
  var w1 = coord1[3];
544
557
  var x0 = coord0[0] / w0;
@@ -550,35 +563,36 @@ var Transform = /*#__PURE__*/function () {
550
563
  var t = z0 === z1 ? 0 : (targetZ - z0) / (z1 - z0);
551
564
  return new _mercator.default((0, _util.interpolate)(x0, x1, t) / this.worldSize, (0, _util.interpolate)(y0, y1, t) / this.worldSize);
552
565
  }
553
-
554
566
  /**
555
567
  * Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not
556
568
  * an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region.
557
569
  * @returns {LngLatBounds} Returns a {@link LngLatBounds} object describing the map's geographical bounds.
558
570
  */
571
+
559
572
  }, {
560
573
  key: "getBounds",
561
574
  value: function getBounds() {
562
575
  return new _lng_lat_bounds.default().extend(this.pointLocation(new _point.default(0, 0))).extend(this.pointLocation(new _point.default(this.width, 0))).extend(this.pointLocation(new _point.default(this.width, this.height))).extend(this.pointLocation(new _point.default(0, this.height)));
563
576
  }
564
-
565
577
  /**
566
578
  * Returns the maximum geographical bounds the map is constrained to, or `null` if none set.
567
579
  * @returns {LngLatBounds} {@link LngLatBounds}
568
580
  */
581
+
569
582
  }, {
570
583
  key: "getMaxBounds",
571
584
  value: function getMaxBounds() {
572
585
  if (!this.latRange || this.latRange.length !== 2 || !this.lngRange || this.lngRange.length !== 2) {
573
586
  return null;
574
587
  }
588
+
575
589
  return new _lng_lat_bounds.default([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]);
576
590
  }
577
-
578
591
  /**
579
592
  * Sets or clears the map's geographical constraints.
580
593
  * @param {LngLatBounds} bounds A {@link LngLatBounds} object describing the new geographic boundaries of the map.
581
594
  */
595
+
582
596
  }, {
583
597
  key: "setMaxBounds",
584
598
  value: function setMaxBounds(bounds) {
@@ -603,12 +617,14 @@ var Transform = /*#__PURE__*/function () {
603
617
  if (!this.pixelMatrixInverse) {
604
618
  return 1;
605
619
  }
620
+
606
621
  var coord = this.pointCoordinate(new _point.default(0, 0));
607
622
  var p = new Float32Array([coord.x * this.worldSize, coord.y * this.worldSize, 0, 1]);
623
+
608
624
  var topPoint = _glMatrix.vec4.transformMat4(p, p, this.pixelMatrix);
625
+
609
626
  return topPoint[3] / this.cameraToCenterDistance;
610
627
  }
611
-
612
628
  /*
613
629
  * The camera looks at the map from a 3D (lng, lat, altitude) location. Let's use `cameraLocation`
614
630
  * as the name for the location under the camera and on the surface of the earth (lng, lat, 0).
@@ -620,6 +636,7 @@ var Transform = /*#__PURE__*/function () {
620
636
  * When the map is not pitched the `cameraPoint` is equivalent to the center of the map because
621
637
  * the camera is right above the center of the map.
622
638
  */
639
+
623
640
  }, {
624
641
  key: "getCameraPoint",
625
642
  value: function getCameraPoint() {
@@ -627,7 +644,6 @@ var Transform = /*#__PURE__*/function () {
627
644
  var yOffset = Math.tan(pitch) * (this.cameraToCenterDistance || 1);
628
645
  return this.centerPoint.add(new _point.default(0, yOffset));
629
646
  }
630
-
631
647
  /*
632
648
  * When the map is pitched, some of the 3D features that intersect a query will not intersect
633
649
  * the query at the surface of the earth. Instead the feature may be closer and only intersect
@@ -638,10 +654,12 @@ var Transform = /*#__PURE__*/function () {
638
654
  * - For point queries, the line from the query point to the "camera point"
639
655
  * - For other geometries, the envelope of the query geometry and the "camera point"
640
656
  */
657
+
641
658
  }, {
642
659
  key: "getCameraQueryGeometry",
643
660
  value: function getCameraQueryGeometry(queryGeometry) {
644
661
  var c = this.getCameraPoint();
662
+
645
663
  if (queryGeometry.length === 1) {
646
664
  return [queryGeometry[0], c];
647
665
  } else {
@@ -649,8 +667,10 @@ var Transform = /*#__PURE__*/function () {
649
667
  var minY = c.y;
650
668
  var maxX = c.x;
651
669
  var maxY = c.y;
670
+
652
671
  var _iterator = _createForOfIteratorHelper(queryGeometry),
653
- _step;
672
+ _step;
673
+
654
674
  try {
655
675
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
656
676
  var p = _step.value;
@@ -664,21 +684,24 @@ var Transform = /*#__PURE__*/function () {
664
684
  } finally {
665
685
  _iterator.f();
666
686
  }
687
+
667
688
  return [new _point.default(minX, minY), new _point.default(maxX, minY), new _point.default(maxX, maxY), new _point.default(minX, maxY), new _point.default(minX, minY)];
668
689
  }
669
690
  }
670
-
671
691
  /**
672
692
  * Given a coordinate, return the screen point that corresponds to it
673
693
  * @param {Coordinate} coord
674
694
  * @returns {Point} screen point
675
695
  * @private
676
696
  */
697
+
677
698
  }, {
678
699
  key: "coordinatePoint",
679
700
  value: function coordinatePoint(coord) {
680
701
  var p = _glMatrix.vec4.fromValues(coord.x * this.worldSize, coord.y * this.worldSize, 0, 1);
702
+
681
703
  _glMatrix.vec4.transformMat4(p, p, this.pixelMatrix);
704
+
682
705
  return new _point.default(p[0] / p[3], p[1] / p[3]);
683
706
  }
684
707
  /**
@@ -687,28 +710,27 @@ var Transform = /*#__PURE__*/function () {
687
710
  * @returns {Point} screen point
688
711
  * @private
689
712
  */
713
+
690
714
  }, {
691
715
  key: "locationPoint",
692
716
  value: function locationPoint(lnglat) {
693
717
  return this.coordinatePoint(this.locationCoordinate(lnglat));
694
718
  }
695
-
696
719
  /**
697
720
  * Given a point on screen, return its lnglat
698
721
  * @param {Point} p screen point
699
722
  * @returns {LngLat} lnglat location
700
723
  * @private
701
724
  */
725
+
702
726
  }, {
703
727
  key: "pointLocation",
704
728
  value: function pointLocation(p) {
705
729
  // if(p.x !== 0 && p.x !== 1001) {
706
730
  // console.log(p.x)
707
731
  // }
708
-
709
732
  return this.coordinateLocation(this.pointCoordinate(p));
710
733
  }
711
-
712
734
  /**
713
735
  * Given a geographical lnglat, return an unrounded
714
736
  * coordinate that represents it at this transform's zoom level.
@@ -716,18 +738,19 @@ var Transform = /*#__PURE__*/function () {
716
738
  * @returns {Coordinate}
717
739
  * @private
718
740
  */
741
+
719
742
  }, {
720
743
  key: "locationCoordinate",
721
744
  value: function locationCoordinate(lnglat) {
722
745
  return _mercator.default.fromLngLat(lnglat);
723
746
  }
724
-
725
747
  /**
726
748
  * Given a Coordinate, return its geographical position.
727
749
  * @param {Coordinate} coord
728
750
  * @returns {LngLat} lnglat
729
751
  * @private
730
752
  */
753
+
731
754
  }, {
732
755
  key: "coordinateLocation",
733
756
  value: function coordinateLocation(coord) {
@@ -752,12 +775,10 @@ var Transform = /*#__PURE__*/function () {
752
775
  // if (cache[posMatrixKey]) {
753
776
  // return cache[posMatrixKey];
754
777
  // }
755
-
756
778
  // const canonical = unwrappedTileID.canonical;
757
779
  // const scale = this.worldSize / this.zoomScale(canonical.z);
758
780
  // const unwrappedX =
759
781
  // canonical.x + Math.pow(2, canonical.z) * unwrappedTileID.wrap;
760
-
761
782
  // const posMatrix = mat4.identity(new Float64Array(16));
762
783
  // mat4.translate(posMatrix, posMatrix, [
763
784
  // unwrappedX * scale,
@@ -770,16 +791,17 @@ var Transform = /*#__PURE__*/function () {
770
791
  // aligned ? this.alignedProjMatrix : this.projMatrix,
771
792
  // posMatrix,
772
793
  // );
773
-
774
794
  // cache[posMatrixKey] = new Float32Array(posMatrix);
775
795
  // return cache[posMatrixKey];
776
796
  // }
797
+
777
798
  }, {
778
799
  key: "constrain",
779
800
  value: function constrain() {
780
801
  if (!this.center || !this.width || !this.height || this.constraining) {
781
802
  return;
782
803
  }
804
+
783
805
  this.constraining = true;
784
806
  var minY = -90;
785
807
  var maxY = 90;
@@ -791,58 +813,70 @@ var Transform = /*#__PURE__*/function () {
791
813
  var y2;
792
814
  var size = this.size;
793
815
  var unmodified = this.unmodified;
816
+
794
817
  if (this.latRange) {
795
818
  var latRange = this.latRange;
796
819
  minY = (0, _mercator.mercatorYfromLat)(latRange[1]) * this.worldSize;
797
820
  maxY = (0, _mercator.mercatorYfromLat)(latRange[0]) * this.worldSize;
798
821
  sy = maxY - minY < size.y ? size.y / (maxY - minY) : 0;
799
822
  }
823
+
800
824
  if (this.lngRange) {
801
825
  var lngRange = this.lngRange;
802
826
  minX = (0, _mercator.mercatorXfromLng)(lngRange[0]) * this.worldSize;
803
827
  maxX = (0, _mercator.mercatorXfromLng)(lngRange[1]) * this.worldSize;
804
828
  sx = maxX - minX < size.x ? size.x / (maxX - minX) : 0;
805
829
  }
806
- var point = this.point;
807
830
 
808
- // how much the map should scale to fit the screen into given latitude/longitude ranges
831
+ var point = this.point; // how much the map should scale to fit the screen into given latitude/longitude ranges
832
+
809
833
  var s = Math.max(sx || 0, sy || 0);
834
+
810
835
  if (s) {
811
836
  this.center = this.unproject(new _point.default(sx ? (maxX + minX) / 2 : point.x, sy ? (maxY + minY) / 2 : point.y));
837
+
812
838
  if (_l7Utils.isMini) {
813
839
  this.zoom = Math.max(this.zoom, Math.max(-1, this.minZoom));
814
840
  } else {
815
841
  this.zoom += this.scaleZoom(s);
816
842
  }
843
+
817
844
  this.unmodified = unmodified;
818
845
  this.constraining = false;
819
846
  return;
820
847
  }
848
+
821
849
  if (this.latRange) {
822
850
  var y = point.y;
823
851
  var h2 = size.y / 2;
852
+
824
853
  if (y - h2 < minY) {
825
854
  y2 = minY + h2;
826
855
  }
856
+
827
857
  if (y + h2 > maxY) {
828
858
  y2 = maxY - h2;
829
859
  }
830
860
  }
861
+
831
862
  if (this.lngRange) {
832
863
  var x = point.x;
833
864
  var w2 = size.x / 2;
865
+
834
866
  if (x - w2 < minX) {
835
867
  x2 = minX + w2;
836
868
  }
869
+
837
870
  if (x + w2 > maxX) {
838
871
  x2 = maxX - w2;
839
872
  }
840
- }
873
+ } // pan the map if the screen goes off the range
874
+
841
875
 
842
- // pan the map if the screen goes off the range
843
876
  if (x2 !== undefined || y2 !== undefined) {
844
877
  this.center = this.unproject(new _point.default(x2 !== undefined ? x2 : point.x, y2 !== undefined ? y2 : point.y));
845
878
  }
879
+
846
880
  this.unmodified = unmodified;
847
881
  this.constraining = false;
848
882
  }
@@ -852,120 +886,122 @@ var Transform = /*#__PURE__*/function () {
852
886
  if (!this.height) {
853
887
  return;
854
888
  }
889
+
855
890
  var halfFov = this._fov / 2;
856
891
  var offset = this.centerOffset;
857
- this.cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this.height;
858
-
859
- // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the
892
+ this.cameraToCenterDistance = 0.5 / Math.tan(halfFov) * this.height; // Find the distance from the center point [width/2 + offset.x, height/2 + offset.y] to the
860
893
  // center top point [width/2 + offset.x, 0] in Z units, using the law of sines.
861
894
  // 1 Z unit is equivalent to 1 horizontal px at the center of the map
862
895
  // (the distance between[width/2, height/2] and [width/2 + 1, height/2])
896
+
863
897
  var groundAngle = Math.PI / 2 + this._pitch;
864
898
  var fovAboveCenter = this._fov * (0.5 + offset.y / this.height);
865
899
  var topHalfSurfaceDistance = Math.sin(fovAboveCenter) * this.cameraToCenterDistance / Math.sin((0, _util.clamp)(Math.PI - groundAngle - fovAboveCenter, 0.01, Math.PI - 0.01));
866
900
  var point = this.point;
867
901
  var x = point.x;
868
- var y = point.y;
902
+ var y = point.y; // Calculate z distance of the farthest fragment that should be rendered.
869
903
 
870
- // Calculate z distance of the farthest fragment that should be rendered.
871
- var furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance;
872
- // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`
873
- var farZ = furthestDistance * 1.01;
904
+ var furthestDistance = Math.cos(Math.PI / 2 - this._pitch) * topHalfSurfaceDistance + this.cameraToCenterDistance; // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`
874
905
 
875
- // The larger the value of nearZ is
906
+ var farZ = furthestDistance * 1.01; // The larger the value of nearZ is
876
907
  // - the more depth precision is available for features (good)
877
908
  // - clipping starts appearing sooner when the camera is close to 3d features (bad)
878
909
  //
879
910
  // Smaller values worked well for mapbox-gl-js but deckgl was encountering precision issues
880
911
  // when rendering it's layers using custom layers. This value was experimentally chosen and
881
912
  // seems to solve z-fighting issues in deckgl while not clipping buildings too close to the camera.
882
- var nearZ = this.height / 50;
883
913
 
884
- // matrix for conversion from location to GL coordinates (-1 .. 1)
914
+ var nearZ = this.height / 50; // matrix for conversion from location to GL coordinates (-1 .. 1)
885
915
  // 使用 Float64Array 的原因是为了避免计算精度问题、 mat4.create() 默认使用 Float32Array
886
- var m = new Float64Array(16);
887
- // @ts-ignore
888
- _glMatrix.mat4.perspective(m, this._fov, this.width / this.height, nearZ, farZ);
889
916
 
890
- // Apply center of perspective offset
917
+ var m = new Float64Array(16); // @ts-ignore
918
+
919
+ _glMatrix.mat4.perspective(m, this._fov, this.width / this.height, nearZ, farZ); // Apply center of perspective offset
920
+
921
+
891
922
  m[8] = -offset.x * 2 / this.width;
892
- m[9] = offset.y * 2 / this.height;
923
+ m[9] = offset.y * 2 / this.height; // @ts-ignore
924
+
925
+ _glMatrix.mat4.scale(m, m, [1, -1, 1]); // @ts-ignore
893
926
 
894
- // @ts-ignore
895
- _glMatrix.mat4.scale(m, m, [1, -1, 1]);
896
- // @ts-ignore
897
- _glMatrix.mat4.translate(m, m, [0, 0, -this.cameraToCenterDistance]);
898
- // @ts-ignore
899
- _glMatrix.mat4.rotateX(m, m, this._pitch);
900
- // @ts-ignore
901
- _glMatrix.mat4.rotateZ(m, m, this.angle);
902
- // @ts-ignore
903
- _glMatrix.mat4.translate(m, m, [-x, -y, 0]);
904
927
 
905
- // The mercatorMatrix can be used to transform points from mercator coordinates
928
+ _glMatrix.mat4.translate(m, m, [0, 0, -this.cameraToCenterDistance]); // @ts-ignore
929
+
930
+
931
+ _glMatrix.mat4.rotateX(m, m, this._pitch); // @ts-ignore
932
+
933
+
934
+ _glMatrix.mat4.rotateZ(m, m, this.angle); // @ts-ignore
935
+
936
+
937
+ _glMatrix.mat4.translate(m, m, [-x, -y, 0]); // The mercatorMatrix can be used to transform points from mercator coordinates
906
938
  // ([0, 0] nw, [1, 1] se) to GL coordinates.
907
939
  // @ts-ignore
908
- this.mercatorMatrix = _glMatrix.mat4.scale([], m, [this.worldSize, this.worldSize, this.worldSize]);
909
- // scale vertically to meters per pixel (inverse of ground resolution):
910
940
 
941
+
942
+ this.mercatorMatrix = _glMatrix.mat4.scale([], m, [this.worldSize, this.worldSize, this.worldSize]); // scale vertically to meters per pixel (inverse of ground resolution):
911
943
  // @ts-ignore
912
- _glMatrix.mat4.scale(m, m, [1, 1, (0, _mercator.mercatorZfromAltitude)(1, this.center.lat) * this.worldSize, 1]);
913
- // @ts-ignore
914
- this.projMatrix = m;
915
- // @ts-ignore
916
- this.invProjMatrix = _glMatrix.mat4.invert([], this.projMatrix);
917
944
 
918
- // Make a second projection matrix that is aligned to a pixel grid for rendering raster tiles.
945
+ _glMatrix.mat4.scale(m, m, [1, 1, (0, _mercator.mercatorZfromAltitude)(1, this.center.lat) * this.worldSize, 1]); // @ts-ignore
946
+
947
+
948
+ this.projMatrix = m; // @ts-ignore
949
+
950
+ this.invProjMatrix = _glMatrix.mat4.invert([], this.projMatrix); // Make a second projection matrix that is aligned to a pixel grid for rendering raster tiles.
919
951
  // We're rounding the (floating point) x/y values to achieve to avoid rendering raster images to fractional
920
952
  // coordinates. Additionally, we adjust by half a pixel in either direction in case that viewport dimension
921
953
  // is an odd integer to preserve rendering to the pixel grid. We're rotating this shift based on the angle
922
954
  // of the transformation so that 0°, 90°, 180°, and 270° rasters are crisp, and adjust the shift so that
923
955
  // it is always <= 0.5 pixels.
956
+
924
957
  var xShift = this.width % 2 / 2;
925
958
  var yShift = this.height % 2 / 2;
926
959
  var angleCos = Math.cos(this.angle);
927
960
  var angleSin = Math.sin(this.angle);
928
961
  var dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift;
929
- var dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;
930
- // const alignedM = mat4.clone(m);
931
- var alignedM = new Float64Array(m);
932
- // @ts-ignore
933
- _glMatrix.mat4.translate(alignedM, alignedM, [dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0]);
934
- // @ts-ignore
935
- this.alignedProjMatrix = alignedM;
962
+ var dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift; // const alignedM = mat4.clone(m);
936
963
 
937
- // @ts-ignore
938
- m = _glMatrix.mat4.create();
939
- // @ts-ignore
940
- _glMatrix.mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]);
941
- // @ts-ignore
942
- _glMatrix.mat4.translate(m, m, [1, -1, 0]);
943
- // @ts-ignore
944
- this.labelPlaneMatrix = m;
964
+ var alignedM = new Float64Array(m); // @ts-ignore
945
965
 
946
- // @ts-ignore
947
- m = _glMatrix.mat4.create();
948
- // @ts-ignore
949
- _glMatrix.mat4.scale(m, m, [1, -1, 1]);
950
- // @ts-ignore
951
- _glMatrix.mat4.translate(m, m, [-1, -1, 0]);
952
- // @ts-ignore
953
- _glMatrix.mat4.scale(m, m, [2 / this.width, 2 / this.height, 1]);
954
- // @ts-ignore
955
- this.glCoordMatrix = m;
966
+ _glMatrix.mat4.translate(alignedM, alignedM, [dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0]); // @ts-ignore
956
967
 
957
- // matrix for conversion from location to screen coordinates
958
- this.pixelMatrix = _glMatrix.mat4.multiply(
959
- // @ts-ignore
960
- new Float64Array(16), this.labelPlaneMatrix, this.projMatrix);
961
968
 
962
- // inverse matrix for conversion from screen coordinaes to location
969
+ this.alignedProjMatrix = alignedM; // @ts-ignore
970
+
971
+ m = _glMatrix.mat4.create(); // @ts-ignore
972
+
973
+ _glMatrix.mat4.scale(m, m, [this.width / 2, -this.height / 2, 1]); // @ts-ignore
974
+
975
+
976
+ _glMatrix.mat4.translate(m, m, [1, -1, 0]); // @ts-ignore
977
+
978
+
979
+ this.labelPlaneMatrix = m; // @ts-ignore
980
+
981
+ m = _glMatrix.mat4.create(); // @ts-ignore
982
+
983
+ _glMatrix.mat4.scale(m, m, [1, -1, 1]); // @ts-ignore
984
+
985
+
986
+ _glMatrix.mat4.translate(m, m, [-1, -1, 0]); // @ts-ignore
987
+
988
+
989
+ _glMatrix.mat4.scale(m, m, [2 / this.width, 2 / this.height, 1]); // @ts-ignore
990
+
991
+
992
+ this.glCoordMatrix = m; // matrix for conversion from location to screen coordinates
993
+
994
+ this.pixelMatrix = _glMatrix.mat4.multiply( // @ts-ignore
995
+ new Float64Array(16), this.labelPlaneMatrix, this.projMatrix); // inverse matrix for conversion from screen coordinaes to location
963
996
  // @ts-ignore
997
+
964
998
  m = _glMatrix.mat4.invert(new Float64Array(16), this.pixelMatrix);
999
+
965
1000
  if (!m) {
966
1001
  throw new Error('failed to invert matrix');
967
- }
968
- // @ts-ignore
1002
+ } // @ts-ignore
1003
+
1004
+
969
1005
  this.pixelMatrixInverse = m;
970
1006
  this.posMatrixCache = {};
971
1007
  this.alignedPosMatrixCache = {};
@@ -973,4 +1009,5 @@ var Transform = /*#__PURE__*/function () {
973
1009
  }]);
974
1010
  return Transform;
975
1011
  }();
1012
+
976
1013
  exports.default = Transform;