@antv/l7-map 2.9.33 → 2.9.35

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