@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
@@ -2,17 +2,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
-
6
5
  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; } } }; }
7
-
8
6
  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); }
9
-
10
- 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; }
11
-
7
+ 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; }
12
8
  // @ts-ignore
13
9
  // tslint:disable-next-line: no-submodule-imports
14
- import { $window, isMini } from '@antv/l7-utils';
15
- import { merge } from 'lodash';
10
+ import { lodashUtil } from '@antv/l7-utils';
16
11
  import Point from "../geo/point";
17
12
  import DOM from "../utils/dom";
18
13
  import BlockableMapEventHandler from "./blockable_map_event";
@@ -32,34 +27,28 @@ import TouchZoomRotateHandler from "./shim/touch_zoom_rotate";
32
27
  import TapDragZoomHandler from "./tap/tap_drag_zoom";
33
28
  import TapZoomHandler from "./tap/tap_zoom";
34
29
  import { TouchPanHandler, TouchPitchHandler, TouchRotateHandler, TouchZoomHandler } from "./touch";
35
-
30
+ var merge = lodashUtil.merge;
36
31
  var _isMoving = function isMoving(p) {
37
32
  return p.zoom || p.drag || p.pitch || p.rotate;
38
33
  };
39
-
40
34
  function hasChange(result) {
41
35
  return result.panDelta && result.panDelta.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta;
42
36
  }
