@antv/l7-map 2.18.0 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -718
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -369
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -108
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -73
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -154
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -84
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -224
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -87
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -961
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -78
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -180
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -54
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -11
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -64
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -95
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -50
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -26
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -157
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -577
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -9
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -143
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -125
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -4
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -118
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -44
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -46
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -46
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -11
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -325
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -67
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -84
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -74
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -115
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -97
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -106
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -54
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -109
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -5
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -110
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -93
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -77
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -54
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -125
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -134
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- package/es/interface.d.ts +0 -34
- package/es/interface.js +0 -1
- package/es/map.d.ts +0 -70
- package/es/map.js +0 -387
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -88
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -112
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -140
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -47
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -89
- package/lib/camera.js +0 -724
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -376
- package/lib/geo/edge_insets.js +0 -114
- package/lib/geo/lng_lat.js +0 -81
- package/lib/geo/lng_lat_bounds.js +0 -161
- package/lib/geo/mercator.js +0 -100
- package/lib/geo/point.js +0 -231
- package/lib/geo/simple.js +0 -104
- package/lib/geo/transform.js +0 -971
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -84
- package/lib/handler/box_zoom.js +0 -186
- package/lib/handler/click_zoom.js +0 -61
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.js +0 -70
- package/lib/handler/events/map_touch_event.js +0 -100
- package/lib/handler/events/map_wheel_event.js +0 -57
- package/lib/handler/events/render_event.js +0 -33
- package/lib/handler/handler_inertia.js +0 -162
- package/lib/handler/handler_manager.js +0 -584
- package/lib/handler/handler_util.js +0 -15
- package/lib/handler/keyboard.js +0 -151
- package/lib/handler/map_event.js +0 -131
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.js +0 -124
- package/lib/handler/mouse/mousepan_handler.js +0 -49
- package/lib/handler/mouse/mousepitch_hander.js +0 -51
- package/lib/handler/mouse/mouserotate_hander.js +0 -51
- package/lib/handler/mouse/util.js +0 -22
- package/lib/handler/scroll_zoom.js +0 -333
- package/lib/handler/shim/dblclick_zoom.js +0 -74
- package/lib/handler/shim/drag_pan.js +0 -91
- package/lib/handler/shim/drag_rotate.js +0 -81
- package/lib/handler/shim/touch_zoom_rotate.js +0 -122
- package/lib/handler/tap/single_tap_recognizer.js +0 -106
- package/lib/handler/tap/tap_drag_zoom.js +0 -112
- package/lib/handler/tap/tap_recognizer.js +0 -63
- package/lib/handler/tap/tap_zoom.js +0 -115
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.js +0 -117
- package/lib/handler/touch/touch_pitch.js +0 -98
- package/lib/handler/touch/touch_rotate.js +0 -82
- package/lib/handler/touch/touch_zoom.js +0 -59
- package/lib/handler/touch/two_touch.js +0 -131
- package/lib/hash.js +0 -143
- package/lib/index.js +0 -49
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -394
- package/lib/util.js +0 -108
- package/lib/utils/Aabb.js +0 -119
- package/lib/utils/dom.js +0 -147
- package/lib/utils/performance.js +0 -70
- package/lib/utils/primitives.js +0 -54
- package/lib/utils/task_queue.js +0 -97
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _point = _interopRequireDefault(require("../geo/point"));
|
|
11
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
12
|
-
var _util = require("../util");
|
|
13
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
14
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } // @ts-ignore
|
|
16
|
-
// tslint:disable-next-line:no-submodule-imports
|
|
17
|
-
var merge = _l7Utils.lodashUtil.merge;
|
|
18
|
-
var defaultInertiaOptions = {
|
|
19
|
-
linearity: 0.3,
|
|
20
|
-
easing: (0, _util.bezier)(0, 0, 0.3, 1)
|
|
21
|
-
};
|
|
22
|
-
var defaultPanInertiaOptions = merge({
|
|
23
|
-
deceleration: 2500,
|
|
24
|
-
maxSpeed: 1400
|
|
25
|
-
}, defaultInertiaOptions);
|
|
26
|
-
var defaultZoomInertiaOptions = merge({
|
|
27
|
-
deceleration: 20,
|
|
28
|
-
maxSpeed: 1400
|
|
29
|
-
}, defaultInertiaOptions);
|
|
30
|
-
var defaultBearingInertiaOptions = merge({
|
|
31
|
-
deceleration: 1000,
|
|
32
|
-
maxSpeed: 360
|
|
33
|
-
}, defaultInertiaOptions);
|
|
34
|
-
var defaultPitchInertiaOptions = merge({
|
|
35
|
-
deceleration: 1000,
|
|
36
|
-
maxSpeed: 90
|
|
37
|
-
}, defaultInertiaOptions);
|
|
38
|
-
var HandlerInertia = /*#__PURE__*/function () {
|
|
39
|
-
function HandlerInertia(map) {
|
|
40
|
-
(0, _classCallCheck2.default)(this, HandlerInertia);
|
|
41
|
-
this.map = map;
|
|
42
|
-
this.clear();
|
|
43
|
-
}
|
|
44
|
-
(0, _createClass2.default)(HandlerInertia, [{
|
|
45
|
-
key: "clear",
|
|
46
|
-
value: function clear() {
|
|
47
|
-
this.inertiaBuffer = [];
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "record",
|
|
51
|
-
value: function record(settings) {
|
|
52
|
-
this.drainInertiaBuffer();
|
|
53
|
-
this.inertiaBuffer.push({
|
|
54
|
-
time: (0, _util.now)(),
|
|
55
|
-
settings: settings
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "drainInertiaBuffer",
|
|
60
|
-
value: function drainInertiaBuffer() {
|
|
61
|
-
var inertia = this.inertiaBuffer;
|
|
62
|
-
var nowTime = (0, _util.now)();
|
|
63
|
-
var cutoff = 160; // msec
|
|
64
|
-
|
|
65
|
-
while (inertia.length > 0 && nowTime - inertia[0].time > cutoff) {
|
|
66
|
-
inertia.shift();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "onMoveEnd",
|
|
71
|
-
value: function onMoveEnd(panInertiaOptions) {
|
|
72
|
-
this.drainInertiaBuffer();
|
|
73
|
-
if (this.inertiaBuffer.length < 2) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
var deltas = {
|
|
77
|
-
zoom: 0,
|
|
78
|
-
bearing: 0,
|
|
79
|
-
pitch: 0,
|
|
80
|
-
pan: new _point.default(0, 0),
|
|
81
|
-
pinchAround: undefined,
|
|
82
|
-
around: undefined
|
|
83
|
-
};
|
|
84
|
-
var _iterator = _createForOfIteratorHelper(this.inertiaBuffer),
|
|
85
|
-
_step;
|
|
86
|
-
try {
|
|
87
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
88
|
-
var settings = _step.value.settings;
|
|
89
|
-
deltas.zoom += settings.zoomDelta || 0;
|
|
90
|
-
deltas.bearing += settings.bearingDelta || 0;
|
|
91
|
-
deltas.pitch += settings.pitchDelta || 0;
|
|
92
|
-
if (settings.panDelta) {
|
|
93
|
-
deltas.pan._add(settings.panDelta);
|
|
94
|
-
}
|
|
95
|
-
if (settings.around) {
|
|
96
|
-
deltas.around = settings.around;
|
|
97
|
-
}
|
|
98
|
-
if (settings.pinchAround) {
|
|
99
|
-
deltas.pinchAround = settings.pinchAround;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
} catch (err) {
|
|
103
|
-
_iterator.e(err);
|
|
104
|
-
} finally {
|
|
105
|
-
_iterator.f();
|
|
106
|
-
}
|
|
107
|
-
var lastEntry = this.inertiaBuffer[this.inertiaBuffer.length - 1];
|
|
108
|
-
var duration = lastEntry.time - this.inertiaBuffer[0].time;
|
|
109
|
-
var easeOptions = {};
|
|
110
|
-
if (deltas.pan.mag()) {
|
|
111
|
-
var result = calculateEasing(deltas.pan.mag(), duration, merge({}, defaultPanInertiaOptions, panInertiaOptions || {}));
|
|
112
|
-
easeOptions.offset = deltas.pan.mult(result.amount / deltas.pan.mag());
|
|
113
|
-
easeOptions.center = this.map.transform.center;
|
|
114
|
-
extendDuration(easeOptions, result);
|
|
115
|
-
}
|
|
116
|
-
if (deltas.zoom) {
|
|
117
|
-
var _result = calculateEasing(deltas.zoom, duration, defaultZoomInertiaOptions);
|
|
118
|
-
easeOptions.zoom = this.map.transform.zoom + _result.amount;
|
|
119
|
-
extendDuration(easeOptions, _result);
|
|
120
|
-
}
|
|
121
|
-
if (deltas.bearing) {
|
|
122
|
-
var _result2 = calculateEasing(deltas.bearing, duration, defaultBearingInertiaOptions);
|
|
123
|
-
easeOptions.bearing = this.map.transform.bearing + (0, _util.clamp)(_result2.amount, -179, 179);
|
|
124
|
-
extendDuration(easeOptions, _result2);
|
|
125
|
-
}
|
|
126
|
-
if (deltas.pitch) {
|
|
127
|
-
var _result3 = calculateEasing(deltas.pitch, duration, defaultPitchInertiaOptions);
|
|
128
|
-
easeOptions.pitch = this.map.transform.pitch + _result3.amount;
|
|
129
|
-
extendDuration(easeOptions, _result3);
|
|
130
|
-
}
|
|
131
|
-
if (easeOptions.zoom || easeOptions.bearing) {
|
|
132
|
-
var last = deltas.pinchAround === undefined ? deltas.around : deltas.pinchAround;
|
|
133
|
-
easeOptions.around = last ? this.map.unproject(last) : this.map.getCenter();
|
|
134
|
-
}
|
|
135
|
-
this.clear();
|
|
136
|
-
return merge(easeOptions, {
|
|
137
|
-
noMoveStart: true
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}]);
|
|
141
|
-
return HandlerInertia;
|
|
142
|
-
}(); // Unfortunately zoom, bearing, etc can't have different durations and easings so
|
|
143
|
-
// we need to choose one. We use the longest duration and it's corresponding easing.
|
|
144
|
-
exports.default = HandlerInertia;
|
|
145
|
-
function extendDuration(easeOptions, result) {
|
|
146
|
-
if (!easeOptions.duration || easeOptions.duration < result.duration) {
|
|
147
|
-
easeOptions.duration = result.duration;
|
|
148
|
-
easeOptions.easing = result.easing;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function calculateEasing(amount, inertiaDuration, inertiaOptions) {
|
|
152
|
-
var maxSpeed = inertiaOptions.maxSpeed,
|
|
153
|
-
linearity = inertiaOptions.linearity,
|
|
154
|
-
deceleration = inertiaOptions.deceleration;
|
|
155
|
-
var speed = (0, _util.clamp)(amount * linearity / (inertiaDuration / 1000), -maxSpeed, maxSpeed);
|
|
156
|
-
var duration = Math.abs(speed) / (deceleration * linearity);
|
|
157
|
-
return {
|
|
158
|
-
easing: inertiaOptions.easing,
|
|
159
|
-
duration: duration * 1000,
|
|
160
|
-
amount: speed * (duration / 2)
|
|
161
|
-
};
|
|
162
|
-
}
|