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