@antv/l7-map 2.17.12 → 2.18.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 (104) hide show
  1. package/es/camera.js +92 -149
  2. package/es/earthmap.js +15 -68
  3. package/es/geo/edge_insets.js +4 -14
  4. package/es/geo/lng_lat.js +5 -13
  5. package/es/geo/lng_lat_bounds.js +4 -17
  6. package/es/geo/mercator.js +2 -10
  7. package/es/geo/point.js +0 -7
  8. package/es/geo/simple.js +6 -11
  9. package/es/geo/transform.js +128 -138
  10. package/es/handler/blockable_map_event.js +7 -12
  11. package/es/handler/box_zoom.js +10 -30
  12. package/es/handler/click_zoom.js +0 -5
  13. package/es/handler/events/event.js +2 -3
  14. package/es/handler/events/map_mouse_event.js +2 -13
  15. package/es/handler/events/map_touch_event.js +2 -12
  16. package/es/handler/events/map_wheel_event.js +1 -12
  17. package/es/handler/events/render_event.js +0 -13
  18. package/es/handler/handler_inertia.js +8 -35
  19. package/es/handler/handler_manager.js +90 -197
  20. package/es/handler/handler_util.js +1 -2
  21. package/es/handler/keyboard.js +1 -20
  22. package/es/handler/map_event.js +3 -9
  23. package/es/handler/mouse/mouse_handler.js +11 -24
  24. package/es/handler/mouse/mousepan_handler.js +1 -11
  25. package/es/handler/mouse/mousepitch_hander.js +1 -11
  26. package/es/handler/mouse/mouserotate_hander.js +1 -11
  27. package/es/handler/mouse/util.js +2 -3
  28. package/es/handler/scroll_zoom.js +43 -71
  29. package/es/handler/shim/dblclick_zoom.js +4 -9
  30. package/es/handler/shim/drag_pan.js +6 -18
  31. package/es/handler/shim/drag_rotate.js +4 -10
  32. package/es/handler/shim/touch_zoom_rotate.js +8 -23
  33. package/es/handler/tap/single_tap_recognizer.js +8 -31
  34. package/es/handler/tap/tap_drag_zoom.js +7 -15
  35. package/es/handler/tap/tap_recognizer.js +3 -11
  36. package/es/handler/tap/tap_zoom.js +1 -7
  37. package/es/handler/touch/touch_pan.js +4 -22
  38. package/es/handler/touch/touch_pitch.js +10 -27
  39. package/es/handler/touch/touch_rotate.js +8 -19
  40. package/es/handler/touch/touch_zoom.js +5 -18
  41. package/es/handler/touch/two_touch.js +19 -32
  42. package/es/hash.js +13 -35
  43. package/es/map.js +30 -107
  44. package/es/util.d.ts +3 -3
  45. package/es/util.js +20 -33
  46. package/es/utils/Aabb.js +10 -31
  47. package/es/utils/dom.js +33 -111
  48. package/es/utils/performance.js +9 -9
  49. package/es/utils/primitives.js +13 -11
  50. package/es/utils/task_queue.js +6 -23
  51. package/lib/camera.js +102 -179
  52. package/lib/earthmap.js +14 -83
  53. package/lib/geo/edge_insets.js +3 -18
  54. package/lib/geo/lng_lat.js +5 -18
  55. package/lib/geo/lng_lat_bounds.js +4 -20
  56. package/lib/geo/mercator.js +1 -22
  57. package/lib/geo/point.js +0 -8
  58. package/lib/geo/simple.js +5 -24
  59. package/lib/geo/transform.js +128 -170
  60. package/lib/handler/blockable_map_event.js +6 -14
  61. package/lib/handler/box_zoom.js +8 -39
  62. package/lib/handler/click_zoom.js +0 -6
  63. package/lib/handler/events/event.js +4 -7
  64. package/lib/handler/events/index.js +0 -4
  65. package/lib/handler/events/map_mouse_event.js +5 -22
  66. package/lib/handler/events/map_touch_event.js +2 -21
  67. package/lib/handler/events/map_wheel_event.js +1 -16
  68. package/lib/handler/events/render_event.js +0 -19
  69. package/lib/handler/handler_inertia.js +13 -44
  70. package/lib/handler/handler_manager.js +92 -222
  71. package/lib/handler/handler_util.js +1 -3
  72. package/lib/handler/keyboard.js +1 -22
  73. package/lib/handler/map_event.js +2 -11
  74. package/lib/handler/mouse/index.js +0 -4
  75. package/lib/handler/mouse/mouse_handler.js +10 -27
  76. package/lib/handler/mouse/mousepan_handler.js +1 -18
  77. package/lib/handler/mouse/mousepitch_hander.js +1 -17
  78. package/lib/handler/mouse/mouserotate_hander.js +1 -17
  79. package/lib/handler/mouse/util.js +2 -6
  80. package/lib/handler/scroll_zoom.js +43 -77
  81. package/lib/handler/shim/dblclick_zoom.js +4 -10
  82. package/lib/handler/shim/drag_pan.js +6 -20
  83. package/lib/handler/shim/drag_rotate.js +4 -11
  84. package/lib/handler/shim/touch_zoom_rotate.js +8 -25
  85. package/lib/handler/tap/single_tap_recognizer.js +8 -33
  86. package/lib/handler/tap/tap_drag_zoom.js +6 -18
  87. package/lib/handler/tap/tap_recognizer.js +2 -17
  88. package/lib/handler/tap/tap_zoom.js +0 -9
  89. package/lib/handler/touch/index.js +0 -5
  90. package/lib/handler/touch/touch_pan.js +4 -25
  91. package/lib/handler/touch/touch_pitch.js +10 -32
  92. package/lib/handler/touch/touch_rotate.js +8 -25
  93. package/lib/handler/touch/touch_zoom.js +5 -24
  94. package/lib/handler/touch/two_touch.js +18 -35
  95. package/lib/hash.js +12 -38
  96. package/lib/index.js +0 -8
  97. package/lib/map.js +30 -125
  98. package/lib/util.js +19 -46
  99. package/lib/utils/Aabb.js +10 -34
  100. package/lib/utils/dom.js +32 -118
  101. package/lib/utils/performance.js +9 -11
  102. package/lib/utils/primitives.js +13 -16
  103. package/lib/utils/task_queue.js +6 -24
  104. package/package.json +4 -4
