@antv/l7-map 2.18.0 → 2.18.2

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 (168) hide show
  1. package/package.json +3 -3
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -718
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -369
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -108
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -73
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -154
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -84
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -224
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -87
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -961
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -78
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -180
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -54
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -11
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -64
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -95
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -50
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -26
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -157
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -577
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -9
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -143
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -125
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -118
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -44
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -46
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -46
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -11
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -325
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -67
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -84
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -74
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -115
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -97
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -106
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -54
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -109
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -110
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -93
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -77
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -54
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -125
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -134
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -387
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -88
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -112
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -140
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -47
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -89
  113. package/lib/camera.js +0 -724
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -376
  116. package/lib/geo/edge_insets.js +0 -114
  117. package/lib/geo/lng_lat.js +0 -81
  118. package/lib/geo/lng_lat_bounds.js +0 -161
  119. package/lib/geo/mercator.js +0 -100
  120. package/lib/geo/point.js +0 -231
  121. package/lib/geo/simple.js +0 -104
  122. package/lib/geo/transform.js +0 -971
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -84
  125. package/lib/handler/box_zoom.js +0 -186
  126. package/lib/handler/click_zoom.js +0 -61
  127. package/lib/handler/events/event.js +0 -20
  128. package/lib/handler/events/index.js +0 -27
  129. package/lib/handler/events/map_mouse_event.js +0 -70
  130. package/lib/handler/events/map_touch_event.js +0 -100
  131. package/lib/handler/events/map_wheel_event.js +0 -57
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -162
  134. package/lib/handler/handler_manager.js +0 -584
  135. package/lib/handler/handler_util.js +0 -15
  136. package/lib/handler/keyboard.js +0 -151
  137. package/lib/handler/map_event.js +0 -131
  138. package/lib/handler/mouse/index.js +0 -27
  139. package/lib/handler/mouse/mouse_handler.js +0 -124
  140. package/lib/handler/mouse/mousepan_handler.js +0 -49
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -51
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -51
  143. package/lib/handler/mouse/util.js +0 -22
  144. package/lib/handler/scroll_zoom.js +0 -333
  145. package/lib/handler/shim/dblclick_zoom.js +0 -74
  146. package/lib/handler/shim/drag_pan.js +0 -91
  147. package/lib/handler/shim/drag_rotate.js +0 -81
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -122
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -106
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -112
  151. package/lib/handler/tap/tap_recognizer.js +0 -63
  152. package/lib/handler/tap/tap_zoom.js +0 -115
  153. package/lib/handler/touch/index.js +0 -34
  154. package/lib/handler/touch/touch_pan.js +0 -117
  155. package/lib/handler/touch/touch_pitch.js +0 -98
  156. package/lib/handler/touch/touch_rotate.js +0 -82
  157. package/lib/handler/touch/touch_zoom.js +0 -59
  158. package/lib/handler/touch/two_touch.js +0 -131
  159. package/lib/hash.js +0 -143
  160. package/lib/index.js +0 -49
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -394
  163. package/lib/util.js +0 -108
  164. package/lib/utils/Aabb.js +0 -119
  165. package/lib/utils/dom.js +0 -147
  166. package/lib/utils/performance.js +0 -70
  167. package/lib/utils/primitives.js +0 -54
  168. package/lib/utils/task_queue.js +0 -97
