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