@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,33 +1,38 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
9
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
10
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
+
11
16
  var _lng_lat = _interopRequireDefault(require("../geo/lng_lat"));
17
+
12
18
  var _util = require("../util");
19
+
13
20
  var _dom = _interopRequireDefault(require("../utils/dom"));
14
- // @ts-ignore
15
21
 
22
+ // @ts-ignore
16
23
  // deltaY value for mouse scroll wheel identification
17
- var wheelZoomDelta = 4.000244140625;
18
-
19
- // These magic numbers control the rate of zoom. Trackpad events fire at a greater
24
+ var wheelZoomDelta = 4.000244140625; // These magic numbers control the rate of zoom. Trackpad events fire at a greater
20
25
  // frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick
21
- var defaultZoomRate = 1 / 100;
22
- var wheelZoomRate = 1 / 450;
23
26
 
24
- // upper bound on how much we scale the map in any single render frame; this
27
+ var defaultZoomRate = 1 / 100;
28
+ var wheelZoomRate = 1 / 450; // upper bound on how much we scale the map in any single render frame; this
25
29
  // is used to limit zoom rate in the case of very fast scrolling
26
- var maxScalePerFrame = 2;
27
30
 
31
+ var maxScalePerFrame = 2;
28
32
  /**
29
33
  * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.
30
34
  */
35
+
31
36
  var ScrollZoomHandler = /*#__PURE__*/function () {
32
37
  // used for delayed-handling of a single wheel movement
33
38
  // used to delay final '{move,zoom}end' events
@@ -37,48 +42,56 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
37
42
  */
38
43
  function ScrollZoomHandler(map, handler) {
39
44
  var _this = this;
45
+
40
46
  (0, _classCallCheck2.default)(this, ScrollZoomHandler);
41
47
  (0, _defineProperty2.default)(this, "onScrollFrame", function () {
42
48
  if (!_this.frameId) {
43
49
  return;
44
50
  }
51
+
45
52
  _this.frameId = null;
53
+
46
54
  if (!_this.isActive()) {
47
55
  return;
48
56
  }
49
- var tr = _this.map.transform;
50
57
 
51
- // if we've had scroll events since the last render frame, consume the
58
+ var tr = _this.map.transform; // if we've had scroll events since the last render frame, consume the
52
59
  // accumulated delta, and update the target zoom level accordingly
60
+
53
61
  if (_this.delta !== 0) {
54
62
  // For trackpad events and single mouse wheel ticks, use the default zoom rate
55
- var zoomRate = _this.type === 'wheel' && Math.abs(_this.delta) > wheelZoomDelta ? _this.wheelZoomRate : _this.defaultZoomRate;
56
- // Scale by sigmoid of scroll wheel delta.
63
+ var zoomRate = _this.type === 'wheel' && Math.abs(_this.delta) > wheelZoomDelta ? _this.wheelZoomRate : _this.defaultZoomRate; // Scale by sigmoid of scroll wheel delta.
64
+
57
65
  var scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(_this.delta * zoomRate)));
66
+
58
67
  if (_this.delta < 0 && scale !== 0) {
59
68
  scale = 1 / scale;
60
69
  }
61
- var fromScale = typeof _this.targetZoom === 'number' ? tr.zoomScale(_this.targetZoom) : tr.scale;
62
- _this.targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));
63
70
 
64
- // if this is a mouse wheel, refresh the starting zoom and easing
71
+ var fromScale = typeof _this.targetZoom === 'number' ? tr.zoomScale(_this.targetZoom) : tr.scale;
72
+ _this.targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale))); // if this is a mouse wheel, refresh the starting zoom and easing
65
73
  // function we're using to smooth out the zooming between wheel
66
74
  // events
75
+
67
76
  if (_this.type === 'wheel') {
68
77
  _this.startZoom = tr.zoom;
69
78
  _this.easing = _this.smoothOutEasing(200);
70
79
  }
80
+
71
81
  _this.delta = 0;
72
82
  }
83
+
73
84
  var targetZoom = typeof _this.targetZoom === 'number' ? _this.targetZoom : tr.zoom;
74
85
  var startZoom = _this.startZoom;