@@ -1,333 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _lng_lat = _interopRequireDefault(require("../geo/lng_lat"));
12
- var _util = require("../util");
13
- var _dom = _interopRequireDefault(require("../utils/dom"));
14
- // @ts-ignore
15
-
16
- // 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
20
- // frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick
21
- var defaultZoomRate = 1 / 100;
22
- var wheelZoomRate = 1 / 450;
23
-
24
- // upper bound on how much we scale the map in any single render frame; this
25
- // is used to limit zoom rate in the case of very fast scrolling
26
- var maxScalePerFrame = 2;
27
-
28
- /**
29
- * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.
30
- */
31
- var ScrollZoomHandler = /*#__PURE__*/function () {
32
- // used for delayed-handling of a single wheel movement
33
- // used to delay final '{move,zoom}end' events
34
-
35
- /**
36
- * @private
37
- */
38
- function ScrollZoomHandler(map, handler) {
39
- var _this = this;
40
- (0, _classCallCheck2.default)(this, ScrollZoomHandler);
41
- (0, _defineProperty2.default)(this, "onScrollFrame", function () {
42
- if (!_this.frameId) {
43
- return;
44
- }
45
- _this.frameId = null;
46
- if (!_this.isActive()) {
47
- return;
48
- }
49
- var tr = _this.map.transform;
50
-
51
- // if we've had scroll events since the last render frame, consume the
52
- // accumulated delta, and update the target zoom level accordingly
53
- if (_this.delta !== 0) {
54
- // 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.
57
- var scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(_this.delta * zoomRate)));
58
- if (_this.delta < 0 && scale !== 0) {
59
- scale = 1 / scale;
60
- }
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
-
64
- // if this is a mouse wheel, refresh the starting zoom and easing
65
- // function we're using to smooth out the zooming between wheel
66
- // events
67
- if (_this.type === 'wheel') {
68
- _this.startZoom = tr.zoom;
69
- _this.easing = _this.smoothOutEasing(200);
70
- }
71
- _this.delta = 0;
72
- }
73
- var targetZoom = typeof _this.targetZoom === 'number' ? _this.targetZoom : tr.zoom;
74
- var startZoom = _this.startZoom;
75
- var easing = _this.easing;
76
- var finished = false;
77
- var zoom;
78
- if (_this.type === 'wheel' && startZoom && easing) {
79
- var t = Math.min(((0, _util.now)() - _this.lastWheelEventTime) / 200, 1);
80
- var k = easing(t);
81
- zoom = (0, _util.interpolate)(startZoom, targetZoom, k);
82
- if (t < 1) {
83
- if (!_this.frameId) {
84
- _this.frameId = true;
85
- }
86
- } else {
87
- finished = true;
88
- }
89
- } else {
90
- zoom = targetZoom;
91
- finished = true;
92
- }
93
- _this.active = true;
94
- if (finished) {
95
- _this.active = false;
96
- // @ts-ignore
97
- _this.finishTimeout = setTimeout(function () {
98
- _this.zooming = false;
99
- _this.handler.triggerRenderFrame();
100
- // @ts-ignore
101
- delete _this.targetZoom;
102
- // @ts-ignore
103
- delete _this.finishTimeout;
104
- }, 200);
105
- }
106
- return {
107
- noInertia: true,
108
- needsRenderFrame: !finished,
109
- zoomDelta: zoom - tr.zoom,
110
- around: _this.aroundPoint,
111
- originalEvent: _this.lastWheelEvent
112
- };
113
- });
114
- this.map = map;
115
- this.el = map.getCanvasContainer();
116
- this.handler = handler;
117
- this.delta = 0;
118
- this.defaultZoomRate = defaultZoomRate;
119
- this.wheelZoomRate = wheelZoomRate;
120
- }
121
-
122
- /**
123
- * Set the zoom rate of a trackpad
124
- * @param {number} [zoomRate=1/100] The rate used to scale trackpad movement to a zoom value.
125
- * @example
126
- * // Speed up trackpad zoom
127
- * map.scrollZoom.setZoomRate(1/25);
128
- */
129
- (0, _createClass2.default)(ScrollZoomHandler, [{
130
- key: "setZoomRate",
131
- value: function setZoomRate(zoomRate) {
132
- this.defaultZoomRate = zoomRate;
133
- }
134
-
135
- /**
136
- * Set the zoom rate of a mouse wheel
137
- * @param {number} [wheelZoomRate=1/450] The rate used to scale mouse wheel movement to a zoom value.
138
- * @example
139
- * // Slow down zoom of mouse wheel
140
- * map.scrollZoom.setWheelZoomRate(1/600);
141
- */
142
- }, {
143
- key: "setWheelZoomRate",
144
- value: function setWheelZoomRate(zoomRate) {
145
- this.wheelZoomRate = zoomRate;
146
- }
147
-
148
- /**
149
- * Returns a Boolean indicating whether the "scroll to zoom" interaction is enabled.
150
- *
151
- * @returns {boolean} `true` if the "scroll to zoom" interaction is enabled.
152
- */
153
- }, {
154
- key: "isEnabled",
155
- value: function isEnabled() {
156
- return !!this.enabled;
157
- }
158
-
159
- /*
160
- * Active state is turned on and off with every scroll wheel event and is set back to false before the map
161
- * render is called, so _active is not a good candidate for determining if a scroll zoom animation is in
162
- * progress.
163
- */
164
- }, {
165
- key: "isActive",
166
- value: function isActive() {
167
- return !!this.active || this.finishTimeout !== undefined;
168
- }
169
- }, {
170
- key: "isZooming",
171
- value: function isZooming() {
172
- return !!this.zooming;
173
- }
174
-
175
- /**
176
- * Enables the "scroll to zoom" interaction.
177
- *
178
- * @param {Object} [options] Options object.
179
- * @param {string} [options.around] If "center" is passed, map will zoom around center of map
180
- *
181
- * @example
182
- * map.scrollZoom.enable();
183
- * @example
184
- * map.scrollZoom.enable({ around: 'center' })
185
- */
186
- }, {
187
- key: "enable",
188
- value: function enable(options) {
189
- if (this.isEnabled()) {
190
- return;
191
- }
192
- this.enabled = true;
193
- this.aroundCenter = options && options.around === 'center';
194
- }
195
-
196
- /**
197
- * Disables the "scroll to zoom" interaction.
198
- *
199
- * @example
200
- * map.scrollZoom.disable();
201
- */
202
- }, {
203
- key: "disable",
204
- value: function disable() {
205
- if (!this.isEnabled()) {
206
- return;
207
- }
208
- this.enabled = false;
209
- }
210
- }, {
211
- key: "wheel",
212
- value: function wheel(e) {
213
- if (!this.isEnabled()) {
214
- return;
215
- }
216
- // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.
217
- var value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
218
- var nowTime = (0, _util.now)();
219
- var timeDelta = nowTime - (this.lastWheelEventTime || 0);
220
- this.lastWheelEventTime = nowTime;
221
- if (value !== 0 && value % wheelZoomDelta === 0) {
222
- // This one is definitely a mouse wheel event.
223
- this.type = 'wheel';
224
- } else if (value !== 0 && Math.abs(value) < 4) {
225
- // This one is definitely a trackpad event because it is so small.
226
- this.type = 'trackpad';
227
- } else if (timeDelta > 400) {
228
- // This is likely a new scroll action.
229
- 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.
233
- // @ts-ignore
234
- this.timeout = setTimeout(this.onTimeout, 40, e);
235
- } else if (!this.type) {
236
- // This is a repeating event, but we don't know the type of event just yet.
237
- // 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
241
- // the previous event (which was less than 40ms ago) into this event.
242
- if (this.timeout) {
243
- clearTimeout(this.timeout);
244
- this.timeout = null;
245
- value += this.lastValue;
246
- }
247
- }
248
-
249
- // Slow down zoom if shift key is held for more precise zooming
250
- if (e.shiftKey && value) {
251
- value = value / 4;
252
- }
253
- // Only fire the callback if we actually know what type of scrolling device the user uses.
254
- if (this.type) {
255
- this.lastWheelEvent = e;
256
- this.delta -= value;
257
- if (!this.active) {
258
- this.start(e);
259
- }
260
- }
261
- e.preventDefault();
262
- }
263
- }, {
264
- key: "renderFrame",
265
- value: function renderFrame() {
266
- return this.onScrollFrame();
267
- }
268
- }, {
269
- key: "reset",
270
- value: function reset() {
271
- this.active = false;
272
- }
273
- }, {
274
- key: "onTimeout",
275
- value: function onTimeout(initialEvent) {
276
- this.type = 'wheel';
277
- this.delta -= this.lastValue;
278
- if (!this.active && this.start) {
279
- this.start(initialEvent);
280
- }
281
- }
282
- }, {
283
- key: "start",
284
- value: function start(e) {
285
- if (!this.delta) {
286
- return;
287
- }
288
- if (this.frameId) {
289
- this.frameId = null;
290
- }
291
- this.active = true;
292
- if (!this.isZooming()) {
293
- this.zooming = true;
294
- }
295
- if (this.finishTimeout) {
296
- clearTimeout(this.finishTimeout);
297
- // @ts-ignore
298
- delete this.finishTimeout;
299
- }
300
- var pos = _dom.default.mousePos(this.el, e);
301
- this.around = _lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
302
- this.aroundPoint = this.map.transform.locationPoint(this.around);
303
- if (!this.frameId) {
304
- this.frameId = true;
305
- this.handler.triggerRenderFrame();
306
- }
307
- }
308
- }, {
309
- key: "smoothOutEasing",
310
- value: function smoothOutEasing(duration) {
311
- var easing = _util.ease;
312
- if (this.prevEase) {
313
- var preEase = this.prevEase;
314
- var t = ((0, _util.now)() - preEase.start) / preEase.duration;
315
- var speed = preEase.easing(t + 0.01) - preEase.easing(t);
316
-
317
- // Quick hack to make new bezier that is continuous with last
318
- var x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01;
319
- var y = Math.sqrt(0.27 * 0.27 - x * x);
320
- easing = (0, _util.bezier)(x, y, 0.25, 1);
321
- }
322
- this.prevEase = {
323
- start: (0, _util.now)(),
324
- duration: duration,
325
- easing: easing
326
- };
327
- return easing;
328
- }
329
- }]);
330
- return ScrollZoomHandler;
331
- }();
332
- var _default = ScrollZoomHandler;
333
- exports.default = _default;
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- /**
11
- * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by
12
- * double clicking or double tapping.
13
- */
14
- var DoubleClickZoomHandler = /*#__PURE__*/function () {
15
- /**
16
- * @private
17
- */
18
- function DoubleClickZoomHandler(clickZoom, TapZoom) {
19
- (0, _classCallCheck2.default)(this, DoubleClickZoomHandler);
20
- this.clickZoom = clickZoom;
21
- this.tapZoom = TapZoom;
22
- }
23
-
24
- /**
25
- * Enables the "double click to zoom" interaction.
26
- *
27
- * @example
28
- * map.doubleClickZoom.enable();
29
- */
30
- (0, _createClass2.default)(DoubleClickZoomHandler, [{
31
- key: "enable",
32
- value: function enable() {
33
- this.clickZoom.enable();
34
- this.tapZoom.enable();
35
- }
36
-
37
- /**
38
- * Disables the "double click to zoom" interaction.
39
- *
40
- * @example
41
- * map.doubleClickZoom.disable();
42
- */
43
- }, {
44
- key: "disable",
45
- value: function disable() {
46
- this.clickZoom.disable();
47
- this.tapZoom.disable();
48
- }
49
-
50
- /**
51
- * Returns a Boolean indicating whether the "double click to zoom" interaction is enabled.
52
- *
53
- * @returns {boolean} `true` if the "double click to zoom" interaction is enabled.
54
- */
55
- }, {
56
- key: "isEnabled",
57
- value: function isEnabled() {
58
- return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
59
- }
60
-
61
- /**
62
- * Returns a Boolean indicating whether the "double click to zoom" interaction is active, i.e. currently being used.
63
- *
64
- * @returns {boolean} `true` if the "double click to zoom" interaction is active.
65
- */
66
- }, {
67
- key: "isActive",
68
- value: function isActive() {
69
- return this.clickZoom.isActive() || this.tapZoom.isActive();
70
- }
71
- }]);
72
- return DoubleClickZoomHandler;
73
- }();
74
- exports.default = DoubleClickZoomHandler;
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- /**
11
- * The `DragPanHandler` allows the user to pan the map by clicking and dragging
12
- * the cursor.
13
- */
14
- var DragPanHandler = /*#__PURE__*/function () {
15
- /**
16
- * @private
17
- */
18
- function DragPanHandler(el, mousePan, touchPan) {
19
- (0, _classCallCheck2.default)(this, DragPanHandler);
20
- this.el = el;
21
- this.mousePan = mousePan;
22
- this.touchPan = touchPan;
23
- }
24
-
25
- /**
26
- * Enables the "drag to pan" interaction.
27
- *
28
- * @param {Object} [options] Options object
29
- * @param {number} [options.linearity=0] factor used to scale the drag velocity
30
- * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.
31
- * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.
32
- * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.
33
- *
34
- * @example
35
- * map.dragPan.enable();
36
- * @example
37
- * map.dragPan.enable({
38
- * linearity: 0.3,
39
- * easing: bezier(0, 0, 0.3, 1),
40
- * maxSpeed: 1400,
41
- * deceleration: 2500,
42
- * });
43
- */
44
- (0, _createClass2.default)(DragPanHandler, [{
45
- key: "enable",
46
- value: function enable(options) {
47
- this.inertiaOptions = options || {};
48
- this.mousePan.enable();
49
- this.touchPan.enable();
50
- this.el.classList.add('l7-touch-drag-pan');
51
- }
52
-
53
- /**
54
- * Disables the "drag to pan" interaction.
55
- *
56
- * @example
57
- * map.dragPan.disable();
58
- */
59
- }, {
60
- key: "disable",
61
- value: function disable() {
62
- this.mousePan.disable();
63
- this.touchPan.disable();
64
- this.el.classList.remove('l7-touch-drag-pan');
65
- }
66
-
67
- /**
68
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
69
- *
70
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
71
- */
72
- }, {
73
- key: "isEnabled",
74
- value: function isEnabled() {
75
- return this.mousePan.isEnabled() && this.touchPan.isEnabled();
76
- }
77
-
78
- /**
79
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
80
- *
81
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
82
- */
83
- }, {
84
- key: "isActive",
85
- value: function isActive() {
86
- return this.mousePan.isActive() || this.touchPan.isActive();
87
- }
88
- }]);
89
- return DragPanHandler;
90
- }();
91
- exports.default = DragPanHandler;
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- /**
11
- * The `DragRotateHandler` allows the user to rotate the map by clicking and
12
- * dragging the cursor while holding the right mouse button or `ctrl` key.
13
- */
14
- var DragRotateHandler = /*#__PURE__*/function () {
15
- /**
16
- * @param {Object} [options]
17
- * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
18
- * bearing will snap to north.
19
- * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
20
- * @private
21
- */
22
- function DragRotateHandler(options, mouseRotate, mousePitch) {
23
- (0, _classCallCheck2.default)(this, DragRotateHandler);
24
- this.pitchWithRotate = options.pitchWithRotate;
25
- this.mouseRotate = mouseRotate;
26
- this.mousePitch = mousePitch;
27
- }
28
-
29
- /**
30
- * Enables the "drag to rotate" interaction.
31
- *
32
- * @example
33
- * map.dragRotate.enable();
34
- */
35
- (0, _createClass2.default)(DragRotateHandler, [{
36
- key: "enable",
37
- value: function enable() {
38
- this.mouseRotate.enable();
39
- if (this.pitchWithRotate) {
40
- this.mousePitch.enable();
41
- }
42
- }
43
-
44
- /**
45
- * Disables the "drag to rotate" interaction.
46
- *
47
- * @example
48
- * map.dragRotate.disable();
49
- */
50
- }, {
51
- key: "disable",
52
- value: function disable() {
53
- this.mouseRotate.disable();
54
- this.mousePitch.disable();
55
- }
56
-
57
- /**
58
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
59
- *
60
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
61
- */
62
- }, {
63
- key: "isEnabled",
64
- value: function isEnabled() {
65
- return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
66
- }
67
-
68
- /**
69
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
70
- *
71
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
72
- */
73
- }, {
74
- key: "isActive",
75
- value: function isActive() {
76
- return this.mouseRotate.isActive() || this.mousePitch.isActive();
77
- }
78
- }]);
79
- return DragRotateHandler;
80
- }();
81
- exports.default = DragRotateHandler;
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- /**
11
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
12
- * pinching on a touchscreen.
13
- *
14
- * They can zoom with one finger by double tapping and dragging. On the second tap,
15
- * hold the finger down and drag up or down to zoom in or out.
16
- */
17
- var TouchZoomRotateHandler = /*#__PURE__*/function () {
18
- /**
19
- * @private
20
- */
21
- function TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom) {
22
- (0, _classCallCheck2.default)(this, TouchZoomRotateHandler);
23
- this.el = el;
24
- this.touchZoom = touchZoom;
25
- this.touchRotate = touchRotate;
26
- this.tapDragZoom = tapDragZoom;
27
- this.rotationDisabled = false;
28
- this.enabled = true;
29
- }
30
-
31
- /**
32
- * Enables the "pinch to rotate and zoom" interaction.
33
- *
34
- * @param {Object} [options] Options object.
35
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
36
- *
37
- * @example
38
- * map.touchZoomRotate.enable();
39
- * @example
40
- * map.touchZoomRotate.enable({ around: 'center' });
41
- */
42
- (0, _createClass2.default)(TouchZoomRotateHandler, [{
43
- key: "enable",
44
- value: function enable(options) {
45
- this.touchZoom.enable(options);
46
- if (!this.rotationDisabled) {
47
- this.touchRotate.enable(options);
48
- }
49
- this.tapDragZoom.enable();
50
- this.el.classList.add('l7-touch-zoom-rotate');
51
- }
52
-
53
- /**
54
- * Disables the "pinch to rotate and zoom" interaction.
55
- *
56
- * @example
57
- * map.touchZoomRotate.disable();
58
- */
59
- }, {
60
- key: "disable",
61
- value: function disable() {
62
- this.touchZoom.disable();
63
- this.touchRotate.disable();
64
- this.tapDragZoom.disable();
65
- this.el.classList.remove('l7-touch-zoom-rotate');
66
- }
67
-
68
- /**
69
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
70
- *
71
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
72
- */
73
- }, {
74
- key: "isEnabled",
75
- value: function isEnabled() {
76
- return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
77
- }
78
-
79
- /**
80
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
81
- *
82
- * @returns {boolean} //eslint-disable-line
83
- */
84
- }, {
85
- key: "isActive",
86
- value: function isActive() {
87
- return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
88
- }
89
-
90
- /**
91
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
92
- * interaction enabled.
93
- *
94
- * @example
95
- * map.touchZoomRotate.disableRotation();
96
- */
97
- }, {
98
- key: "disableRotation",
99
- value: function disableRotation() {
100
- this.rotationDisabled = true;
101
- this.touchRotate.disable();
102
- }
103
-
104
- /**
105
- * Enables the "pinch to rotate" interaction.
106
- *
107
- * @example
108
- * map.touchZoomRotate.enable();
109
- * map.touchZoomRotate.enableRotation();
110
- */
111
- }, {
112
- key: "enableRotation",
113
- value: function enableRotation() {
114
- this.rotationDisabled = false;
115
- if (this.touchZoom.isEnabled()) {
116
- this.touchRotate.enable();
117
- }
118
- }
119
- }]);
120
- return TouchZoomRotateHandler;
121
- }();
122
- exports.default = TouchZoomRotateHandler;