package/lib/earthmap.js CHANGED
@@ -1,94 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.EarthMap = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
15
  var _l7Utils = require("@antv/l7-utils");
25
-
26
- var _lodash = require("lodash");
27
-
28
16
  var _camera = _interopRequireDefault(require("./camera"));
29
-
30
17
  var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
31
-
32
18
  var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
33
-
34
19
  var _point = _interopRequireDefault(require("./geo/point"));
35
-
36
20
  var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
37
-
38
21
  var _util = require("./util");
39
-
40
22
  var _performance = require("./utils/performance");
41
-
42
23
  var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
43
-
44
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
45
-
46
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
-
48
26
  function loadStyles(css, doc) {
49
27
  var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
50
28
  var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
51
-
52
29
  if (isMiniAli || isWeChatMiniProgram) {
53
30
  return;
54
31
  }
55
-
56
32
  if (!doc) doc = document;
57
-
58
33
  if (!doc) {
59
34
  return;
60
35
  }
61
-
62
36
  var head = doc.head || doc.getElementsByTagName('head')[0];
63
-
64
37
  if (!head) {
65
38
  head = doc.createElement('head');
66
39
  var body = doc.body || doc.getElementsByTagName('body')[0];
67
-
68
40
  if (body) {
69
41
  body.parentNode.insertBefore(head, body);
70
42
  } else {
71
43
  doc.documentElement.appendChild(head);
72
44
  }
73
45
  }
74
-
75
46
  var style = doc.createElement('style');
76
47
  style.type = 'text/css';
77
-
78
48
  if (style.styleSheet) {
79
49
  style.styleSheet.cssText = css;
80
50
  } else {
81
51
  style.appendChild(doc.createTextNode(css));
82
52
  }
83
-
84
53
  head.appendChild(style);
85
54
  return style;
86
55
  }
87
-
88
- loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n");
56
+ loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n"); // @ts-ignore
89
57
  var defaultMinZoom = -2;
90
- var defaultMaxZoom = 22; // the default values, but also the valid range
91
-
58
+ var defaultMaxZoom = 22;
59
+ var merge = _l7Utils.lodashUtil.merge;
60
+ // the default values, but also the valid range
92
61
  var defaultMinPitch = 0;
93
62
  var defaultMaxPitch = 60;