75
86
  var easing = _this.easing;
76
87
  var finished = false;
77
88
  var zoom;
89
+
78
90
  if (_this.type === 'wheel' && startZoom && easing) {
79
91
  var t = Math.min(((0, _util.now)() - _this.lastWheelEventTime) / 200, 1);
80
92
  var k = easing(t);
81
93
  zoom = (0, _util.interpolate)(startZoom, targetZoom, k);
94
+
82
95
  if (t < 1) {
83
96
  if (!_this.frameId) {
84
97
  _this.frameId = true;
@@ -90,19 +103,24 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
90
103
  zoom = targetZoom;
91
104
  finished = true;
92
105
  }
106
+
93
107
  _this.active = true;
108
+
94
109
  if (finished) {
95
- _this.active = false;
96
- // @ts-ignore
110
+ _this.active = false; // @ts-ignore
111
+
97
112
  _this.finishTimeout = setTimeout(function () {
98
113
  _this.zooming = false;
99
- _this.handler.triggerRenderFrame();
100
- // @ts-ignore
101
- delete _this.targetZoom;
102
- // @ts-ignore
114
+
115
+ _this.handler.triggerRenderFrame(); // @ts-ignore
116
+
117
+
118
+ delete _this.targetZoom; // @ts-ignore
119
+
103
120
  delete _this.finishTimeout;
104
121
  }, 200);
105
122
  }
123
+
106
124
  return {
107
125
  noInertia: true,
108
126
  needsRenderFrame: !finished,
@@ -118,7 +136,6 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
118
136
  this.defaultZoomRate = defaultZoomRate;
119
137
  this.wheelZoomRate = wheelZoomRate;
120
138
  }
121
-
122
139
  /**
123
140
  * Set the zoom rate of a trackpad
124
141
  * @param {number} [zoomRate=1/100] The rate used to scale trackpad movement to a zoom value.
@@ -126,12 +143,13 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
126
143
  * // Speed up trackpad zoom
127
144
  * map.scrollZoom.setZoomRate(1/25);
128
145
  */
146
+
147
+
129
148
  (0, _createClass2.default)(ScrollZoomHandler, [{
130
149
  key: "setZoomRate",
131
150
  value: function setZoomRate(zoomRate) {
132
151
  this.defaultZoomRate = zoomRate;
133
152
  }
134
-
135
153
  /**
136
154
  * Set the zoom rate of a mouse wheel
137
155
  * @param {number} [wheelZoomRate=1/450] The rate used to scale mouse wheel movement to a zoom value.
@@ -139,28 +157,29 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
139
157
  * // Slow down zoom of mouse wheel
140
158
  * map.scrollZoom.setWheelZoomRate(1/600);
141
159
  */
160
+
142
161
  }, {
143
162
  key: "setWheelZoomRate",
144
163
  value: function setWheelZoomRate(zoomRate) {
145
164
  this.wheelZoomRate = zoomRate;
146
165
  }
147
-
148
166
  /**
149
167
  * Returns a Boolean indicating whether the "scroll to zoom" interaction is enabled.
150
168
  *
151
169
  * @returns {boolean} `true` if the "scroll to zoom" interaction is enabled.
152
170
  */
171
+
153
172
  }, {
154
173
  key: "isEnabled",
155
174
  value: function isEnabled() {
156
175
  return !!this.enabled;
157
176
  }
158
-
159
177
  /*
160
178
  * Active state is turned on and off with every scroll wheel event and is set back to false before the map
161
179
  * render is called, so _active is not a good candidate for determining if a scroll zoom animation is in
162
180
  * progress.
163
181
  */
182
+
164
183
  }, {
165
184
  key: "isActive",
166
185
  value: function isActive() {
@@ -171,7 +190,6 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
171
190
  value: function isZooming() {
172
191
  return !!this.zooming;
173
192
  }
174
-
175
193
  /**
176
194
  * Enables the "scroll to zoom" interaction.
177
195
  *
@@ -183,28 +201,31 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
183
201
  * @example
184
202
  * map.scrollZoom.enable({ around: 'center' })
185
203
  */
204
+
186
205
  }, {
187
206
  key: "enable",
188
207
  value: function enable(options) {
189
208
  if (this.isEnabled()) {
190
209
  return;
191
210
  }
211
+
192
212
  this.enabled = true;
193
213
  this.aroundCenter = options && options.around === 'center';
194
214
  }
195
-
196
215
  /**
197
216
  * Disables the "scroll to zoom" interaction.
198
217
  *
199
218
  * @example
200
219
  * map.scrollZoom.disable();
201
220
  */
221
+
202
222
  }, {
203
223
  key: "disable",
204
224
  value: function disable() {
205
225
  if (!this.isEnabled()) {
206
226
  return;
207
227
  }
228
+
208
229
  this.enabled = false;
209
230
  }
210
231
  }, {
@@ -212,12 +233,14 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
212
233
  value: function wheel(e) {
213
234
  if (!this.isEnabled()) {
214
235
  return;
215
- }
216
- // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.
236
+ } // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.
237
+
238
+
217
239
  var value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
218
240
  var nowTime = (0, _util.now)();
219
241
  var timeDelta = nowTime - (this.lastWheelEventTime || 0);
220
242
  this.lastWheelEventTime = nowTime;
243
+
221
244
  if (value !== 0 && value % wheelZoomDelta === 0) {
222
245
  // This one is definitely a mouse wheel event.
223
246
  this.type = 'wheel';
@@ -227,37 +250,38 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
227
250
  } else if (timeDelta > 400) {
228
251
  // This is likely a new scroll action.
229
252
  this.type = null;
230
- this.lastValue = value;
231
-
232
- // Start a timeout in case this was a singular event, and dely it by up to 40ms.
253
+ this.lastValue = value; // Start a timeout in case this was a singular event, and dely it by up to 40ms.
233
254
  // @ts-ignore
255
+
234
256
  this.timeout = setTimeout(this.onTimeout, 40, e);
235
257
  } else if (!this.type) {
236
258
  // This is a repeating event, but we don't know the type of event just yet.
237
259
  // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode.
238
- this.type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel';
239
-
240
- // Make sure our delayed event isn't fired again, because we accumulate
260
+ this.type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel'; // Make sure our delayed event isn't fired again, because we accumulate
241
261
  // the previous event (which was less than 40ms ago) into this event.
262
+
242
263
  if (this.timeout) {
243
264
  clearTimeout(this.timeout);
244
265
  this.timeout = null;
245
266
  value += this.lastValue;
246
267
  }
247
- }
268
+ } // Slow down zoom if shift key is held for more precise zooming
269
+
248
270
 
249
- // Slow down zoom if shift key is held for more precise zooming
250
271
  if (e.shiftKey && value) {
251
272
  value = value / 4;
252
- }
253
- // Only fire the callback if we actually know what type of scrolling device the user uses.
273
+ } // Only fire the callback if we actually know what type of scrolling device the user uses.
274
+
275
+
254
276
  if (this.type) {
255
277
  this.lastWheelEvent = e;
256
278
  this.delta -= value;
279
+
257
280
  if (!this.active) {
258
281
  this.start(e);
259
282
  }
260
283
  }
284
+
261
285
  e.preventDefault();
262
286
  }
263
287
  }, {
@@ -275,6 +299,7 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
275
299
  value: function onTimeout(initialEvent) {
276
300
  this.type = 'wheel';
277
301
  this.delta -= this.lastValue;
302
+
278
303
  if (!this.active && this.start) {
279
304
  this.start(initialEvent);
280
305
  }
@@ -285,21 +310,28 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
285
310
  if (!this.delta) {
286
311
  return;
287
312
  }
313
+
288
314
  if (this.frameId) {
289
315
  this.frameId = null;
290
316
  }
317
+
291
318
  this.active = true;
319
+
292
320
  if (!this.isZooming()) {
293
321
  this.zooming = true;
294
322
  }
323
+
295
324
  if (this.finishTimeout) {
296
- clearTimeout(this.finishTimeout);
297
- // @ts-ignore
325
+ clearTimeout(this.finishTimeout); // @ts-ignore
326
+
298
327
  delete this.finishTimeout;
299
328
  }
329
+
300
330
  var pos = _dom.default.mousePos(this.el, e);
331
+
301
332
  this.around = _lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
302
333
  this.aroundPoint = this.map.transform.locationPoint(this.around);
334
+
303
335
  if (!this.frameId) {
304
336
  this.frameId = true;
305
337
  this.handler.triggerRenderFrame();
@@ -309,16 +341,17 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
309
341
  key: "smoothOutEasing",
310
342
  value: function smoothOutEasing(duration) {
311
343
  var easing = _util.ease;
344
+
312
345
  if (this.prevEase) {
313
346
  var preEase = this.prevEase;
314
347
  var t = ((0, _util.now)() - preEase.start) / preEase.duration;
315
- var speed = preEase.easing(t + 0.01) - preEase.easing(t);
348
+ var speed = preEase.easing(t + 0.01) - preEase.easing(t); // Quick hack to make new bezier that is continuous with last
316
349
 
317
- // Quick hack to make new bezier that is continuous with last
318
350
  var x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01;
319
351
  var y = Math.sqrt(0.27 * 0.27 - x * x);
320
352
  easing = (0, _util.bezier)(x, y, 0.25, 1);
321
353
  }
354
+
322
355
  this.prevEase = {
323
356
  start: (0, _util.now)(),
324
357
  duration: duration,
@@ -329,5 +362,6 @@ var ScrollZoomHandler = /*#__PURE__*/function () {
329
362
  }]);
330
363
  return ScrollZoomHandler;
331
364
  }();
365
+
332
366
  var _default = ScrollZoomHandler;
333
367
  exports.default = _default;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
9
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
10
14
  /**
11
15
  * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by
12
16
  * double clicking or double tapping.
@@ -20,49 +24,50 @@ var DoubleClickZoomHandler = /*#__PURE__*/function () {
20
24
  this.clickZoom = clickZoom;
21
25
  this.tapZoom = TapZoom;
22
26
  }
23
-
24
27
  /**
25
28
  * Enables the "double click to zoom" interaction.
26
29
  *
27
30
  * @example
28
31
  * map.doubleClickZoom.enable();
29
32
  */
33
+
34
+
30
35
  (0, _createClass2.default)(DoubleClickZoomHandler, [{
31
36
  key: "enable",
32
37
  value: function enable() {
33
38
  this.clickZoom.enable();
34
39
  this.tapZoom.enable();
35
40
  }
36
-
37
41
  /**
38
42
  * Disables the "double click to zoom" interaction.
39
43
  *
40
44
  * @example
41
45
  * map.doubleClickZoom.disable();
42
46
  */
47
+
43
48
  }, {
44
49
  key: "disable",
45
50
  value: function disable() {
46
51
  this.clickZoom.disable();
47
52
  this.tapZoom.disable();
48
53
  }
49
-
50
54
  /**
51
55
  * Returns a Boolean indicating whether the "double click to zoom" interaction is enabled.
52
56
  *
53
57
  * @returns {boolean} `true` if the "double click to zoom" interaction is enabled.
54
58
  */
59
+
55
60
  }, {
56
61
  key: "isEnabled",
57
62
  value: function isEnabled() {
58
63
  return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
59
64
  }
60
-
61
65
  /**
62
66
  * Returns a Boolean indicating whether the "double click to zoom" interaction is active, i.e. currently being used.
63
67
  *
64
68
  * @returns {boolean} `true` if the "double click to zoom" interaction is active.
65
69
  */
70
+
66
71
  }, {
67
72
  key: "isActive",
68
73
  value: function isActive() {
@@ -71,4 +76,5 @@ var DoubleClickZoomHandler = /*#__PURE__*/function () {
71
76
  }]);
72
77
  return DoubleClickZoomHandler;
73
78
  }();
79
+
74
80
  exports.default = DoubleClickZoomHandler;
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
9
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
10
14
  var _l7Utils = require("@antv/l7-utils");
15
+
11
16
  /**
12
17
  * The `DragPanHandler` allows the user to pan the map by clicking and dragging
13
18
  * the cursor.
@@ -22,7 +27,6 @@ var DragPanHandler = /*#__PURE__*/function () {
22
27
  this.mousePan = mousePan;
23
28
  this.touchPan = touchPan;
24
29
  }
25
-
26
30
  /**
27
31
  * Enables the "drag to pan" interaction.
28
32
  *
@@ -42,49 +46,53 @@ var DragPanHandler = /*#__PURE__*/function () {
42
46
  * deceleration: 2500,
43
47
  * });
44
48
  */
49
+
50
+
45
51
  (0, _createClass2.default)(DragPanHandler, [{
46
52
  key: "enable",
47
53
  value: function enable(options) {
48
54
  this.inertiaOptions = options || {};
49
55
  this.mousePan.enable();
50
56
  this.touchPan.enable();
57
+
51
58
  if (!_l7Utils.isMini) {
52
59
  this.el.classList.add('l7-touch-drag-pan');
53
60
  }
54
61
  }
55
-
56
62
  /**
57
63
  * Disables the "drag to pan" interaction.
58
64
  *
59
65
  * @example
60
66
  * map.dragPan.disable();
61
67
  */
68
+
62
69
  }, {
63
70
  key: "disable",
64
71
  value: function disable() {
65
72
  this.mousePan.disable();
66
73
  this.touchPan.disable();
74
+
67
75
  if (!_l7Utils.isMini) {
68
76
  this.el.classList.remove('l7-touch-drag-pan');
69
77
  }
70
78
  }
71
-
72
79
  /**
73
80
  * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
74
81
  *
75
82
  * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
76
83
  */
84
+
77
85
  }, {
78
86
  key: "isEnabled",
79
87
  value: function isEnabled() {
80
88
  return this.mousePan.isEnabled() && this.touchPan.isEnabled();
81
89
  }
82
-
83
90
  /**
84
91
  * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
85
92
  *
86
93
  * @returns {boolean} `true` if the "drag to pan" interaction is active.
87
94
  */
95
+
88
96
  }, {
89
97
  key: "isActive",
90
98
  value: function isActive() {
@@ -93,4 +101,5 @@ var DragPanHandler = /*#__PURE__*/function () {
93
101
  }]);
94
102
  return DragPanHandler;
95
103
  }();
104
+
96
105
  exports.default = DragPanHandler;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
9
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
10
14
  /**
11
15
  * The `DragRotateHandler` allows the user to rotate the map by clicking and
12
16
  * dragging the cursor while holding the right mouse button or `ctrl` key.
@@ -25,51 +29,53 @@ var DragRotateHandler = /*#__PURE__*/function () {
25
29
  this.mouseRotate = mouseRotate;
26
30
  this.mousePitch = mousePitch;
27
31
  }
28
-
29
32
  /**
30
33
  * Enables the "drag to rotate" interaction.
31
34
  *
32
35
  * @example
33
36
  * map.dragRotate.enable();
34
37
  */
38
+
39
+
35
40
  (0, _createClass2.default)(DragRotateHandler, [{
36
41
  key: "enable",
37
42
  value: function enable() {
38
43
  this.mouseRotate.enable();
44
+
39
45
  if (this.pitchWithRotate) {
40
46
  this.mousePitch.enable();
41
47
  }
42
48
  }
43
-
44
49
  /**
45
50
  * Disables the "drag to rotate" interaction.
46
51
  *
47
52
  * @example
48
53
  * map.dragRotate.disable();
49
54
  */
55
+
50
56
  }, {
51
57
  key: "disable",
52
58
  value: function disable() {
53
59
  this.mouseRotate.disable();
54
60
  this.mousePitch.disable();
55
61
  }
56
-
57
62
  /**
58
63
  * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
59
64
  *
60
65
  * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
61
66
  */
67
+
62
68
  }, {
63
69
  key: "isEnabled",
64
70
  value: function isEnabled() {
65
71
  return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
66
72
  }
67
-
68
73
  /**
69
74
  * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
70
75
  *
71
76
  * @returns {boolean} `true` if the "drag to rotate" interaction is active.
72
77
  */
78
+
73
79
  }, {
74
80
  key: "isActive",
75
81
  value: function isActive() {
@@ -78,4 +84,5 @@ var DragRotateHandler = /*#__PURE__*/function () {
78
84
  }]);
79
85
  return DragRotateHandler;
80
86
  }();
87
+
81
88
  exports.default = DragRotateHandler;