43
-
44
37
  var HandlerManager = /*#__PURE__*/function () {
45
38
  function HandlerManager(map, options) {
46
39
  var _this = this;
47
-
48
40
  _classCallCheck(this, HandlerManager);
49
-
50
41
  _defineProperty(this, "handleWindowEvent", function (e) {
51
42
  _this.handleEvent(e, "".concat(e.type, "Window"));
52
43
  });
53
-
54
44
  _defineProperty(this, "handleEvent", function (e, eventName) {
55
45
  if (e.type === 'blur') {
56
46
  _this.stop();
57
-
58
47
  return;
59
48
  }
60
-
61
49
  _this.updatingCamera = true;
62
50
  var inputEvent = e.type === 'renderFrame' ? undefined : e;
51
+
63
52
  /*
64
53
  * We don't call e.preventDefault() for any events by default.
65
54
  * Handlers are responsible for calling it where necessary.
@@ -69,46 +58,39 @@ var HandlerManager = /*#__PURE__*/function () {
69
58
  needsRenderFrame: false
70
59
  };
71
60
  var eventsInProgress = {};
72
- var activeHandlers = {}; // @ts-ignore
73
-
74
- var mapTouches = e.touches ? // @ts-ignore
61
+ var activeHandlers = {};
62
+ // @ts-ignore
63
+ var mapTouches = e.touches ?
64
+ // @ts-ignore
75
65
  _this.getMapTouches(e.touches) : undefined;
76
66
  var points = mapTouches ? DOM.touchPos(_this.el, mapTouches) : DOM.mousePos(_this.el, e);
77
-
78
67
  var _iterator = _createForOfIteratorHelper(_this.handlers),
79
- _step;
80
-
68
+ _step;
81
69
  try {
82
70
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
83
71
  var _step$value = _step.value,
84
- handlerName = _step$value.handlerName,
85
- handler = _step$value.handler,
86
- allowed = _step$value.allowed;
87
-
72
+ handlerName = _step$value.handlerName,
73
+ handler = _step$value.handler,
74
+ allowed = _step$value.allowed;
88
75
  if (!handler.isEnabled()) {
89
76
  continue;
90
77
  }
91
-
92
78
  var data = void 0;
93
-
94
79
  if (_this.blockedByActive(activeHandlers, allowed, handlerName)) {
95
80
  handler.reset();
96
81
  } else {
97
- var handerName = eventName || e.type; // @ts-ignore
98
-
82
+ var handerName = eventName || e.type;
83
+ // @ts-ignore
99
84
  if (handler && handler[handerName]) {
100
85
  // @ts-ignore
101
86
  data = handler[handerName](e, points, mapTouches);
102
-
103
87
  _this.mergeIHandlerResult(mergedIHandlerResult, eventsInProgress, data, handlerName, inputEvent);
104
-
105
88
  if (data && data.needsRenderFrame) {
106
89
  _this.triggerRenderFrame();
107
90
  }
108
91
  }
109
- } // @ts-ignore
110
-
111
-
92
+ }
93
+ // @ts-ignore
112
94
  if (data || handler.isActive()) {
113
95
  activeHandlers[handlerName] = handler;
114
96
  }
@@ -118,40 +100,29 @@ var HandlerManager = /*#__PURE__*/function () {
118
100
  } finally {
119
101
  _iterator.f();
120
102
  }
121
-
122
103
  var deactivatedHandlers = {};
123
-
124
104
  for (var name in _this.previousActiveHandlers) {
125
105
  if (!activeHandlers[name]) {
126
106
  deactivatedHandlers[name] = inputEvent;
127
107
  }
128
108
  }
129
-
130
109
  _this.previousActiveHandlers = activeHandlers;
131
-
132
110
  if (Object.keys(deactivatedHandlers).length || hasChange(mergedIHandlerResult)) {
133
111
  _this.changes.push([mergedIHandlerResult, eventsInProgress, deactivatedHandlers]);
134
-
135
112
  _this.triggerRenderFrame();
136
113
  }
137
-
138
114
  if (Object.keys(activeHandlers).length || hasChange(mergedIHandlerResult)) {
139
115
  _this.map.stop(true);
140
116
  }
141
-
142
117
  _this.updatingCamera = false;
143
118
  var cameraAnimation = mergedIHandlerResult.cameraAnimation;
144
-
145
119
  if (cameraAnimation) {
146
120
  _this.inertia.clear();
147
-
148
121
  _this.fireEvents({}, {});
149
-
150
122
  _this.changes = [];
151
123
  cameraAnimation(_this.map);
152
124
  }
153
125
  });
154
-
155
126
  this.map = map;
156
127
  this.el = this.map.getCanvasContainer();
157
128
  this.handlers = [];
@@ -161,90 +132,75 @@ var HandlerManager = /*#__PURE__*/function () {
161
132
  this.bearingSnap = options.bearingSnap;
162
133
  this.rotateEnabled = options.rotateEnabled;
163
134
  this.pitchEnabled = options.pitchEnabled;
164
- this.previousActiveHandlers = {}; // Track whether map is currently moving, to compute start/move/end events
135
+ this.previousActiveHandlers = {};
165
136
 
137
+ // Track whether map is currently moving, to compute start/move/end events
166
138
  this.eventsInProgress = {};
167
139
  this.addDefaultHandlers(options);
168
140
  var el = this.el;
169
141
  this.listeners = [];
170
-
171
- if (!isMini) {
172
- // l7 - mini
173
- this.listeners = [// Bind touchstart and touchmove with passive: false because, even though
174
- // they only fire a map events and therefore could theoretically be
175
- // passive, binding with passive: true causes iOS not to respect
176
- // e.preventDefault() in _other_ handlers, even if they are non-passive
177
- // (see https://bugs.webkit.org/show_bug.cgi?id=184251)
178
- [el, 'touchstart', {
179
- passive: false
180
- }], [el, 'touchmove', {
181
- passive: false
182
- }], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined], // Bind window-level event listeners for move and up/end events. In the absence of
183
- // the pointer capture API, which is not supported by all necessary platforms,
184
- // window-level event listeners give us the best shot at capturing events that
185
- // fall outside the map canvas element. Use `{capture: true}` for the move event
186
- // to prevent map move events from being fired during a drag.
187
- // @ts-ignore
188
- [window.document, 'mousemove', {
189
- capture: true
190
- }], // @ts-ignore
191
- [window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
192
- capture: false
193
- }], [el, 'keyup', undefined], [el, 'wheel', {
194
- passive: false
195
- }], [el, 'contextmenu', undefined], // @ts-ignore
196
- [window, 'blur', undefined]];
197
-
198
- var _iterator2 = _createForOfIteratorHelper(this.listeners),
199
- _step2;
200
-
201
- try {
202
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
203
- var _step2$value = _slicedToArray(_step2.value, 3),
204
- target = _step2$value[0],
205
- type = _step2$value[1],
206
- listenerOptions = _step2$value[2];
207
-
208
- // @ts-ignore
209
- DOM.addEventListener(target, type, // @ts-ignore
210
- target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
211
- }
212
- } catch (err) {
213
- _iterator2.e(err);
214
- } finally {
215
- _iterator2.f();
216
- }
217
- } else {
218
- $window.document.addEventListener('touchstart', function (e) {
219
- _this.handleEvent(e);
220
- }, {});
221
- $window.document.addEventListener('touchmove', function (e) {
222
- _this.handleEvent(e);
223
- }, {});
224
- $window.document.addEventListener('touchend', function (e) {
225
- _this.handleEvent(e);
226
- }, {});
227
- $window.document.addEventListener('touchcancel', function (e) {
228
- _this.handleEvent(e);
229
- }, {});
142
+ // l7 - mini
143
+ this.listeners = [
144
+ // Bind touchstart and touchmove with passive: false because, even though
145
+ // they only fire a map events and therefore could theoretically be
146
+ // passive, binding with passive: true causes iOS not to respect
147
+ // e.preventDefault() in _other_ handlers, even if they are non-passive
148
+ // (see https://bugs.webkit.org/show_bug.cgi?id=184251)
149
+ [el, 'touchstart', {
150
+ passive: false
151
+ }], [el, 'touchmove', {
152
+ passive: false
153
+ }], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
154
+ // Bind window-level event listeners for move and up/end events. In the absence of
155
+ // the pointer capture API, which is not supported by all necessary platforms,
156
+ // window-level event listeners give us the best shot at capturing events that
157
+ // fall outside the map canvas element. Use `{capture: true}` for the move event
158
+ // to prevent map move events from being fired during a drag.
159
+ // @ts-ignore
160
+ [window.document, 'mousemove', {
161
+ capture: true
162
+ }],
163
+ // @ts-ignore
164
+ [window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
165
+ capture: false
166
+ }], [el, 'keyup', undefined], [el, 'wheel', {
167
+ passive: false
168
+ }], [el, 'contextmenu', undefined],
169
+ // @ts-ignore
170
+ [window, 'blur', undefined]];
171
+ var _iterator2 = _createForOfIteratorHelper(this.listeners),
172
+ _step2;
173
+ try {
174
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
175
+ var _step2$value = _slicedToArray(_step2.value, 3),
176
+ target = _step2$value[0],
177
+ type = _step2$value[1],
178
+ listenerOptions = _step2$value[2];
179
+ // @ts-ignore
180
+ DOM.addEventListener(target, type,
181
+ // @ts-ignore
182
+ target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
183
+ }
184
+ } catch (err) {
185
+ _iterator2.e(err);
186
+ } finally {
187
+ _iterator2.f();
230
188
  }
231
189
  }