94
63
  var DefaultOptions = {
@@ -118,17 +87,13 @@ var DefaultOptions = {
118
87
  pitchEnabled: true,
119
88
  rotateEnabled: true
120
89
  };
121
-
122
90
  var EarthMap = /*#__PURE__*/function (_Camera) {
123
91
  (0, _inherits2.default)(EarthMap, _Camera);
124
-
125
92
  var _super = _createSuper(EarthMap);
126
-
127
93
  function EarthMap(options) {
128
94
  var _this;
129
-
130
95
  (0, _classCallCheck2.default)(this, EarthMap);
131
- _this = _super.call(this, (0, _lodash.merge)({}, DefaultOptions, options));
96
+ _this = _super.call(this, merge({}, DefaultOptions, options));
132
97
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
133
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
134
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
@@ -141,44 +106,35 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
141
106
  }).update();
142
107
  }
143
108
  });
144
-
145
109
  _this.initContainer();
146
-
147
110
  _this.resize();
148
-
149
111
  _this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
150
-
151
112
  if (typeof window !== 'undefined') {
152
113
  window.addEventListener('online', _this.onWindowOnline, false);
153
114
  window.addEventListener('resize', _this.onWindowResize, false);
154
115
  window.addEventListener('orientationchange', _this.onWindowResize, false);
155
116
  }
156
-
157
117
  return _this;
158
118
  }
