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