@antv/l7-map 2.21.0 → 2.21.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/es/camera.js +595 -674
- package/es/earthmap.js +313 -276
- package/es/geo/edge_insets.js +57 -72
- package/es/geo/lng_lat.js +50 -64
- package/es/geo/lng_lat_bounds.js +101 -137
- package/es/geo/mercator.js +23 -35
- package/es/geo/point.js +150 -221
- package/es/geo/simple.js +22 -34
- package/es/geo/transform.js +839 -905
- package/es/handler/blockable_map_event.js +46 -66
- package/es/handler/box_zoom.js +125 -143
- package/es/handler/click_zoom.js +37 -51
- package/es/handler/events/event.js +11 -9
- package/es/handler/events/map_mouse_event.js +39 -54
- package/es/handler/events/map_touch_event.js +54 -73
- package/es/handler/events/map_wheel_event.js +22 -38
- package/es/handler/events/render_event.js +6 -23
- package/es/handler/handler_inertia.js +98 -113
- package/es/handler/handler_manager.js +349 -437
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +98 -110
- package/es/handler/map_event.js +81 -117
- package/es/handler/mouse/mouse_handler.js +81 -100
- package/es/handler/mouse/mousepan_handler.js +16 -39
- package/es/handler/mouse/mousepitch_hander.js +18 -40
- package/es/handler/mouse/mouserotate_hander.js +18 -40
- package/es/handler/mouse/util.js +7 -6
- package/es/handler/scroll_zoom.js +221 -231
- package/es/handler/shim/dblclick_zoom.js +36 -47
- package/es/handler/shim/drag_pan.js +41 -50
- package/es/handler/shim/drag_rotate.js +38 -48
- package/es/handler/shim/touch_zoom_rotate.js +68 -79
- package/es/handler/tap/single_tap_recognizer.js +60 -80
- package/es/handler/tap/tap_drag_zoom.js +72 -89
- package/es/handler/tap/tap_recognizer.js +37 -45
- package/es/handler/tap/tap_zoom.js +67 -95
- package/es/handler/touch/touch_pan.js +77 -96
- package/es/handler/touch/touch_pitch.js +61 -79
- package/es/handler/touch/touch_rotate.js +47 -67
- package/es/handler/touch/touch_zoom.js +29 -46
- package/es/handler/touch/two_touch.js +79 -104
- package/es/hash.js +75 -88
- package/es/map.js +318 -284
- package/es/util.js +18 -37
- package/es/utils/Aabb.js +60 -100
- package/es/utils/dom.js +32 -55
- package/es/utils/performance.js +25 -29
- package/es/utils/primitives.js +33 -43
- package/es/utils/task_queue.js +47 -76
- package/lib/camera.d.ts +86 -0
- package/lib/camera.js +597 -672
- package/lib/earthmap.d.ts +69 -0
- package/lib/earthmap.js +314 -276
- package/lib/geo/edge_insets.d.ts +54 -0
- package/lib/geo/edge_insets.js +58 -70
- package/lib/geo/lng_lat.d.ts +18 -0
- package/lib/geo/lng_lat.js +50 -62
- package/lib/geo/lng_lat_bounds.d.ts +25 -0
- package/lib/geo/lng_lat_bounds.js +102 -136
- package/lib/geo/mercator.d.ts +30 -0
- package/lib/geo/mercator.js +26 -37
- package/lib/geo/point.d.ts +40 -0
- package/lib/geo/point.js +151 -220
- package/lib/geo/simple.d.ts +30 -0
- package/lib/geo/simple.js +25 -36
- package/lib/geo/transform.d.ts +198 -0
- package/lib/geo/transform.js +844 -907
- package/lib/handler/IHandler.d.ts +34 -0
- package/lib/handler/blockable_map_event.d.ts +17 -0
- package/lib/handler/blockable_map_event.js +48 -65
- package/lib/handler/box_zoom.d.ts +59 -0
- package/lib/handler/box_zoom.js +126 -143
- package/lib/handler/click_zoom.d.ts +16 -0
- package/lib/handler/click_zoom.js +38 -50
- package/lib/handler/events/event.d.ts +4 -0
- package/lib/handler/events/event.js +12 -9
- package/lib/handler/events/index.d.ts +4 -0
- package/lib/handler/events/index.js +3 -3
- package/lib/handler/events/map_mouse_event.d.ts +34 -0
- package/lib/handler/events/map_mouse_event.js +41 -52
- package/lib/handler/events/map_touch_event.d.ts +57 -0
- package/lib/handler/events/map_touch_event.js +56 -71
- package/lib/handler/events/map_wheel_event.d.ts +33 -0
- package/lib/handler/events/map_wheel_event.js +23 -37
- package/lib/handler/events/render_event.d.ts +5 -0
- package/lib/handler/events/render_event.js +7 -22
- package/lib/handler/handler_inertia.d.ts +23 -0
- package/lib/handler/handler_inertia.js +102 -112
- package/lib/handler/handler_manager.d.ts +61 -0
- package/lib/handler/handler_manager.js +351 -437
- package/lib/handler/handler_util.d.ts +4 -0
- package/lib/handler/handler_util.js +2 -2
- package/lib/handler/keyboard.d.ts +36 -0
- package/lib/handler/keyboard.js +98 -110
- package/lib/handler/map_event.d.ts +29 -0
- package/lib/handler/map_event.js +83 -116
- package/lib/handler/mouse/index.d.ts +4 -0
- package/lib/handler/mouse/index.js +3 -3
- package/lib/handler/mouse/mouse_handler.d.ts +22 -0
- package/lib/handler/mouse/mouse_handler.js +83 -99
- package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
- package/lib/handler/mouse/mousepan_handler.js +19 -38
- package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
- package/lib/handler/mouse/mousepitch_hander.js +21 -39
- package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
- package/lib/handler/mouse/mouserotate_hander.js +21 -39
- package/lib/handler/mouse/util.d.ts +6 -0
- package/lib/handler/mouse/util.js +7 -7
- package/lib/handler/scroll_zoom.d.ts +93 -0
- package/lib/handler/scroll_zoom.js +221 -231
- package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
- package/lib/handler/shim/dblclick_zoom.js +37 -46
- package/lib/handler/shim/drag_pan.d.ts +61 -0
- package/lib/handler/shim/drag_pan.js +42 -49
- package/lib/handler/shim/drag_rotate.d.ts +46 -0
- package/lib/handler/shim/drag_rotate.js +39 -47
- package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
- package/lib/handler/shim/touch_zoom_rotate.js +69 -78
- package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
- package/lib/handler/tap/single_tap_recognizer.js +63 -79
- package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_drag_zoom.js +74 -88
- package/lib/handler/tap/tap_recognizer.d.ts +17 -0
- package/lib/handler/tap/tap_recognizer.js +41 -47
- package/lib/handler/tap/tap_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_zoom.js +69 -94
- package/lib/handler/touch/index.d.ts +5 -0
- package/lib/handler/touch/index.js +4 -4
- package/lib/handler/touch/touch_pan.d.ts +30 -0
- package/lib/handler/touch/touch_pan.js +79 -95
- package/lib/handler/touch/touch_pitch.d.ts +13 -0
- package/lib/handler/touch/touch_pitch.js +64 -78
- package/lib/handler/touch/touch_rotate.d.ts +12 -0
- package/lib/handler/touch/touch_rotate.js +50 -66
- package/lib/handler/touch/touch_zoom.d.ts +12 -0
- package/lib/handler/touch/touch_zoom.js +32 -45
- package/lib/handler/touch/two_touch.d.ts +23 -0
- package/lib/handler/touch/two_touch.js +81 -103
- package/lib/hash.d.ts +14 -0
- package/lib/hash.js +75 -88
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -4
- package/lib/interface.d.ts +34 -0
- package/lib/map.d.ts +70 -0
- package/lib/map.js +319 -284
- package/lib/util.d.ts +25 -0
- package/lib/util.js +20 -36
- package/lib/utils/Aabb.d.ts +12 -0
- package/lib/utils/Aabb.js +61 -99
- package/lib/utils/dom.d.ts +4 -0
- package/lib/utils/dom.js +34 -55
- package/lib/utils/performance.d.ts +17 -0
- package/lib/utils/performance.js +25 -29
- package/lib/utils/primitives.d.ts +6 -0
- package/lib/utils/primitives.js +34 -42
- package/lib/utils/task_queue.d.ts +13 -0
- package/lib/utils/task_queue.js +47 -76
- package/package.json +25 -32
package/es/utils/task_queue.js
CHANGED
|
@@ -1,89 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
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; } } }; }
|
|
4
|
-
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); }
|
|
5
|
-
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; }
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
2
|
// can't mark opaque due to https://github.com/flowtype/flow-remove-types/pull/61
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
|
|
4
|
+
class TaskQueue {
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "queue", void 0);
|
|
7
|
+
_defineProperty(this, "id", void 0);
|
|
8
|
+
_defineProperty(this, "cleared", void 0);
|
|
9
|
+
_defineProperty(this, "currentlyRunning", void 0);
|
|
10
10
|
this.queue = [];
|
|
11
11
|
this.id = 0;
|
|
12
12
|
this.cleared = false;
|
|
13
13
|
this.currentlyRunning = false;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _iterator = _createForOfIteratorHelper(queue),
|
|
33
|
-
_step;
|
|
34
|
-
try {
|
|
35
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36
|
-
var task = _step.value;
|
|
37
|
-
if (task.id === id) {
|
|
38
|
-
task.cancelled = true;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
_iterator.e(err);
|
|
44
|
-
} finally {
|
|
45
|
-
_iterator.f();
|
|
15
|
+
add(callback) {
|
|
16
|
+
const id = ++this.id;
|
|
17
|
+
const queue = this.queue;
|
|
18
|
+
queue.push({
|
|
19
|
+
callback,
|
|
20
|
+
id,
|
|
21
|
+
cancelled: false
|
|
22
|
+
});
|
|
23
|
+
return id;
|
|
24
|
+
}
|
|
25
|
+
remove(id) {
|
|
26
|
+
const running = this.currentlyRunning;
|
|
27
|
+
const queue = running ? this.queue.concat(running) : this.queue;
|
|
28
|
+
for (const task of queue) {
|
|
29
|
+
if (task.id === id) {
|
|
30
|
+
task.cancelled = true;
|
|
31
|
+
return;
|
|
46
32
|
}
|
|
47
33
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var timeStamp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
52
|
-
var queue = this.currentlyRunning = this.queue;
|
|
34
|
+
}
|
|
35
|
+
run(timeStamp = 0) {
|
|
36
|
+
const queue = this.currentlyRunning = this.queue;
|
|
53
37
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
61
|
-
var task = _step2.value;
|
|
62
|
-
if (task.cancelled) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
task.callback(timeStamp);
|
|
66
|
-
if (this.cleared) {
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
} catch (err) {
|
|
71
|
-
_iterator2.e(err);
|
|
72
|
-
} finally {
|
|
73
|
-
_iterator2.f();
|
|
38
|
+
// Tasks queued by callbacks in the current queue should be executed
|
|
39
|
+
// on the next run, not the current run.
|
|
40
|
+
this.queue = [];
|
|
41
|
+
for (const task of queue) {
|
|
42
|
+
if (task.cancelled) {
|
|
43
|
+
continue;
|
|
74
44
|
}
|
|
75
|
-
|
|
76
|
-
this.
|
|
77
|
-
|
|
78
|
-
}, {
|
|
79
|
-
key: "clear",
|
|
80
|
-
value: function clear() {
|
|
81
|
-
if (this.currentlyRunning) {
|
|
82
|
-
this.cleared = true;
|
|
45
|
+
task.callback(timeStamp);
|
|
46
|
+
if (this.cleared) {
|
|
47
|
+
break;
|
|
83
48
|
}
|
|
84
|
-
this.queue = [];
|
|
85
49
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
50
|
+
this.cleared = false;
|
|
51
|
+
this.currentlyRunning = false;
|
|
52
|
+
}
|
|
53
|
+
clear() {
|
|
54
|
+
if (this.currentlyRunning) {
|
|
55
|
+
this.cleared = true;
|
|
56
|
+
}
|
|
57
|
+
this.queue = [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
89
60
|
export default TaskQueue;
|
package/lib/camera.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import type { IPaddingOptions } from './geo/edge_insets';
|
|
3
|
+
import type { LngLatLike } from './geo/lng_lat';
|
|
4
|
+
import LngLat from './geo/lng_lat';
|
|
5
|
+
import type { LngLatBoundsLike } from './geo/lng_lat_bounds';
|
|
6
|
+
import type { PointLike } from './geo/point';
|
|
7
|
+
import Transform from './geo/transform';
|
|
8
|
+
import type { IMapOptions } from './interface';
|
|
9
|
+
type CallBack = (_: number) => void;
|
|
10
|
+
export interface ICameraOptions {
|
|
11
|
+
center?: LngLatLike;
|
|
12
|
+
zoom?: number;
|
|
13
|
+
bearing?: number;
|
|
14
|
+
pitch?: number;
|
|
15
|
+
around?: LngLatLike;
|
|
16
|
+
padding?: IPaddingOptions;
|
|
17
|
+
}
|
|
18
|
+
export interface IAnimationOptions {
|
|
19
|
+
duration?: number;
|
|
20
|
+
easing?: (_: number) => number;
|
|
21
|
+
offset?: PointLike;
|
|
22
|
+
animate?: boolean;
|
|
23
|
+
essential?: boolean;
|
|
24
|
+
linear?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export default class Camera extends EventEmitter {
|
|
27
|
+
transform: Transform;
|
|
28
|
+
protected options: IMapOptions;
|
|
29
|
+
protected moving: boolean;
|
|
30
|
+
protected zooming: boolean;
|
|
31
|
+
protected rotating: boolean;
|
|
32
|
+
protected pitching: boolean;
|
|
33
|
+
protected padding: boolean;
|
|
34
|
+
private bearingSnap;
|
|
35
|
+
private easeEndTimeoutID;
|
|
36
|
+
private easeStart;
|
|
37
|
+
private easeOptions;
|
|
38
|
+
private easeId;
|
|
39
|
+
private onEaseFrame;
|
|
40
|
+
private onEaseEnd;
|
|
41
|
+
private easeFrameId;
|
|
42
|
+
private pitchEnabled;
|
|
43
|
+
private rotateEnabled;
|
|
44
|
+
constructor(options: IMapOptions);
|
|
45
|
+
requestRenderFrame(cb: CallBack): number;
|
|
46
|
+
cancelRenderFrame(_: number): void;
|
|
47
|
+
getCenter(): LngLat;
|
|
48
|
+
getZoom(): number;
|
|
49
|
+
getPitch(): number;
|
|
50
|
+
setCenter(center: LngLatLike, eventData?: any): boolean;
|
|
51
|
+
setPitch(pitch: number, eventData?: any): this;
|
|
52
|
+
getBearing(): number;
|
|
53
|
+
panTo(lnglat: LngLatLike, options?: IAnimationOptions, eventData?: any): this;
|
|
54
|
+
panBy(offset: PointLike, options?: IAnimationOptions, eventData?: any): this;
|
|
55
|
+
zoomOut(options?: IAnimationOptions, eventData?: any): this;
|
|
56
|
+
setBearing(bearing: number, eventData?: any): this;
|
|
57
|
+
setZoom(zoom: number, eventData?: any): this;
|
|
58
|
+
zoomIn(options?: IAnimationOptions, eventData?: any): this;
|
|
59
|
+
zoomTo(zoom: number, options?: IAnimationOptions, eventData?: any): this;
|
|
60
|
+
getPadding(): IPaddingOptions;
|
|
61
|
+
setPadding(padding: IPaddingOptions, eventData?: any): this;
|
|
62
|
+
rotateTo(bearing: number, options?: IAnimationOptions, eventData?: any): this;
|
|
63
|
+
resetNorth(options?: IAnimationOptions, eventData?: any): this;
|
|
64
|
+
resetNorthPitch(options?: IAnimationOptions, eventData?: any): this;
|
|
65
|
+
fitBounds(bounds: LngLatBoundsLike, options?: IAnimationOptions & ICameraOptions, eventData?: any): boolean | this;
|
|
66
|
+
cameraForBounds(bounds: LngLatBoundsLike, options?: ICameraOptions): void | (ICameraOptions & IAnimationOptions);
|
|
67
|
+
snapToNorth(options?: IAnimationOptions, eventData?: any): this;
|
|
68
|
+
jumpTo(options?: ICameraOptions, eventData?: any): boolean;
|
|
69
|
+
easeTo(options?: ICameraOptions & IAnimationOptions & {
|
|
70
|
+
easeId?: string;
|
|
71
|
+
noMoveStart?: boolean;
|
|
72
|
+
}, eventData?: any): this;
|
|
73
|
+
flyTo(options?: any, eventData?: any): boolean | this;
|
|
74
|
+
fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: IAnimationOptions & ICameraOptions, eventData?: any): boolean | this;
|
|
75
|
+
stop(allowGestures?: boolean, easeId?: string): this;
|
|
76
|
+
renderFrameCallback: () => void;
|
|
77
|
+
private normalizeBearing;
|
|
78
|
+
private normalizeCenter;
|
|
79
|
+
private fireMoveEvents;
|
|
80
|
+
private prepareEase;
|
|
81
|
+
private afterEase;
|
|
82
|
+
private ease;
|
|
83
|
+
private cameraForBoxAndBearing;
|
|
84
|
+
private fitInternal;
|
|
85
|
+
}
|
|
86
|
+
export {};
|