159
-
160
119
  (0, _createClass2.default)(EarthMap, [{
161
120
  key: "resize",
162
121
  value: function resize(eventData) {
163
122
  var dimensions = this.containerDimensions();
164
123
  var width = dimensions[0];
165
- var height = dimensions[1]; // this.resizeCanvas(width, height);
124
+ var height = dimensions[1];
166
125
 
126
+ // this.resizeCanvas(width, height);
167
127
  this.transform.resize(width, height);
168
128
  var fireMoving = !this.moving;
169
-
170
129
  if (fireMoving) {
171
130
  this.stop();
172
131
  this.emit('movestart', new Event('movestart', eventData));
173
132
  this.emit('move', new Event('move', eventData));
174
133
  }
175
-
176
134
  this.emit('resize', new Event('resize', eventData));
177
-
178
135
  if (fireMoving) {
179
136
  this.emit('moveend', new Event('moveend', eventData));
180
137
  }
181
-
182
138
  return this;
183
139
  }
184
140
  }, {
@@ -220,8 +176,9 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
220
176
  key: "setMaxBounds",
221
177
  value: function setMaxBounds(bounds) {
222
178
  this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
223
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
179
+ }
224
180
 
181
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
225
182
  }, {
226
183
  key: "setStyle",
227
184
  value: function setStyle(style) {
@@ -231,14 +188,11 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
231
188
  key: "setMinZoom",
232
189
  value: function setMinZoom(minZoom) {
233
190
  minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
234
-
235
191
  if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
236
192
  this.transform.minZoom = minZoom;
237
-
238
193
  if (this.getZoom() < minZoom) {
239
194
  this.setZoom(minZoom);
240
195
  }
241
-
242
196
  return this;
243
197
  } else {
244
198
  throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
@@ -253,14 +207,11 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
253
207
  key: "setMaxZoom",
254
208
  value: function setMaxZoom(maxZoom) {
255
209
  maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
256
-
257
210
  if (maxZoom >= this.transform.minZoom) {
258
211
  this.transform.maxZoom = maxZoom;
259
-
260
212
  if (this.getZoom() > maxZoom) {
261
213
  this.setZoom(maxZoom);
262
214
  }
263
-
264
215
  return this;
265
216
  } else {
266
217
  throw new Error('maxZoom must be greater than the current minZoom');
@@ -275,18 +226,14 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
275
226
  key: "setMinPitch",
276
227
  value: function setMinPitch(minPitch) {
277
228
  minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
278
-
279
229
  if (minPitch < defaultMinPitch) {
280
230
  throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
281
231
  }
282
-
283
232
  if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
284
233
  this.transform.minPitch = minPitch;
285
-
286
234
  if (this.getPitch() < minPitch) {
287
235
  this.setPitch(minPitch);
288
236
  }
289
-
290
237
  return this;
291
238
  } else {
292
239
  throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
@@ -301,18 +248,14 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
301
248
  key: "setMaxPitch",
302
249
  value: function setMaxPitch(maxPitch) {
303
250
  maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
304
-
305
251
  if (maxPitch > defaultMaxPitch) {
306
252
  throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
307
253
  }
308
-
309
254
  if (maxPitch >= this.transform.minPitch) {
310
255
  this.transform.maxPitch = maxPitch;
311
-
312
256
  if (this.getPitch() > maxPitch) {
313
257
  this.setPitch(maxPitch);
314
258
  }
315
-
316
259
  return this;
317
260
  } else {
318
261
  throw new Error('maxPitch must be greater than the current minPitch');
@@ -340,7 +283,6 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
340
283
  this.frame.cancel();
341
284
  this.frame = null;
342
285
  }
343
-
344
286
  this.renderTaskQueue.clear();
345
287
  }
346
288
  }, {
@@ -358,13 +300,10 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
358
300
  key: "triggerRepaint",
359
301
  value: function triggerRepaint() {
360
302
  var _this2 = this;
361
-
362
303
  if (!this.frame) {
363
304
  this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
364
305
  _performance.PerformanceUtils.frame(paintStartTimeStamp);
365
-
366
306
  _this2.frame = null;
367
-
368
307
  _this2.update(paintStartTimeStamp);
369
308
  });
370
309
  }
@@ -373,13 +312,10 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
373
312
  key: "update",
374
313
  value: function update(time) {
375
314
  var _this3 = this;
376
-
377
315
  if (!this.frame) {
378
316
  this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
379
317
  _performance.PerformanceUtils.frame(paintStartTimeStamp);
380
-
381
318
  _this3.frame = null;
382
-
383
319
  _this3.renderTaskQueue.run(time);
384
320
  });
385
321
  }
@@ -389,7 +325,6 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
389
325
  value: function initContainer() {
390
326
  if (typeof this.options.container === 'string') {
391
327
  this.container = window.document.getElementById(this.options.container);
392
-
393
328
  if (!this.container) {
394
329
  throw new Error("Container '".concat(this.options.container, "' not found."));
395
330
  }
@@ -398,34 +333,30 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
398
333
  } else {
399
334
  throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
400
335
  }
401
-
402
336
  var container = this.container;
403
337
  container.classList.add('l7-map');
404
-
405
338
  var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
406
-
407
339
  if (this.options.interactive) {
408
340
  canvasContainer.classList.add('l7-interactive');
409
- } // this.canvas = DOM.create(
341
+ }
342
+
343
+ // this.canvas = DOM.create(
410
344
  // 'canvas',
411
345
  // 'l7-canvas',
412
346
  // canvasContainer,
413
347
  // ) as HTMLCanvasElement;
414
348
  // this.canvas.setAttribute('tabindex', '-');
415
349
  // this.canvas.setAttribute('aria-label', 'Map');
416
-
417
350
  }
418
351
  }, {
419
352
  key: "containerDimensions",
420
353
  value: function containerDimensions() {
421
354
  var width = 0;
422
355
  var height = 0;
423
-
424
356
  if (this.container) {
425
357
  width = this.container.clientWidth || 400;
426
358
  height = this.container.clientHeight || 300;
427
359
  }
428
-
429
360
  return [width, height];
430
361
  }
431
362
  }, {
@@ -433,13 +364,13 @@ var EarthMap = /*#__PURE__*/function (_Camera) {
433
364
  value: function resizeCanvas(width, height) {
434
365
  var pixelRatio = _l7Utils.DOM.DPR || 1;
435
366
  this.canvas.width = pixelRatio * width;
436
- this.canvas.height = pixelRatio * height; // Maintain the same canvas size, potentially downscaling it for HiDPI displays
367
+ this.canvas.height = pixelRatio * height;
437
368
 
369
+ // Maintain the same canvas size, potentially downscaling it for HiDPI displays
438
370
  this.canvas.style.width = "".concat(width, "px");
439
371
  this.canvas.style.height = "".concat(height, "px");
440
372
  }
441
373
  }]);
442
374
  return EarthMap;
443
375
  }(_camera.default);
444
-
445
376
  exports.EarthMap = EarthMap;
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _util = require("../util");
15
-
16
11
  var _point = _interopRequireDefault(require("./point"));
17
-
18
12
  // @ts-ignore
19
-
20
13
  /**
21
14
  * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
22
15
  * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
@@ -34,16 +27,15 @@ var EdgeInsets = /*#__PURE__*/function () {
34
27
  var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
35
28
  var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
36
29
  (0, _classCallCheck2.default)(this, EdgeInsets);
37
-
38
30
  if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
39
31
  throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
40
32
  }
41
-
42
33
  this.top = top;
43
34
  this.bottom = bottom;
44
35
  this.left = left;
45
36
  this.right = right;
46
37
  }
38
+
47
39
  /**
48
40
  * Interpolates the inset in-place.
49
41
  * This maintains the current inset value for any inset not present in `target`.
@@ -53,29 +45,24 @@ var EdgeInsets = /*#__PURE__*/function () {
53
45
  * @returns {EdgeInsets}
54
46
  * @memberof EdgeInsets
55
47
  */
56
-
57
-
58
48
  (0, _createClass2.default)(EdgeInsets, [{
59
49
  key: "interpolate",
60
50
  value: function interpolate(start, target, t) {
61
51
  if (target.top != null && start.top != null) {
62
52
  this.top = (0, _util.interpolate)(start.top, target.top, t);
63
53
  }
64
-
65
54
  if (target.bottom != null && start.bottom != null) {
66
55
  this.bottom = (0, _util.interpolate)(start.bottom, target.bottom, t);
67
56
  }
68
-
69
57
  if (target.left != null && start.left != null) {
70
58
  this.left = (0, _util.interpolate)(start.left, target.left, t);
71
59
  }
72
-
73
60
  if (target.right != null && start.right != null) {
74
61
  this.right = (0, _util.interpolate)(start.right, target.right, t);
75
62
  }
76
-
77
63
  return this;
78
64
  }
65
+
79
66
  /**
80
67
  * Utility method that computes the new apprent center or vanishing point after applying insets.
81
68
  * This is in pixels and with the top left being (0.0) and +y being downwards.
@@ -85,7 +72,6 @@ var EdgeInsets = /*#__PURE__*/function () {
85
72
  * @returns {Point}
86
73
  * @memberof EdgeInsets
87
74
  */
88
-
89
75
  }, {
90
76
  key: "getCenter",
91
77
  value: function getCenter(width, height) {
@@ -104,6 +90,7 @@ var EdgeInsets = /*#__PURE__*/function () {
104
90
  value: function clone() {
105
91
  return new EdgeInsets(this.top, this.bottom, this.left, this.right);
106
92
  }
93
+
107
94
  /**
108
95
  * Returns the current sdtate as json, useful when you want to have a
109
96
  * read-only representation of the inset.
@@ -111,7 +98,6 @@ var EdgeInsets = /*#__PURE__*/function () {
111
98
  * @returns {PaddingOptions}
112
99
  * @memberof EdgeInsets
113
100
  */
114
-
115
101
  }, {
116
102
  key: "toJSON",
117
103
  value: function toJSON() {
@@ -125,5 +111,4 @@ var EdgeInsets = /*#__PURE__*/function () {
125
111
  }]);
126
112
  return EdgeInsets;
127
113
  }();
128
-
129
114
  exports.default = EdgeInsets;
@@ -1,39 +1,28 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.earthRadius = exports.default = void 0;
9
-
10
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _util = require("../util");
17
-
18
12
  var earthRadius = 6371008.8;
19
13
  exports.earthRadius = earthRadius;
20
-
21
14
  var LngLat = /*#__PURE__*/function () {
22
15
  function LngLat(lng, lat) {
23
16
  (0, _classCallCheck2.default)(this, LngLat);
24
-
25
17
  if (isNaN(lng) || isNaN(lat)) {
26
18
  throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
27
19
  }
28
-
29
20
  this.lng = +lng;
30
21
  this.lat = +lat;
31
-
32
22
  if (this.lat > 90 || this.lat < -90) {
33
23
  throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
34
24
  }
35
25
  }
36
-
37
26
  (0, _createClass2.default)(LngLat, [{
38
27
  key: "wrap",
39
28
  value: function wrap() {
@@ -43,16 +32,17 @@ var LngLat = /*#__PURE__*/function () {
43
32
  key: "toArray",
44
33
  value: function toArray() {
45
34
  return [this.lng, this.lat];
46
- } // public toBounds(radius: number = 0) {
35
+ }
36
+ // public toBounds(radius: number = 0) {
47
37
  // const earthCircumferenceInMetersAtEquator = 40075017;
48
38
  // const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
49
39
  // const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
40
+
50
41
  // return new LngLatBounds(
51
42
  // new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
52
43
  // new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
53
44
  // );
54
45
  // }
55
-
56
46
  }, {
57
47
  key: "toString",
58
48
  value: function toString() {
@@ -74,21 +64,18 @@ var LngLat = /*#__PURE__*/function () {
74
64
  if (input instanceof LngLat) {
75
65
  return input;
76
66
  }
77
-
78
67
  if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
79
68
  return new LngLat(Number(input[0]), Number(input[1]));
80
69
  }
81
-
82
70
  if (!Array.isArray(input) && (0, _typeof2.default)(input) === 'object' && input !== null) {
83
71
  var lng = 'lng' in input ? input.lng : input.lon;
84
- return new LngLat( // flow can't refine this to have one of lng or lat, so we have to cast to any
72
+ return new LngLat(
73
+ // flow can't refine this to have one of lng or lat, so we have to cast to any
85
74
  Number(lng), Number(input.lat));
86
75
  }
87
-
88
76
  throw new Error('`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]');
89
77
  }
90
78
  }]);
91
79
  return LngLat;
92
80
  }();
93
-
94
81
  exports.default = LngLat;
@@ -1,23 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _lng_lat = _interopRequireDefault(require("./lng_lat"));
15
-
16
11
  var LngLatBounds = /*#__PURE__*/function () {
17
12
  function LngLatBounds(sw, ne) {
18
13
  (0, _classCallCheck2.default)(this, LngLatBounds);
19
-
20
- if (!sw) {// noop
14
+ if (!sw) {
15
+ // noop
21
16
  } else if (ne) {
22
17
  this.setSouthWest(sw).setNorthEast(ne);
23
18
  } else if (sw.length === 4) {
@@ -26,7 +21,6 @@ var LngLatBounds = /*#__PURE__*/function () {
26
21
  this.setSouthWest(sw[0]).setNorthEast(sw[1]);
27
22
  }
28
23
  }
29
-
30
24
  (0, _createClass2.default)(LngLatBounds, [{
31
25
  key: "setNorthEast",
32
26
  value: function setNorthEast(ne) {
@@ -46,14 +40,12 @@ var LngLatBounds = /*#__PURE__*/function () {
46
40
  var ne = this.ne;
47
41
  var sw2;
48
42
  var ne2;
49
-
50
43
  if (obj instanceof _lng_lat.default) {
51
44
  sw2 = obj;
52
45
  ne2 = obj;
53
46
  } else if (obj instanceof LngLatBounds) {
54
47
  sw2 = obj.sw;
55
48
  ne2 = obj.ne;
56
-
57
49
  if (!sw2 || !ne2) {
58
50
  return this;
59
51
  }
@@ -68,10 +60,8 @@ var LngLatBounds = /*#__PURE__*/function () {
68
60
  return this.extend(_lng_lat.default.convert(lngLatObj));
69
61
  }
70
62
  }
71
-
72
63
  return this;
73
64
  }
74
-
75
65
  if (!sw && !ne) {
76
66
  this.sw = new _lng_lat.default(sw2.lng, sw2.lat);
77
67
  this.ne = new _lng_lat.default(ne2.lng, ne2.lat);
@@ -81,7 +71,6 @@ var LngLatBounds = /*#__PURE__*/function () {
81
71
  ne.lng = Math.max(ne2.lng, ne.lng);
82
72
  ne.lat = Math.max(ne2.lat, ne.lat);
83
73
  }
84
-
85
74
  return this;
86
75
  }
87
76
  }, {
@@ -148,17 +137,14 @@ var LngLatBounds = /*#__PURE__*/function () {
148
137
  key: "contains",
149
138
  value: function contains(lnglat) {
150
139
  var _LngLat$convert = _lng_lat.default.convert(lnglat),
151
- lng = _LngLat$convert.lng,
152
- lat = _LngLat$convert.lat;
153
-
140
+ lng = _LngLat$convert.lng,
141
+ lat = _LngLat$convert.lat;
154
142
  var containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
155
143
  var containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
156
-
157
144
  if (this.sw.lng > this.ne.lng) {
158
145
  // wrapped coordinates
159
146
  containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
160
147
  }
161
-
162
148
  return containsLatitude && containsLongitude;
163
149
  }
164
150
  }], [{
@@ -167,11 +153,9 @@ var LngLatBounds = /*#__PURE__*/function () {
167
153
  if (input instanceof LngLatBounds) {
168
154
  return input;
169
155
  }
170
-
171
156
  return new LngLatBounds(input);
172
157
  }
173
158
  }]);
174
159
  return LngLatBounds;
175
160
  }();
176
-
177
161
  exports.default = LngLatBounds;