@antv/l7-map 2.17.12 → 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 +4 -4
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -775
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -422
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -118
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -81
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -167
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -92
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -231
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -92
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -971
- 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 -83
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -200
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -59
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -12
- 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 -75
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -105
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -61
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -39
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -184
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -684
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -10
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -162
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -131
- 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 -131
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -54
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -56
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -56
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -353
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -72
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -96
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -80
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -130
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -120
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -114
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -62
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -115
- 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 -128
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -110
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -88
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -67
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -138
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -156
- 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 -464
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -101
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -133
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -218
- 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 -45
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -106
- package/lib/camera.js +0 -801
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -445
- package/lib/geo/edge_insets.js +0 -129
- package/lib/geo/lng_lat.js +0 -94
- package/lib/geo/lng_lat_bounds.js +0 -177
- package/lib/geo/mercator.js +0 -121
- package/lib/geo/point.js +0 -239
- package/lib/geo/simple.js +0 -123
- package/lib/geo/transform.js +0 -1013
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -92
- package/lib/handler/box_zoom.js +0 -217
- package/lib/handler/click_zoom.js +0 -67
- package/lib/handler/events/event.js +0 -23
- package/lib/handler/events/index.js +0 -31
- package/lib/handler/events/map_mouse_event.js +0 -87
- package/lib/handler/events/map_touch_event.js +0 -119
- package/lib/handler/events/map_wheel_event.js +0 -72
- package/lib/handler/events/render_event.js +0 -52
- package/lib/handler/handler_inertia.js +0 -193
- package/lib/handler/handler_manager.js +0 -714
- package/lib/handler/handler_util.js +0 -17
- package/lib/handler/keyboard.js +0 -172
- package/lib/handler/map_event.js +0 -140
- package/lib/handler/mouse/index.js +0 -31
- package/lib/handler/mouse/mouse_handler.js +0 -141
- package/lib/handler/mouse/mousepan_handler.js +0 -66
- package/lib/handler/mouse/mousepitch_hander.js +0 -67
- package/lib/handler/mouse/mouserotate_hander.js +0 -67
- package/lib/handler/mouse/util.js +0 -26
- package/lib/handler/scroll_zoom.js +0 -367
- package/lib/handler/shim/dblclick_zoom.js +0 -80
- package/lib/handler/shim/drag_pan.js +0 -105
- package/lib/handler/shim/drag_rotate.js +0 -88
- package/lib/handler/shim/touch_zoom_rotate.js +0 -139
- package/lib/handler/tap/single_tap_recognizer.js +0 -131
- package/lib/handler/tap/tap_drag_zoom.js +0 -124
- package/lib/handler/tap/tap_recognizer.js +0 -78
- package/lib/handler/tap/tap_zoom.js +0 -124
- package/lib/handler/touch/index.js +0 -39
- package/lib/handler/touch/touch_pan.js +0 -138
- package/lib/handler/touch/touch_pitch.js +0 -120
- package/lib/handler/touch/touch_rotate.js +0 -99
- package/lib/handler/touch/touch_zoom.js +0 -78
- package/lib/handler/touch/two_touch.js +0 -148
- package/lib/hash.js +0 -169
- package/lib/index.js +0 -57
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -489
- package/lib/util.js +0 -135
- package/lib/utils/Aabb.js +0 -143
- package/lib/utils/dom.js +0 -233
- package/lib/utils/performance.js +0 -72
- package/lib/utils/primitives.js +0 -57
- package/lib/utils/task_queue.js +0 -115
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _get from "@babel/runtime/helpers/esm/get";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
-
|
|
8
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
-
|
|
10
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
-
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
import TwoTouchHandler from "./two_touch";
|
|
14
|
-
var ZOOM_THRESHOLD = 0.1;
|
|
15
|
-
|
|
16
|
-
function getZoomDelta(distance, lastDistance) {
|
|
17
|
-
return Math.log(distance / lastDistance) / Math.LN2;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var TouchZoomHandler = /*#__PURE__*/function (_TwoTouchHandler) {
|
|
21
|
-
_inherits(TouchZoomHandler, _TwoTouchHandler);
|
|
22
|
-
|
|
23
|
-
var _super = _createSuper(TouchZoomHandler);
|
|
24
|
-
|
|
25
|
-
function TouchZoomHandler() {
|
|
26
|
-
_classCallCheck(this, TouchZoomHandler);
|
|
27
|
-
|
|
28
|
-
return _super.apply(this, arguments);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
_createClass(TouchZoomHandler, [{
|
|
32
|
-
key: "reset",
|
|
33
|
-
value: function reset() {
|
|
34
|
-
_get(_getPrototypeOf(TouchZoomHandler.prototype), "reset", this).call(this); // @ts-ignore
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
delete this.distance; // @ts-ignore
|
|
38
|
-
|
|
39
|
-
delete this.startDistance;
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "start",
|
|
43
|
-
value: function start(points) {
|
|
44
|
-
this.startDistance = this.distance = points[0].dist(points[1]);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "move",
|
|
48
|
-
value: function move(points, pinchAround) {
|
|
49
|
-
var lastDistance = this.distance;
|
|
50
|
-
this.distance = points[0].dist(points[1]);
|
|
51
|
-
|
|
52
|
-
if (!this.active && Math.abs(getZoomDelta(this.distance, this.startDistance)) < ZOOM_THRESHOLD) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.active = true;
|
|
57
|
-
return {
|
|
58
|
-
zoomDelta: getZoomDelta(this.distance, lastDistance),
|
|
59
|
-
pinchAround: pinchAround
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}]);
|
|
63
|
-
|
|
64
|
-
return TouchZoomHandler;
|
|
65
|
-
}(TwoTouchHandler);
|
|
66
|
-
|
|
67
|
-
export { TouchZoomHandler as default };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Point from '../../geo/point';
|
|
2
|
-
export default class TwoTouchHandler {
|
|
3
|
-
protected enabled: boolean;
|
|
4
|
-
protected active: boolean;
|
|
5
|
-
protected firstTwoTouches: [number, number];
|
|
6
|
-
protected vector: Point;
|
|
7
|
-
protected startVector: Point;
|
|
8
|
-
protected aroundCenter: boolean;
|
|
9
|
-
constructor();
|
|
10
|
-
reset(): void;
|
|
11
|
-
start(points: [Point, Point]): void;
|
|
12
|
-
move(points: [Point, Point], pinchAround: Point | null, e: TouchEvent): void;
|
|
13
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
14
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
15
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
16
|
-
touchcancel(): void;
|
|
17
|
-
enable(options?: {
|
|
18
|
-
around?: 'center';
|
|
19
|
-
}): void;
|
|
20
|
-
disable(): void;
|
|
21
|
-
isEnabled(): boolean;
|
|
22
|
-
isActive(): boolean;
|
|
23
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import DOM from "../../utils/dom";
|
|
6
|
-
|
|
7
|
-
var TwoTouchHandler = /*#__PURE__*/function () {
|
|
8
|
-
function TwoTouchHandler() {
|
|
9
|
-
_classCallCheck(this, TwoTouchHandler);
|
|
10
|
-
|
|
11
|
-
this.reset();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
_createClass(TwoTouchHandler, [{
|
|
15
|
-
key: "reset",
|
|
16
|
-
value: function reset() {
|
|
17
|
-
this.active = false; // @ts-ignore
|
|
18
|
-
|
|
19
|
-
delete this.firstTwoTouches;
|
|
20
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
|
|
22
|
-
}, {
|
|
23
|
-
key: "start",
|
|
24
|
-
value: function start(points) {
|
|
25
|
-
return;
|
|
26
|
-
} // eslint-disable-line
|
|
27
|
-
|
|
28
|
-
}, {
|
|
29
|
-
key: "move",
|
|
30
|
-
value: function move( // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
-
points, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
pinchAround, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
-
e) {
|
|
34
|
-
return;
|
|
35
|
-
} // eslint-disable-line
|
|
36
|
-
|
|
37
|
-
}, {
|
|
38
|
-
key: "touchstart",
|
|
39
|
-
value: function touchstart(e, points, mapTouches) {
|
|
40
|
-
// console.log(e.target, e.targetTouches.length ? e.targetTouches[0].target : null);
|
|
41
|
-
// log('touchstart', points, e.target.innerHTML, e.targetTouches.length ? e.targetTouches[0].target.innerHTML: undefined);
|
|
42
|
-
if (this.firstTwoTouches || mapTouches.length < 2) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier]; // implemented by child classes
|
|
47
|
-
|
|
48
|
-
this.start([points[0], points[1]]);
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "touchmove",
|
|
52
|
-
value: function touchmove(e, points, mapTouches) {
|
|
53
|
-
if (!this.firstTwoTouches) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
e.preventDefault();
|
|
58
|
-
|
|
59
|
-
var _this$firstTwoTouches = _slicedToArray(this.firstTwoTouches, 2),
|
|
60
|
-
idA = _this$firstTwoTouches[0],
|
|
61
|
-
idB = _this$firstTwoTouches[1];
|
|
62
|
-
|
|
63
|
-
var a = getTouchById(mapTouches, points, idA);
|
|
64
|
-
var b = getTouchById(mapTouches, points, idB);
|
|
65
|
-
|
|
66
|
-
if (!a || !b) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var pinchAround = this.aroundCenter ? null : a.add(b).div(2); // implemented by child classes
|
|
71
|
-
|
|
72
|
-
return this.move([a, b], pinchAround, e);
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "touchend",
|
|
76
|
-
value: function touchend(e, points, mapTouches) {
|
|
77
|
-
if (!this.firstTwoTouches) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var _this$firstTwoTouches2 = _slicedToArray(this.firstTwoTouches, 2),
|
|
82
|
-
idA = _this$firstTwoTouches2[0],
|
|
83
|
-
idB = _this$firstTwoTouches2[1];
|
|
84
|
-
|
|
85
|
-
var a = getTouchById(mapTouches, points, idA);
|
|
86
|
-
var b = getTouchById(mapTouches, points, idB);
|
|
87
|
-
|
|
88
|
-
if (a && b) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (this.active) {
|
|
93
|
-
DOM.suppressClick();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
this.reset();
|
|
97
|
-
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "touchcancel",
|
|
100
|
-
value: function touchcancel() {
|
|
101
|
-
this.reset();
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "enable",
|
|
105
|
-
value: function enable(options) {
|
|
106
|
-
this.enabled = true;
|
|
107
|
-
this.aroundCenter = !!options && options.around === 'center';
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
110
|
-
key: "disable",
|
|
111
|
-
value: function disable() {
|
|
112
|
-
this.enabled = false;
|
|
113
|
-
this.reset();
|
|
114
|
-
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "isEnabled",
|
|
117
|
-
value: function isEnabled() {
|
|
118
|
-
return this.enabled;
|
|
119
|
-
}
|
|
120
|
-
}, {
|
|
121
|
-
key: "isActive",
|
|
122
|
-
value: function isActive() {
|
|
123
|
-
return this.active;
|
|
124
|
-
}
|
|
125
|
-
}]);
|
|
126
|
-
|
|
127
|
-
return TwoTouchHandler;
|
|
128
|
-
}();
|
|
129
|
-
|
|
130
|
-
export { TwoTouchHandler as default };
|
|
131
|
-
|
|
132
|
-
function getTouchById(mapTouches, points, identifier) {
|
|
133
|
-
for (var i = 0; i < mapTouches.length; i++) {
|
|
134
|
-
if (mapTouches[i].identifier === identifier) {
|
|
135
|
-
return points[i];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
package/es/hash.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Map } from './map';
|
|
2
|
-
declare class Hash {
|
|
3
|
-
private map;
|
|
4
|
-
private updateHash;
|
|
5
|
-
private hashName?;
|
|
6
|
-
constructor(hashName?: string);
|
|
7
|
-
addTo(map: Map): this;
|
|
8
|
-
remove(): this;
|
|
9
|
-
onHashChange: () => boolean;
|
|
10
|
-
private getCurrentHash;
|
|
11
|
-
private getHashString;
|
|
12
|
-
private updateHashUnthrottled;
|
|
13
|
-
}
|
|
14
|
-
export default Hash;
|
package/es/hash.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
// tslint:disable-next-line:no-submodule-imports
|
|
6
|
-
import { $window } from '@antv/l7-utils';
|
|
7
|
-
import { throttle } from 'lodash';
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Adds the map's position to its page's location hash.
|
|
11
|
-
* Passed as an option to the map object.
|
|
12
|
-
*
|
|
13
|
-
* @returns {Hash} `this`
|
|
14
|
-
*/
|
|
15
|
-
var Hash = /*#__PURE__*/function () {
|
|
16
|
-
function Hash(hashName) {
|
|
17
|
-
var _this = this;
|
|
18
|
-
|
|
19
|
-
_classCallCheck(this, Hash);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "onHashChange", function () {
|
|
22
|
-
var loc = _this.getCurrentHash();
|
|
23
|
-
|
|
24
|
-
if (loc.length >= 3 && !loc.some(function (v) {
|
|
25
|
-
return isNaN(+v);
|
|
26
|
-
})) {
|
|
27
|
-
var bearing = _this.map.dragRotate.isEnabled() && _this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : _this.map.getBearing();
|
|
28
|
-
|
|
29
|
-
_this.map.jumpTo({
|
|
30
|
-
center: [+loc[2], +loc[1]],
|
|
31
|
-
zoom: +loc[0],
|
|
32
|
-
bearing: bearing,
|
|
33
|
-
pitch: +(loc[4] || 0)
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
_defineProperty(this, "getCurrentHash", function () {
|
|
43
|
-
// Get the current hash from location, stripped from its number sign
|
|
44
|
-
var hash = window.location.hash.replace('#', '');
|
|
45
|
-
|
|
46
|
-
if (_this.hashName) {
|
|
47
|
-
// Split the parameter-styled hash into parts and find the value we need
|
|
48
|
-
var keyval;
|
|
49
|
-
hash.split('&').map(function (part) {
|
|
50
|
-
return part.split('=');
|
|
51
|
-
}).forEach(function (part) {
|
|
52
|
-
if (part[0] === _this.hashName) {
|
|
53
|
-
keyval = part;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
return (keyval ? keyval[1] || '' : '').split('/');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return hash.split('/');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
_defineProperty(this, "updateHashUnthrottled", function () {
|
|
63
|
-
var hash = _this.getHashString();
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
window.history.replaceState(window.history.state, '', hash);
|
|
67
|
-
} catch (SecurityError) {// IE11 does not allow this if the page is within an iframe created
|
|
68
|
-
// with iframe.contentWindow.document.write(...).
|
|
69
|
-
// https://github.com/mapbox/mapbox-gl-js/issues/7410
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
this.hashName = hashName && encodeURIComponent(hashName); // Mobile Safari doesn't allow updating the hash more than 100 times per 30 seconds.
|
|
74
|
-
|
|
75
|
-
this.updateHash = throttle(this.updateHashUnthrottled, 30 * 1000 / 100);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_createClass(Hash, [{
|
|
79
|
-
key: "addTo",
|
|
80
|
-
value: function addTo(map) {
|
|
81
|
-
this.map = map;
|
|
82
|
-
$window.addEventListener('hashchange', this.onHashChange, false);
|
|
83
|
-
this.map.on('moveend', this.updateHash);
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "remove",
|
|
88
|
-
value: function remove() {
|
|
89
|
-
$window.removeEventListener('hashchange', this.onHashChange, false);
|
|
90
|
-
this.map.off('moveend', this.updateHash); // clearTimeout(this.updateHash());
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
|
|
93
|
-
delete this.map;
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "getHashString",
|
|
98
|
-
value: function getHashString(mapFeedback) {
|
|
99
|
-
var center = this.map.getCenter();
|
|
100
|
-
var zoom = Math.round(this.map.getZoom() * 100) / 100; // derived from equation: 512px * 2^z / 360 / 10^d < 0.5px
|
|
101
|
-
|
|
102
|
-
var precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
|
|
103
|
-
var m = Math.pow(10, precision);
|
|
104
|
-
var lng = Math.round(center.lng * m) / m;
|
|
105
|
-
var lat = Math.round(center.lat * m) / m;
|
|
106
|
-
var bearing = this.map.getBearing();
|
|
107
|
-
var pitch = this.map.getPitch();
|
|
108
|
-
var hash = '';
|
|
109
|
-
|
|
110
|
-
if (mapFeedback) {
|
|
111
|
-
// new map feedback site has some constraints that don't allow
|
|
112
|
-
// us to use the same hash format as we do for the Map hash option.
|
|
113
|
-
hash += "/".concat(lng, "/").concat(lat, "/").concat(zoom);
|
|
114
|
-
} else {
|
|
115
|
-
hash += "".concat(zoom, "/").concat(lat, "/").concat(lng);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (bearing || pitch) {
|
|
119
|
-
hash += "/".concat(Math.round(bearing * 10) / 10);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (pitch) {
|
|
123
|
-
hash += "/".concat(Math.round(pitch));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.hashName) {
|
|
127
|
-
var hashName = this.hashName;
|
|
128
|
-
var found = false;
|
|
129
|
-
var parts = window.location.hash.slice(1).split('&').map(function (part) {
|
|
130
|
-
var key = part.split('=')[0];
|
|
131
|
-
|
|
132
|
-
if (key === hashName) {
|
|
133
|
-
found = true;
|
|
134
|
-
return "".concat(key, "=").concat(hash);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return part;
|
|
138
|
-
}).filter(function (a) {
|
|
139
|
-
return a;
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
if (!found) {
|
|
143
|
-
parts.push("".concat(hashName, "=").concat(hash));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return "#".concat(parts.join('&'));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return "#".concat(hash);
|
|
150
|
-
}
|
|
151
|
-
}]);
|
|
152
|
-
|
|
153
|
-
return Hash;
|
|
154
|
-
}();
|
|
155
|
-
|
|
156
|
-
export default Hash;
|
package/es/index.d.ts
DELETED
package/es/index.js
DELETED
package/es/interface.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { LngLatBoundsLike } from './geo/lng_lat_bounds';
|
|
2
|
-
export interface IMapOptions {
|
|
3
|
-
hash: boolean;
|
|
4
|
-
style?: any;
|
|
5
|
-
container?: HTMLElement | string;
|
|
6
|
-
canvas?: HTMLCanvasElement;
|
|
7
|
-
center: [number, number];
|
|
8
|
-
zoom: number;
|
|
9
|
-
bearing: number;
|
|
10
|
-
pitch: number;
|
|
11
|
-
interactive: boolean;
|
|
12
|
-
scrollZoom: boolean;
|
|
13
|
-
bounds?: LngLatBoundsLike;
|
|
14
|
-
maxBounds?: LngLatBoundsLike;
|
|
15
|
-
fitBoundsOptions?: any;
|
|
16
|
-
minZoom: number;
|
|
17
|
-
maxZoom: number;
|
|
18
|
-
minPitch: number;
|
|
19
|
-
maxPitch: number;
|
|
20
|
-
boxZoom: boolean;
|
|
21
|
-
dragRotate: boolean;
|
|
22
|
-
dragPan: boolean;
|
|
23
|
-
keyboard: boolean;
|
|
24
|
-
doubleClickZoom: boolean;
|
|
25
|
-
touchZoomRotate: boolean;
|
|
26
|
-
touchPitch: boolean;
|
|
27
|
-
trackResize: boolean;
|
|
28
|
-
renderWorldCopies: boolean;
|
|
29
|
-
bearingSnap: number;
|
|
30
|
-
clickTolerance: number;
|
|
31
|
-
pitchWithRotate: boolean;
|
|
32
|
-
pitchEnabled: boolean;
|
|
33
|
-
rotateEnabled: boolean;
|
|
34
|
-
}
|
package/es/interface.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/map.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import Camera from './camera';
|
|
2
|
-
import './css/l7.css';
|
|
3
|
-
import LngLat, { LngLatLike } from './geo/lng_lat';
|
|
4
|
-
import LngLatBounds, { LngLatBoundsLike } from './geo/lng_lat_bounds';
|
|
5
|
-
import Point, { PointLike } from './geo/point';
|
|
6
|
-
import BoxZoomHandler from './handler/box_zoom';
|
|
7
|
-
import HandlerManager from './handler/handler_manager';
|
|
8
|
-
import KeyboardHandler from './handler/keyboard';
|
|
9
|
-
import ScrollZoomHandler from './handler/scroll_zoom';
|
|
10
|
-
import DoubleClickZoomHandler from './handler/shim/dblclick_zoom';
|
|
11
|
-
import DragPanHandler from './handler/shim/drag_pan';
|
|
12
|
-
import DragRotateHandler from './handler/shim/drag_rotate';
|
|
13
|
-
import TouchZoomRotateHandler from './handler/shim/touch_zoom_rotate';
|
|
14
|
-
import { TouchPitchHandler } from './handler/touch';
|
|
15
|
-
import { IMapOptions } from './interface';
|
|
16
|
-
import { TaskID } from './utils/task_queue';
|
|
17
|
-
type CallBack = (_: number) => void;
|
|
18
|
-
export declare class Map extends Camera {
|
|
19
|
-
doubleClickZoom: DoubleClickZoomHandler;
|
|
20
|
-
dragRotate: DragRotateHandler;
|
|
21
|
-
dragPan: DragPanHandler;
|
|
22
|
-
touchZoomRotate: TouchZoomRotateHandler;
|
|
23
|
-
scrollZoom: ScrollZoomHandler;
|
|
24
|
-
keyboard: KeyboardHandler;
|
|
25
|
-
touchPitch: TouchPitchHandler;
|
|
26
|
-
boxZoom: BoxZoomHandler;
|
|
27
|
-
handlers: HandlerManager;
|
|
28
|
-
private container;
|
|
29
|
-
private canvas;
|
|
30
|
-
private canvasContainer;
|
|
31
|
-
private renderTaskQueue;
|
|
32
|
-
private frame;
|
|
33
|
-
private trackResize;
|
|
34
|
-
private hash;
|
|
35
|
-
constructor(options: Partial<IMapOptions>);
|
|
36
|
-
resize(eventData?: any): this;
|
|
37
|
-
getContainer(): HTMLElement;
|
|
38
|
-
getCanvas(): HTMLCanvasElement;
|
|
39
|
-
getCanvasContainer(): HTMLElement;
|
|
40
|
-
project(lngLat: LngLatLike): Point;
|
|
41
|
-
unproject(point: PointLike): LngLat;
|
|
42
|
-
getBounds(): LngLatBounds;
|
|
43
|
-
getMaxBounds(): LngLatBounds | null;
|
|
44
|
-
setMaxBounds(bounds: LngLatBoundsLike): void;
|
|
45
|
-
setStyle(style: any): void;
|
|
46
|
-
setMinZoom(minZoom?: number): this;
|
|
47
|
-
getMinZoom(): number;
|
|
48
|
-
setMaxZoom(maxZoom?: number): this;
|
|
49
|
-
getMaxZoom(): number;
|
|
50
|
-
setMinPitch(minPitch?: number): this;
|
|
51
|
-
getMinPitch(): number;
|
|
52
|
-
setMaxPitch(maxPitch?: number): this;
|
|
53
|
-
getMaxPitch(): number;
|
|
54
|
-
getRenderWorldCopies(): boolean;
|
|
55
|
-
setRenderWorldCopies(renderWorldCopies?: boolean): void;
|
|
56
|
-
remove(): void;
|
|
57
|
-
requestRenderFrame(cb: CallBack): TaskID;
|
|
58
|
-
cancelRenderFrame(id: TaskID): void;
|
|
59
|
-
triggerRepaint(): void;
|
|
60
|
-
update(time?: number): void;
|
|
61
|
-
private initContainer;
|
|
62
|
-
/**
|
|
63
|
-
* 小程序环境构建容器
|
|
64
|
-
*/
|
|
65
|
-
private initMiniContainer;
|
|
66
|
-
private containerDimensions;
|
|
67
|
-
private onWindowOnline;
|
|
68
|
-
private onWindowResize;
|
|
69
|
-
}
|
|
70
|
-
export {};
|