@antv/l7-map 2.9.21 → 2.9.23
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 +115 -85
- package/es/css/l7.css +98 -0
- package/es/earthmap.js +27 -43
- package/es/geo/edge_insets.js +44 -14
- package/es/geo/lng_lat.js +15 -11
- package/es/geo/lng_lat_bounds.js +6 -10
- package/es/geo/mercator.js +24 -12
- package/es/geo/point.js +2 -8
- package/es/geo/simple.js +24 -12
- package/es/geo/transform.js +421 -120
- package/es/handler/IHandler.js +1 -2
- package/es/handler/blockable_map_event.js +13 -14
- package/es/handler/box_zoom.js +43 -27
- package/es/handler/click_zoom.js +3 -8
- package/es/handler/events/event.js +3 -6
- package/es/handler/events/index.js +4 -5
- package/es/handler/events/map_mouse_event.js +30 -20
- package/es/handler/events/map_touch_event.js +55 -25
- package/es/handler/events/map_wheel_event.js +24 -15
- package/es/handler/events/render_event.js +3 -6
- package/es/handler/handler_inertia.js +10 -12
- package/es/handler/handler_manager.js +75 -72
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +20 -15
- package/es/handler/map_event.js +23 -12
- package/es/handler/mouse/index.js +4 -5
- package/es/handler/mouse/mouse_handler.js +17 -21
- package/es/handler/mouse/mousepan_handler.js +5 -5
- package/es/handler/mouse/mousepitch_hander.js +7 -5
- package/es/handler/mouse/mouserotate_hander.js +7 -5
- package/es/handler/mouse/util.js +3 -3
- package/es/handler/scroll_zoom.js +103 -67
- package/es/handler/shim/dblclick_zoom.js +35 -8
- package/es/handler/shim/drag_pan.js +48 -12
- package/es/handler/shim/drag_rotate.js +39 -10
- package/es/handler/shim/touch_zoom_rotate.js +59 -16
- package/es/handler/tap/single_tap_recognizer.js +7 -17
- package/es/handler/tap/tap_drag_zoom.js +5 -18
- package/es/handler/tap/tap_recognizer.js +4 -15
- package/es/handler/tap/tap_zoom.js +4 -13
- package/es/handler/touch/index.js +5 -6
- package/es/handler/touch/touch_pan.js +9 -20
- package/es/handler/touch/touch_pitch.js +11 -23
- package/es/handler/touch/touch_rotate.js +15 -18
- package/es/handler/touch/touch_zoom.js +5 -19
- package/es/handler/touch/two_touch.js +14 -21
- package/es/hash.js +28 -16
- package/es/index.js +2 -3
- package/es/interface.js +1 -2
- package/es/map.js +26 -47
- package/es/util.js +15 -6
- package/es/utils/Aabb.js +11 -12
- package/es/utils/dom.js +30 -11
- package/es/utils/performance.js +10 -6
- package/es/utils/primitives.js +11 -10
- package/es/utils/task_queue.js +6 -13
- package/lib/camera.js +508 -721
- package/lib/css/l7.css +98 -0
- package/lib/earthmap.js +222 -392
- package/lib/geo/edge_insets.js +64 -83
- package/lib/geo/lng_lat.js +65 -81
- package/lib/geo/lng_lat_bounds.js +124 -165
- package/lib/geo/mercator.js +62 -78
- package/lib/geo/point.js +171 -239
- package/lib/geo/simple.js +61 -80
- package/lib/geo/transform.js +470 -653
- package/lib/handler/IHandler.js +17 -2
- package/lib/handler/blockable_map_event.js +63 -83
- package/lib/handler/box_zoom.js +123 -176
- package/lib/handler/click_zoom.js +56 -68
- package/lib/handler/events/event.js +35 -23
- package/lib/handler/events/index.js +35 -29
- package/lib/handler/events/map_mouse_event.js +42 -72
- package/lib/handler/events/map_touch_event.js +45 -80
- package/lib/handler/events/map_wheel_event.js +34 -58
- package/lib/handler/events/render_event.js +31 -52
- package/lib/handler/handler_inertia.js +113 -160
- package/lib/handler/handler_manager.js +379 -620
- package/lib/handler/handler_util.js +28 -10
- package/lib/handler/keyboard.js +114 -146
- package/lib/handler/map_event.js +84 -120
- package/lib/handler/mouse/index.js +35 -29
- package/lib/handler/mouse/mouse_handler.js +90 -123
- package/lib/handler/mouse/mousepan_handler.js +46 -65
- package/lib/handler/mouse/mousepitch_hander.js +44 -63
- package/lib/handler/mouse/mouserotate_hander.js +44 -63
- package/lib/handler/mouse/util.js +38 -20
- package/lib/handler/scroll_zoom.js +175 -258
- package/lib/handler/shim/dblclick_zoom.js +42 -48
- package/lib/handler/shim/drag_pan.js +48 -59
- package/lib/handler/shim/drag_rotate.js +43 -51
- package/lib/handler/shim/touch_zoom_rotate.js +58 -78
- package/lib/handler/tap/single_tap_recognizer.js +84 -117
- package/lib/handler/tap/tap_drag_zoom.js +92 -115
- package/lib/handler/tap/tap_recognizer.js +60 -78
- package/lib/handler/tap/tap_zoom.js +88 -119
- package/lib/handler/touch/index.js +38 -37
- package/lib/handler/touch/touch_pan.js +98 -132
- package/lib/handler/touch/touch_pitch.js +73 -117
- package/lib/handler/touch/touch_rotate.js +58 -94
- package/lib/handler/touch/touch_zoom.js +49 -84
- package/lib/handler/touch/two_touch.js +88 -128
- package/lib/hash.js +100 -133
- package/lib/index.js +19 -31
- package/lib/interface.js +17 -2
- package/lib/map.js +238 -420
- package/lib/util.js +67 -78
- package/lib/utils/Aabb.js +80 -132
- package/lib/utils/dom.js +84 -141
- package/lib/utils/performance.js +54 -42
- package/lib/utils/primitives.js +59 -51
- package/lib/utils/task_queue.js +61 -108
- package/package.json +11 -8
- package/es/camera.js.map +0 -1
- package/es/earthmap.js.map +0 -1
- package/es/geo/edge_insets.js.map +0 -1
- package/es/geo/lng_lat.js.map +0 -1
- package/es/geo/lng_lat_bounds.js.map +0 -1
- package/es/geo/mercator.js.map +0 -1
- package/es/geo/point.js.map +0 -1
- package/es/geo/simple.js.map +0 -1
- package/es/geo/transform.js.map +0 -1
- package/es/handler/IHandler.js.map +0 -1
- package/es/handler/blockable_map_event.js.map +0 -1
- package/es/handler/box_zoom.js.map +0 -1
- package/es/handler/click_zoom.js.map +0 -1
- package/es/handler/events/event.js.map +0 -1
- package/es/handler/events/index.js.map +0 -1
- package/es/handler/events/map_mouse_event.js.map +0 -1
- package/es/handler/events/map_touch_event.js.map +0 -1
- package/es/handler/events/map_wheel_event.js.map +0 -1
- package/es/handler/events/render_event.js.map +0 -1
- package/es/handler/handler_inertia.js.map +0 -1
- package/es/handler/handler_manager.js.map +0 -1
- package/es/handler/handler_util.js.map +0 -1
- package/es/handler/keyboard.js.map +0 -1
- package/es/handler/map_event.js.map +0 -1
- package/es/handler/mouse/index.js.map +0 -1
- package/es/handler/mouse/mouse_handler.js.map +0 -1
- package/es/handler/mouse/mousepan_handler.js.map +0 -1
- package/es/handler/mouse/mousepitch_hander.js.map +0 -1
- package/es/handler/mouse/mouserotate_hander.js.map +0 -1
- package/es/handler/mouse/util.js.map +0 -1
- package/es/handler/scroll_zoom.js.map +0 -1
- package/es/handler/shim/dblclick_zoom.js.map +0 -1
- package/es/handler/shim/drag_pan.js.map +0 -1
- package/es/handler/shim/drag_rotate.js.map +0 -1
- package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/es/handler/tap/single_tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_drag_zoom.js.map +0 -1
- package/es/handler/tap/tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_zoom.js.map +0 -1
- package/es/handler/touch/index.js.map +0 -1
- package/es/handler/touch/touch_pan.js.map +0 -1
- package/es/handler/touch/touch_pitch.js.map +0 -1
- package/es/handler/touch/touch_rotate.js.map +0 -1
- package/es/handler/touch/touch_zoom.js.map +0 -1
- package/es/handler/touch/two_touch.js.map +0 -1
- package/es/hash.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/interface.js.map +0 -1
- package/es/map.js.map +0 -1
- package/es/util.js.map +0 -1
- package/es/utils/Aabb.js.map +0 -1
- package/es/utils/dom.js.map +0 -1
- package/es/utils/performance.js.map +0 -1
- package/es/utils/primitives.js.map +0 -1
- package/es/utils/task_queue.js.map +0 -1
- package/lib/camera.js.map +0 -1
- package/lib/earthmap.js.map +0 -1
- package/lib/geo/edge_insets.js.map +0 -1
- package/lib/geo/lng_lat.js.map +0 -1
- package/lib/geo/lng_lat_bounds.js.map +0 -1
- package/lib/geo/mercator.js.map +0 -1
- package/lib/geo/point.js.map +0 -1
- package/lib/geo/simple.js.map +0 -1
- package/lib/geo/transform.js.map +0 -1
- package/lib/handler/IHandler.js.map +0 -1
- package/lib/handler/blockable_map_event.js.map +0 -1
- package/lib/handler/box_zoom.js.map +0 -1
- package/lib/handler/click_zoom.js.map +0 -1
- package/lib/handler/events/event.js.map +0 -1
- package/lib/handler/events/index.js.map +0 -1
- package/lib/handler/events/map_mouse_event.js.map +0 -1
- package/lib/handler/events/map_touch_event.js.map +0 -1
- package/lib/handler/events/map_wheel_event.js.map +0 -1
- package/lib/handler/events/render_event.js.map +0 -1
- package/lib/handler/handler_inertia.js.map +0 -1
- package/lib/handler/handler_manager.js.map +0 -1
- package/lib/handler/handler_util.js.map +0 -1
- package/lib/handler/keyboard.js.map +0 -1
- package/lib/handler/map_event.js.map +0 -1
- package/lib/handler/mouse/index.js.map +0 -1
- package/lib/handler/mouse/mouse_handler.js.map +0 -1
- package/lib/handler/mouse/mousepan_handler.js.map +0 -1
- package/lib/handler/mouse/mousepitch_hander.js.map +0 -1
- package/lib/handler/mouse/mouserotate_hander.js.map +0 -1
- package/lib/handler/mouse/util.js.map +0 -1
- package/lib/handler/scroll_zoom.js.map +0 -1
- package/lib/handler/shim/dblclick_zoom.js.map +0 -1
- package/lib/handler/shim/drag_pan.js.map +0 -1
- package/lib/handler/shim/drag_rotate.js.map +0 -1
- package/lib/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/lib/handler/tap/single_tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_drag_zoom.js.map +0 -1
- package/lib/handler/tap/tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_zoom.js.map +0 -1
- package/lib/handler/touch/index.js.map +0 -1
- package/lib/handler/touch/touch_pan.js.map +0 -1
- package/lib/handler/touch/touch_pitch.js.map +0 -1
- package/lib/handler/touch/touch_rotate.js.map +0 -1
- package/lib/handler/touch/touch_zoom.js.map +0 -1
- package/lib/handler/touch/two_touch.js.map +0 -1
- package/lib/hash.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interface.js.map +0 -1
- package/lib/map.js.map +0 -1
- package/lib/util.js.map +0 -1
- package/lib/utils/Aabb.js.map +0 -1
- package/lib/utils/dom.js.map +0 -1
- package/lib/utils/performance.js.map +0 -1
- package/lib/utils/primitives.js.map +0 -1
- package/lib/utils/task_queue.js.map +0 -1
|
@@ -1,103 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/handler/scroll_zoom.ts
|
|
23
|
+
var scroll_zoom_exports = {};
|
|
24
|
+
__export(scroll_zoom_exports, {
|
|
25
|
+
default: () => scroll_zoom_default
|
|
7
26
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _lng_lat = _interopRequireDefault(require("../geo/lng_lat"));
|
|
17
|
-
|
|
18
|
-
var _util = require("../util");
|
|
19
|
-
|
|
20
|
-
var _dom = _interopRequireDefault(require("../utils/dom"));
|
|
21
|
-
|
|
27
|
+
module.exports = __toCommonJS(scroll_zoom_exports);
|
|
28
|
+
var import_lng_lat = __toESM(require("../geo/lng_lat"));
|
|
29
|
+
var import_util = require("../util");
|
|
30
|
+
var import_dom = __toESM(require("../utils/dom"));
|
|
22
31
|
var wheelZoomDelta = 4.000244140625;
|
|
23
32
|
var defaultZoomRate = 1 / 100;
|
|
24
33
|
var wheelZoomRate = 1 / 450;
|
|
25
34
|
var maxScalePerFrame = 2;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(0, _classCallCheck2.default)(this, ScrollZoomHandler);
|
|
32
|
-
(0, _defineProperty2.default)(this, "map", void 0);
|
|
33
|
-
(0, _defineProperty2.default)(this, "el", void 0);
|
|
34
|
-
(0, _defineProperty2.default)(this, "enabled", void 0);
|
|
35
|
-
(0, _defineProperty2.default)(this, "active", void 0);
|
|
36
|
-
(0, _defineProperty2.default)(this, "zooming", void 0);
|
|
37
|
-
(0, _defineProperty2.default)(this, "aroundCenter", void 0);
|
|
38
|
-
(0, _defineProperty2.default)(this, "around", void 0);
|
|
39
|
-
(0, _defineProperty2.default)(this, "aroundPoint", void 0);
|
|
40
|
-
(0, _defineProperty2.default)(this, "type", void 0);
|
|
41
|
-
(0, _defineProperty2.default)(this, "lastValue", void 0);
|
|
42
|
-
(0, _defineProperty2.default)(this, "timeout", void 0);
|
|
43
|
-
(0, _defineProperty2.default)(this, "finishTimeout", void 0);
|
|
44
|
-
(0, _defineProperty2.default)(this, "lastWheelEvent", void 0);
|
|
45
|
-
(0, _defineProperty2.default)(this, "lastWheelEventTime", void 0);
|
|
46
|
-
(0, _defineProperty2.default)(this, "startZoom", void 0);
|
|
47
|
-
(0, _defineProperty2.default)(this, "targetZoom", void 0);
|
|
48
|
-
(0, _defineProperty2.default)(this, "delta", void 0);
|
|
49
|
-
(0, _defineProperty2.default)(this, "easing", void 0);
|
|
50
|
-
(0, _defineProperty2.default)(this, "prevEase", void 0);
|
|
51
|
-
(0, _defineProperty2.default)(this, "frameId", void 0);
|
|
52
|
-
(0, _defineProperty2.default)(this, "handler", void 0);
|
|
53
|
-
(0, _defineProperty2.default)(this, "defaultZoomRate", void 0);
|
|
54
|
-
(0, _defineProperty2.default)(this, "wheelZoomRate", void 0);
|
|
55
|
-
(0, _defineProperty2.default)(this, "onScrollFrame", function () {
|
|
56
|
-
if (!_this.frameId) {
|
|
35
|
+
var ScrollZoomHandler = class {
|
|
36
|
+
constructor(map, handler) {
|
|
37
|
+
this.onScrollFrame = () => {
|
|
38
|
+
if (!this.frameId) {
|
|
57
39
|
return;
|
|
58
40
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!_this.isActive()) {
|
|
41
|
+
this.frameId = null;
|
|
42
|
+
if (!this.isActive()) {
|
|
63
43
|
return;
|
|
64
44
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(_this.delta * zoomRate)));
|
|
71
|
-
|
|
72
|
-
if (_this.delta < 0 && scale !== 0) {
|
|
45
|
+
const tr = this.map.transform;
|
|
46
|
+
if (this.delta !== 0) {
|
|
47
|
+
const zoomRate = this.type === "wheel" && Math.abs(this.delta) > wheelZoomDelta ? this.wheelZoomRate : this.defaultZoomRate;
|
|
48
|
+
let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this.delta * zoomRate)));
|
|
49
|
+
if (this.delta < 0 && scale !== 0) {
|
|
73
50
|
scale = 1 / scale;
|
|
74
51
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_this.startZoom = tr.zoom;
|
|
81
|
-
_this.easing = _this.smoothOutEasing(200);
|
|
52
|
+
const fromScale = typeof this.targetZoom === "number" ? tr.zoomScale(this.targetZoom) : tr.scale;
|
|
53
|
+
this.targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));
|
|
54
|
+
if (this.type === "wheel") {
|
|
55
|
+
this.startZoom = tr.zoom;
|
|
56
|
+
this.easing = this.smoothOutEasing(200);
|
|
82
57
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var t = Math.min(((0, _util.now)() - _this.lastWheelEventTime) / 200, 1);
|
|
95
|
-
var k = easing(t);
|
|
96
|
-
zoom = (0, _util.interpolate)(startZoom, targetZoom, k);
|
|
97
|
-
|
|
58
|
+
this.delta = 0;
|
|
59
|
+
}
|
|
60
|
+
const targetZoom = typeof this.targetZoom === "number" ? this.targetZoom : tr.zoom;
|
|
61
|
+
const startZoom = this.startZoom;
|
|
62
|
+
const easing = this.easing;
|
|
63
|
+
let finished = false;
|
|
64
|
+
let zoom;
|
|
65
|
+
if (this.type === "wheel" && startZoom && easing) {
|
|
66
|
+
const t = Math.min(((0, import_util.now)() - this.lastWheelEventTime) / 200, 1);
|
|
67
|
+
const k = easing(t);
|
|
68
|
+
zoom = (0, import_util.interpolate)(startZoom, targetZoom, k);
|
|
98
69
|
if (t < 1) {
|
|
99
|
-
if (!
|
|
100
|
-
|
|
70
|
+
if (!this.frameId) {
|
|
71
|
+
this.frameId = true;
|
|
101
72
|
}
|
|
102
73
|
} else {
|
|
103
74
|
finished = true;
|
|
@@ -106,29 +77,24 @@ var ScrollZoomHandler = function () {
|
|
|
106
77
|
zoom = targetZoom;
|
|
107
78
|
finished = true;
|
|
108
79
|
}
|
|
109
|
-
|
|
110
|
-
_this.active = true;
|
|
111
|
-
|
|
80
|
+
this.active = true;
|
|
112
81
|
if (finished) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
delete _this.targetZoom;
|
|
120
|
-
delete _this.finishTimeout;
|
|
82
|
+
this.active = false;
|
|
83
|
+
this.finishTimeout = setTimeout(() => {
|
|
84
|
+
this.zooming = false;
|
|
85
|
+
this.handler.triggerRenderFrame();
|
|
86
|
+
delete this.targetZoom;
|
|
87
|
+
delete this.finishTimeout;
|
|
121
88
|
}, 200);
|
|
122
89
|
}
|
|
123
|
-
|
|
124
90
|
return {
|
|
125
91
|
noInertia: true,
|
|
126
92
|
needsRenderFrame: !finished,
|
|
127
93
|
zoomDelta: zoom - tr.zoom,
|
|
128
|
-
around:
|
|
129
|
-
originalEvent:
|
|
94
|
+
around: this.aroundPoint,
|
|
95
|
+
originalEvent: this.lastWheelEvent
|
|
130
96
|
};
|
|
131
|
-
}
|
|
97
|
+
};
|
|
132
98
|
this.map = map;
|
|
133
99
|
this.el = map.getCanvasContainer();
|
|
134
100
|
this.handler = handler;
|
|
@@ -136,173 +102,124 @@ var ScrollZoomHandler = function () {
|
|
|
136
102
|
this.defaultZoomRate = defaultZoomRate;
|
|
137
103
|
this.wheelZoomRate = wheelZoomRate;
|
|
138
104
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
105
|
+
setZoomRate(zoomRate) {
|
|
106
|
+
this.defaultZoomRate = zoomRate;
|
|
107
|
+
}
|
|
108
|
+
setWheelZoomRate(zoomRate) {
|
|
109
|
+
this.wheelZoomRate = zoomRate;
|
|
110
|
+
}
|
|
111
|
+
isEnabled() {
|
|
112
|
+
return !!this.enabled;
|
|
113
|
+
}
|
|
114
|
+
isActive() {
|
|
115
|
+
return !!this.active || this.finishTimeout !== void 0;
|
|
116
|
+
}
|
|
117
|
+
isZooming() {
|
|
118
|
+
return !!this.zooming;
|
|
119
|
+
}
|
|
120
|
+
enable(options) {
|
|
121
|
+
if (this.isEnabled()) {
|
|
122
|
+
return;
|
|
144
123
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
124
|
+
this.enabled = true;
|
|
125
|
+
this.aroundCenter = options && options.around === "center";
|
|
126
|
+
}
|
|
127
|
+
disable() {
|
|
128
|
+
if (!this.isEnabled()) {
|
|
129
|
+
return;
|
|
149
130
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
131
|
+
this.enabled = false;
|
|
132
|
+
}
|
|
133
|
+
wheel(e) {
|
|
134
|
+
if (!this.isEnabled()) {
|
|
135
|
+
return;
|
|
154
136
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
137
|
+
let value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
|
|
138
|
+
const nowTime = (0, import_util.now)();
|
|
139
|
+
const timeDelta = nowTime - (this.lastWheelEventTime || 0);
|
|
140
|
+
this.lastWheelEventTime = nowTime;
|
|
141
|
+
if (value !== 0 && value % wheelZoomDelta === 0) {
|
|
142
|
+
this.type = "wheel";
|
|
143
|
+
} else if (value !== 0 && Math.abs(value) < 4) {
|
|
144
|
+
this.type = "trackpad";
|
|
145
|
+
} else if (timeDelta > 400) {
|
|
146
|
+
this.type = null;
|
|
147
|
+
this.lastValue = value;
|
|
148
|
+
this.timeout = setTimeout(this.onTimeout, 40, e);
|
|
149
|
+
} else if (!this.type) {
|
|
150
|
+
this.type = Math.abs(timeDelta * value) < 200 ? "trackpad" : "wheel";
|
|
151
|
+
if (this.timeout) {
|
|
152
|
+
clearTimeout(this.timeout);
|
|
153
|
+
this.timeout = null;
|
|
154
|
+
value += this.lastValue;
|
|
155
|
+
}
|
|
159
156
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
value: function isZooming() {
|
|
163
|
-
return !!this.zooming;
|
|
157
|
+
if (e.shiftKey && value) {
|
|
158
|
+
value = value / 4;
|
|
164
159
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (this.
|
|
169
|
-
|
|
160
|
+
if (this.type) {
|
|
161
|
+
this.lastWheelEvent = e;
|
|
162
|
+
this.delta -= value;
|
|
163
|
+
if (!this.active) {
|
|
164
|
+
this.start(e);
|
|
170
165
|
}
|
|
171
|
-
|
|
172
|
-
this.enabled = true;
|
|
173
|
-
this.aroundCenter = options && options.around === 'center';
|
|
174
166
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
}
|
|
169
|
+
renderFrame() {
|
|
170
|
+
return this.onScrollFrame();
|
|
171
|
+
}
|
|
172
|
+
reset() {
|
|
173
|
+
this.active = false;
|
|
174
|
+
}
|
|
175
|
+
onTimeout(initialEvent) {
|
|
176
|
+
this.type = "wheel";
|
|
177
|
+
this.delta -= this.lastValue;
|
|
178
|
+
if (!this.active && this.start) {
|
|
179
|
+
this.start(initialEvent);
|
|
183
180
|
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
var value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
|
|
192
|
-
var nowTime = (0, _util.now)();
|
|
193
|
-
var timeDelta = nowTime - (this.lastWheelEventTime || 0);
|
|
194
|
-
this.lastWheelEventTime = nowTime;
|
|
195
|
-
|
|
196
|
-
if (value !== 0 && value % wheelZoomDelta === 0) {
|
|
197
|
-
this.type = 'wheel';
|
|
198
|
-
} else if (value !== 0 && Math.abs(value) < 4) {
|
|
199
|
-
this.type = 'trackpad';
|
|
200
|
-
} else if (timeDelta > 400) {
|
|
201
|
-
this.type = null;
|
|
202
|
-
this.lastValue = value;
|
|
203
|
-
this.timeout = setTimeout(this.onTimeout, 40, e);
|
|
204
|
-
} else if (!this.type) {
|
|
205
|
-
this.type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel';
|
|
206
|
-
|
|
207
|
-
if (this.timeout) {
|
|
208
|
-
clearTimeout(this.timeout);
|
|
209
|
-
this.timeout = null;
|
|
210
|
-
value += this.lastValue;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (e.shiftKey && value) {
|
|
215
|
-
value = value / 4;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (this.type) {
|
|
219
|
-
this.lastWheelEvent = e;
|
|
220
|
-
this.delta -= value;
|
|
221
|
-
|
|
222
|
-
if (!this.active) {
|
|
223
|
-
this.start(e);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
e.preventDefault();
|
|
181
|
+
}
|
|
182
|
+
start(e) {
|
|
183
|
+
if (!this.delta) {
|
|
184
|
+
return;
|
|
228
185
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
value: function renderFrame() {
|
|
232
|
-
return this.onScrollFrame();
|
|
186
|
+
if (this.frameId) {
|
|
187
|
+
this.frameId = null;
|
|
233
188
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
this.active = false;
|
|
189
|
+
this.active = true;
|
|
190
|
+
if (!this.isZooming()) {
|
|
191
|
+
this.zooming = true;
|
|
238
192
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.type = 'wheel';
|
|
243
|
-
this.delta -= this.lastValue;
|
|
244
|
-
|
|
245
|
-
if (!this.active && this.start) {
|
|
246
|
-
this.start(initialEvent);
|
|
247
|
-
}
|
|
193
|
+
if (this.finishTimeout) {
|
|
194
|
+
clearTimeout(this.finishTimeout);
|
|
195
|
+
delete this.finishTimeout;
|
|
248
196
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (this.frameId) {
|
|
257
|
-
this.frameId = null;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
this.active = true;
|
|
261
|
-
|
|
262
|
-
if (!this.isZooming()) {
|
|
263
|
-
this.zooming = true;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (this.finishTimeout) {
|
|
267
|
-
clearTimeout(this.finishTimeout);
|
|
268
|
-
delete this.finishTimeout;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
var pos = _dom.default.mousePos(this.el, e);
|
|
272
|
-
|
|
273
|
-
this.around = _lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
|
|
274
|
-
this.aroundPoint = this.map.transform.locationPoint(this.around);
|
|
275
|
-
|
|
276
|
-
if (!this.frameId) {
|
|
277
|
-
this.frameId = true;
|
|
278
|
-
this.handler.triggerRenderFrame();
|
|
279
|
-
}
|
|
197
|
+
const pos = import_dom.default.mousePos(this.el, e);
|
|
198
|
+
this.around = import_lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
|
|
199
|
+
this.aroundPoint = this.map.transform.locationPoint(this.around);
|
|
200
|
+
if (!this.frameId) {
|
|
201
|
+
this.frameId = true;
|
|
202
|
+
this.handler.triggerRenderFrame();
|
|
280
203
|
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var y = Math.sqrt(0.27 * 0.27 - x * x);
|
|
292
|
-
easing = (0, _util.bezier)(x, y, 0.25, 1);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
this.prevEase = {
|
|
296
|
-
start: (0, _util.now)(),
|
|
297
|
-
duration: duration,
|
|
298
|
-
easing: easing
|
|
299
|
-
};
|
|
300
|
-
return easing;
|
|
204
|
+
}
|
|
205
|
+
smoothOutEasing(duration) {
|
|
206
|
+
let easing = import_util.ease;
|
|
207
|
+
if (this.prevEase) {
|
|
208
|
+
const preEase = this.prevEase;
|
|
209
|
+
const t = ((0, import_util.now)() - preEase.start) / preEase.duration;
|
|
210
|
+
const speed = preEase.easing(t + 0.01) - preEase.easing(t);
|
|
211
|
+
const x = 0.27 / Math.sqrt(speed * speed + 1e-4) * 0.01;
|
|
212
|
+
const y = Math.sqrt(0.27 * 0.27 - x * x);
|
|
213
|
+
easing = (0, import_util.bezier)(x, y, 0.25, 1);
|
|
301
214
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
215
|
+
this.prevEase = {
|
|
216
|
+
start: (0, import_util.now)(),
|
|
217
|
+
duration,
|
|
218
|
+
easing
|
|
219
|
+
};
|
|
220
|
+
return easing;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
var scroll_zoom_default = ScrollZoomHandler;
|
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
225
|
+
0 && (module.exports = {});
|
|
@@ -1,52 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/handler/shim/dblclick_zoom.ts
|
|
20
|
+
var dblclick_zoom_exports = {};
|
|
21
|
+
__export(dblclick_zoom_exports, {
|
|
22
|
+
default: () => DoubleClickZoomHandler
|
|
7
23
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var DoubleClickZoomHandler = function () {
|
|
17
|
-
function DoubleClickZoomHandler(clickZoom, TapZoom) {
|
|
18
|
-
(0, _classCallCheck2.default)(this, DoubleClickZoomHandler);
|
|
19
|
-
(0, _defineProperty2.default)(this, "clickZoom", void 0);
|
|
20
|
-
(0, _defineProperty2.default)(this, "tapZoom", void 0);
|
|
24
|
+
module.exports = __toCommonJS(dblclick_zoom_exports);
|
|
25
|
+
var DoubleClickZoomHandler = class {
|
|
26
|
+
constructor(clickZoom, TapZoom) {
|
|
21
27
|
this.clickZoom = clickZoom;
|
|
22
28
|
this.tapZoom = TapZoom;
|
|
23
29
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "isActive",
|
|
44
|
-
value: function isActive() {
|
|
45
|
-
return this.clickZoom.isActive() || this.tapZoom.isActive();
|
|
46
|
-
}
|
|
47
|
-
}]);
|
|
48
|
-
return DoubleClickZoomHandler;
|
|
49
|
-
}();
|
|
50
|
-
|
|
51
|
-
exports.default = DoubleClickZoomHandler;
|
|
52
|
-
//# sourceMappingURL=dblclick_zoom.js.map
|
|
30
|
+
enable() {
|
|
31
|
+
this.clickZoom.enable();
|
|
32
|
+
this.tapZoom.enable();
|
|
33
|
+
}
|
|
34
|
+
disable() {
|
|
35
|
+
this.clickZoom.disable();
|
|
36
|
+
this.tapZoom.disable();
|
|
37
|
+
}
|
|
38
|
+
isEnabled() {
|
|
39
|
+
return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
|
|
40
|
+
}
|
|
41
|
+
isActive() {
|
|
42
|
+
return this.clickZoom.isActive() || this.tapZoom.isActive();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {});
|