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