232
-
233
190
  _createClass(HandlerManager, [{
234
191
  key: "destroy",
235
192
  value: function destroy() {
236
193
  var _iterator3 = _createForOfIteratorHelper(this.listeners),
237
- _step3;
238
-
194
+ _step3;
239
195
  try {
240
196
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
241
197
  var _step3$value = _slicedToArray(_step3.value, 3),
242
- target = _step3$value[0],
243
- type = _step3$value[1],
244
- listenerOptions = _step3$value[2];
245
-
198
+ target = _step3$value[0],
199
+ type = _step3$value[1],
200
+ listenerOptions = _step3$value[2];
201
+ // @ts-ignore
202
+ DOM.removeEventListener(target, type,
246
203
  // @ts-ignore
247
- DOM.removeEventListener(target, type, // @ts-ignore
248
204
  target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
249
205
  }
250
206
  } catch (err) {
@@ -260,10 +216,8 @@ var HandlerManager = /*#__PURE__*/function () {
260
216
  if (this.updatingCamera) {
261
217
  return;
262
218
  }
263
-
264
219
  var _iterator4 = _createForOfIteratorHelper(this.handlers),
265
- _step4;
266
-
220
+ _step4;
267
221
  try {
268
222
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
269
223
  var handler = _step4.value.handler;
@@ -274,7 +228,6 @@ var HandlerManager = /*#__PURE__*/function () {
274
228
  } finally {
275
229
  _iterator4.f();
276
230
  }
277
-
278
231
  this.inertia.clear();
279
232
  this.fireEvents({}, {});
280
233
  this.changes = [];
@@ -283,12 +236,10 @@ var HandlerManager = /*#__PURE__*/function () {
283
236
  key: "isActive",
284
237
  value: function isActive() {
285
238
  var _iterator5 = _createForOfIteratorHelper(this.handlers),
286
- _step5;
287
-
239
+ _step5;
288
240
  try {
289
241
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
290
242
  var handler = _step5.value.handler;
291
-
292
243
  if (handler.isActive()) {
293
244
  return true;
294
245
  }
@@ -298,7 +249,6 @@ var HandlerManager = /*#__PURE__*/function () {
298
249
  } finally {
299
250
  _iterator5.f();
300
251
  }
301
-
302
252
  return false;
303
253
  }
304
254
  }, {
@@ -322,25 +272,22 @@ var HandlerManager = /*#__PURE__*/function () {
322
272
  if (!HandlerResult) {
323
273
  return;
324
274
  }
325
-
326
275
  merge(mergedIHandlerResult, HandlerResult);
327
276
  var eventData = {
328
277
  handlerName: name,
329
278
  originalEvent: HandlerResult.originalEvent || e
330
- }; // track which handler changed which camera property
279
+ };
331
280
 
281
+ // track which handler changed which camera property
332
282
  if (HandlerResult.zoomDelta !== undefined) {
333
283
  eventsInProgress.zoom = eventData;
334
284
  }
335
-
336
285
  if (HandlerResult.panDelta !== undefined) {
337
286
  eventsInProgress.drag = eventData;
338
287
  }
339
-
340
288
  if (HandlerResult.pitchDelta !== undefined) {
341
289
  eventsInProgress.pitch = eventData;
342
290
  }
343
-
344
291
  if (HandlerResult.bearingDelta !== undefined) {
345
292
  eventsInProgress.rotate = eventData;
346
293
  }
@@ -349,16 +296,13 @@ var HandlerManager = /*#__PURE__*/function () {
349
296
  key: "triggerRenderFrame",
350
297
  value: function triggerRenderFrame() {
351
298
  var _this2 = this;
352
-
353
299
  if (this.frameId === undefined) {
354
300
  this.frameId = this.map.requestRenderFrame(function (timeStamp) {
355
301
  // @ts-ignore
356
302
  delete _this2.frameId;
357
-
358
303
  _this2.handleEvent(new RenderFrameEvent('renderFrame', {
359
304
  timeStamp: timeStamp
360
305
  }));
361
-
362
306
  _this2.applyChanges();
363
307
  });
364
308
  }
@@ -400,10 +344,8 @@ var HandlerManager = /*#__PURE__*/function () {
400
344
  var keyboard = map.keyboard = new KeyboardHandler();
401
345
  this.add('keyboard', keyboard);
402
346
  this.add('blockableMapEvent', new BlockableMapEventHandler(map));
403
-
404
347
  for (var _i = 0, _arr = ['boxZoom', 'doubleClickZoom', 'tapDragZoom', 'touchPitch', 'dragRotate', 'dragPan', 'touchZoomRotate', 'scrollZoom', 'keyboard']; _i < _arr.length; _i++) {
405
348
  var name = _arr[_i];
406
-
407
349
  // @ts-ignore
408
350
  if (options.interactive && options[name]) {
409
351
  // @ts-ignore
@@ -428,28 +370,23 @@ var HandlerManager = /*#__PURE__*/function () {
428
370
  if (name === myName) {
429
371
  continue;
430
372
  }
431
-
432
373
  if (!allowed || allowed.indexOf(name) < 0) {
433
374
  return true;
434
375
  }
435
376
  }
436
-
437
377
  return false;
438
378
  }
439
379
  }, {
440
380
  key: "getMapTouches",
441
381
  value: function getMapTouches(touches) {
442
382
  var mapTouches = [];
443
-
444
383
  var _iterator6 = _createForOfIteratorHelper(touches),
445
- _step6;
446
-
384
+ _step6;
447
385
  try {
448
386
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
449
387
  var t = _step6.value;
450
388
  var target = t.target;
451
-
452
- if (isMini || this.el.contains(target)) {
389
+ if (this.el.contains(target)) {
453
390
  mapTouches.push(t);
454
391
  }
455
392
  }
@@ -458,7 +395,6 @@ var HandlerManager = /*#__PURE__*/function () {
458
395
  } finally {
459
396
  _iterator6.f();
460
397
  }
461
-
462
398
  return mapTouches;
463
399
  }
464
400
  }, {
@@ -467,45 +403,35 @@ var HandlerManager = /*#__PURE__*/function () {
467
403
  var combined = {};
468
404
  var combinedEventsInProgress = {};
469
405
  var combinedDeactivatedHandlers = {};
470
-
471
406
  var _iterator7 = _createForOfIteratorHelper(this.changes),
472
- _step7;
473
-
407
+ _step7;
474
408
  try {
475
409
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
476
410
  var _step7$value = _slicedToArray(_step7.value, 3),
477
- change = _step7$value[0],
478
- eventsInProgress = _step7$value[1],
479
- deactivatedHandlers = _step7$value[2];
480
-
411
+ change = _step7$value[0],
412
+ eventsInProgress = _step7$value[1],
413
+ deactivatedHandlers = _step7$value[2];
481
414
  if (change.panDelta) {
482
415
  combined.panDelta = (combined.panDelta || new Point(0, 0))._add(change.panDelta);
483
416
  }
484
-
485
417
  if (change.zoomDelta) {
486
418
  combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;
487
419
  }
488
-
489
420
  if (change.bearingDelta) {
490
421
  combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;
491
422
  }
492
-
493
423
  if (change.pitchDelta) {
494
424
  combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;
495
425
  }
496
-
497
426
  if (change.around !== undefined) {
498
427
  combined.around = change.around;
499
428
  }
500
-
501
429
  if (change.pinchAround !== undefined) {
502
430
  combined.pinchAround = change.pinchAround;
503
431
  }
504
-
505
432
  if (change.noInertia) {
506
433
  combined.noInertia = change.noInertia;
507
434
  }
508
-
509
435
  merge(combinedEventsInProgress, eventsInProgress);
510
436
  merge(combinedDeactivatedHandlers, deactivatedHandlers);
511
437
  }
@@ -514,7 +440,6 @@ var HandlerManager = /*#__PURE__*/function () {
514
440
  } finally {
515
441
  _iterator7.f();
516
442
  }
517
-
518
443
  this.updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);
519
444
  this.changes = [];
520
445
  }
@@ -523,106 +448,84 @@ var HandlerManager = /*#__PURE__*/function () {
523
448
  value: function updateMapTransform(combinedResult, combinedEventsInProgress, deactivatedHandlers) {
524
449
  var map = this.map;
525
450
  var tr = map.transform;
526
-
527
451
  if (!hasChange(combinedResult)) {
528
452
  return this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
529
453
  }
530
-
531
454
  var panDelta = combinedResult.panDelta,
532
- zoomDelta = combinedResult.zoomDelta,
533
- bearingDelta = combinedResult.bearingDelta,
534
- pitchDelta = combinedResult.pitchDelta,
535
- pinchAround = combinedResult.pinchAround;
455
+ zoomDelta = combinedResult.zoomDelta,
456
+ bearingDelta = combinedResult.bearingDelta,
457
+ pitchDelta = combinedResult.pitchDelta,
458
+ pinchAround = combinedResult.pinchAround;
536
459
  var around = combinedResult.around;
537
-
538
460
  if (pinchAround !== undefined) {
539
461
  around = pinchAround;
540
- } // stop any ongoing camera animations (easeTo, flyTo)
541
-
462
+ }
542
463
 
464
+ // stop any ongoing camera animations (easeTo, flyTo)
543
465
  map.stop(true);
544
466
  around = around || map.transform.centerPoint;
545
467
  var loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);
546
-
547
468
  if (bearingDelta && this.rotateEnabled) {
548
469
  tr.bearing += bearingDelta;
549
470
  }
550
-
551
471
  if (pitchDelta && this.pitchEnabled) {
552
472
  tr.pitch += pitchDelta;
553
473
  }
554
-
555
474
  if (zoomDelta) {
556
475
  tr.zoom += zoomDelta;
557
476
  }
558
-
559
477
  tr.setLocationAtPoint(loc, around);
560
478
  this.map.update();
561
-
562
479
  if (!combinedResult.noInertia) {
563
480
  this.inertia.record(combinedResult);
564
481
  }
565
-
566
482
  this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
567
483
  }
568
484
  }, {
569
485
  key: "fireEvents",
570
486
  value: function fireEvents(newEventsInProgress, deactivatedHandlers) {
571
487
  var _this3 = this;
572
-
573
488
  var wasMoving = _isMoving(this.eventsInProgress);
574
-
575
489
  var nowMoving = _isMoving(newEventsInProgress);
576
-
577
490
  var startEvents = {};
578
-
579
491
  for (var eventName in newEventsInProgress) {
580
492
  if (newEventsInProgress[eventName]) {
581
493
  var originalEvent = newEventsInProgress[eventName].originalEvent;
582
-
583
494
  if (!this.eventsInProgress[eventName]) {
584
495
  startEvents["".concat(eventName, "start")] = originalEvent;
585
496
  }
586
-
587
497
  this.eventsInProgress[eventName] = newEventsInProgress[eventName];
588
498
  }
589
- } // fire start events only after this.eventsInProgress has been updated
590
-
499
+ }
591
500
 
501
+ // fire start events only after this.eventsInProgress has been updated
592
502
  if (!wasMoving && nowMoving) {
593
503
  this.fireEvent('movestart', nowMoving.originalEvent);
594
504
  }
595
-
596
505
  for (var name in startEvents) {
597
506
  if (startEvents[name]) {
598
507
  this.fireEvent(name, startEvents[name]);
599
508
  }
600
509
  }
601
-
602
510
  if (newEventsInProgress.rotate) {
603
511
  this.bearingChanged = true;
604
512
  }
605
-
606
513
  if (nowMoving) {
607
514
  this.fireEvent('move', nowMoving.originalEvent);
608
515
  }
609
-
610
516
  for (var _eventName in newEventsInProgress) {
611
517
  if (newEventsInProgress[_eventName]) {
612
518
  var _originalEvent = newEventsInProgress[_eventName].originalEvent;
613
519
  this.fireEvent(_eventName, _originalEvent);
614
520
  }
615
521
  }
616
-
617
522
  var endEvents = {};
618
523
  var originalEndEvent;
619
-
620
524
  for (var _eventName2 in this.eventsInProgress) {
621
525
  if (this.eventsInProgress[_eventName2]) {
622
526
  var _this$eventsInProgres = this.eventsInProgress[_eventName2],
623
- handlerName = _this$eventsInProgres.handlerName,
624
- _originalEvent2 = _this$eventsInProgres.originalEvent;
625
-
527
+ handlerName = _this$eventsInProgres.handlerName,
528
+ _originalEvent2 = _this$eventsInProgres.originalEvent;
626
529
  if (!this.handlersById[handlerName].isActive()) {
627
530
  delete this.eventsInProgress[_eventName2];
628
531
  originalEndEvent = deactivatedHandlers[handlerName] || _originalEvent2;
@@ -630,28 +533,22 @@ var HandlerManager = /*#__PURE__*/function () {
630
533
  }
631
534
  }
632
535
  }
633
-
634
536
  for (var _name in endEvents) {
635
537
  if (endEvents[_name]) {
636
538
  this.fireEvent(_name, endEvents[_name]);
637
539
  }
638
540
  }
639
-
640
541
  var stillMoving = _isMoving(this.eventsInProgress);
641
-
642
542
  if ((wasMoving || nowMoving) && !stillMoving) {
643
543
  this.updatingCamera = true;
644
544
  var inertialEase = this.inertia.onMoveEnd(this.map.dragPan.inertiaOptions);
645
-
646
545
  var shouldSnapToNorth = function shouldSnapToNorth(bearing) {
647
546
  return bearing !== 0 && -_this3.bearingSnap < bearing && bearing < _this3.bearingSnap;
648
547
  };
649
-
650
548
  if (inertialEase) {
651
549
  if (shouldSnapToNorth(inertialEase.bearing || this.map.getBearing())) {
652
550
  inertialEase.bearing = 0;
653
551
  }
654
-
655
552
  this.map.easeTo(inertialEase, {
656
553
  originalEvent: originalEndEvent
657
554
  });
@@ -659,12 +556,10 @@ var HandlerManager = /*#__PURE__*/function () {
659
556
  this.map.emit('moveend', new Event('moveend', {
660
557
  originalEvent: originalEndEvent
661
558
  }));
662
-
663
559
  if (shouldSnapToNorth(this.map.getBearing())) {
664
560
  this.map.resetNorth();
665
561
  }
666
562
  }
667
-
668
563
  this.bearingChanged = false;
669
564
  this.updatingCamera = false;
670
565
  }
@@ -677,8 +572,6 @@ var HandlerManager = /*#__PURE__*/function () {
677
572
  } : {}));
678
573
  }
679
574
  }]);
680
-
681
575
  return HandlerManager;
682
576
  }();
683
-
684
577
  export default HandlerManager;
@@ -1,10 +1,9 @@
1
1
  // @ts-ignore
2
+
2
3
  export function indexTouches(touches, points) {
3
4
  var obj = {};
4
-
5
5
  for (var i = 0; i < touches.length; i++) {
6
6
  obj[touches[i].identifier] = points[i];
7
7
  }
8
-
9
8
  return obj;
10
9
  }