@antv/l7-map 2.9.21 → 2.9.22-alpha.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 +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
package/lib/map.js
CHANGED
|
@@ -1,93 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
|
-
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
25
|
-
|
|
26
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
-
|
|
28
|
-
var _camera = _interopRequireDefault(require("./camera"));
|
|
29
|
-
|
|
30
|
-
var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
|
|
31
|
-
|
|
32
|
-
var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
|
|
33
|
-
|
|
34
|
-
var _point = _interopRequireDefault(require("./geo/point"));
|
|
35
|
-
|
|
36
|
-
var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
|
|
37
|
-
|
|
38
|
-
var _hash = _interopRequireDefault(require("./hash"));
|
|
39
|
-
|
|
40
|
-
var _util = require("./util");
|
|
41
|
-
|
|
42
|
-
var _performance = require("./utils/performance");
|
|
43
|
-
|
|
44
|
-
var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
|
|
45
|
-
|
|
46
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
47
|
-
|
|
48
|
-
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; } }
|
|
49
|
-
|
|
50
|
-
function loadStyles(css, doc) {
|
|
51
|
-
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
52
|
-
var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
|
|
53
|
-
|
|
54
|
-
if (isMiniAli || isWeChatMiniProgram) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!doc) doc = document;
|
|
59
|
-
|
|
60
|
-
if (!doc) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
65
|
-
|
|
66
|
-
if (!head) {
|
|
67
|
-
head = doc.createElement('head');
|
|
68
|
-
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
69
|
-
|
|
70
|
-
if (body) {
|
|
71
|
-
body.parentNode.insertBefore(head, body);
|
|
72
|
-
} else {
|
|
73
|
-
doc.documentElement.appendChild(head);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
var style = doc.createElement('style');
|
|
78
|
-
style.type = 'text/css';
|
|
79
|
-
|
|
80
|
-
if (style.styleSheet) {
|
|
81
|
-
style.styleSheet.cssText = css;
|
|
82
|
-
} else {
|
|
83
|
-
style.appendChild(doc.createTextNode(css));
|
|
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 });
|
|
84
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);
|
|
85
21
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
22
|
+
// src/map.ts
|
|
23
|
+
var map_exports = {};
|
|
24
|
+
__export(map_exports, {
|
|
25
|
+
Map: () => Map
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(map_exports);
|
|
28
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
29
|
+
var import_lodash = require("lodash");
|
|
30
|
+
var import_camera = __toESM(require("./camera"));
|
|
31
|
+
var import_l7 = require("./css/l7.css");
|
|
32
|
+
var import_lng_lat = __toESM(require("./geo/lng_lat"));
|
|
33
|
+
var import_lng_lat_bounds = __toESM(require("./geo/lng_lat_bounds"));
|
|
34
|
+
var import_point = __toESM(require("./geo/point"));
|
|
35
|
+
var import_handler_manager = __toESM(require("./handler/handler_manager"));
|
|
36
|
+
var import_hash = __toESM(require("./hash"));
|
|
37
|
+
var import_util = require("./util");
|
|
38
|
+
var import_performance = require("./utils/performance");
|
|
39
|
+
var import_task_queue = __toESM(require("./utils/task_queue"));
|
|
91
40
|
var defaultMinZoom = -2;
|
|
92
41
|
var defaultMaxZoom = 22;
|
|
93
42
|
var defaultMinPitch = 0;
|
|
@@ -119,372 +68,241 @@ var DefaultOptions = {
|
|
|
119
68
|
pitchEnabled: true,
|
|
120
69
|
rotateEnabled: true
|
|
121
70
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "doubleClickZoom", void 0);
|
|
134
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dragRotate", void 0);
|
|
135
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dragPan", void 0);
|
|
136
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "touchZoomRotate", void 0);
|
|
137
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scrollZoom", void 0);
|
|
138
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "keyboard", void 0);
|
|
139
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "touchPitch", void 0);
|
|
140
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "boxZoom", void 0);
|
|
141
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handlers", void 0);
|
|
142
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "container", void 0);
|
|
143
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "canvas", void 0);
|
|
144
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "canvasContainer", void 0);
|
|
145
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
|
|
146
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "frame", void 0);
|
|
147
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
|
|
148
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hash", void 0);
|
|
149
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
|
|
150
|
-
_this.update();
|
|
151
|
-
});
|
|
152
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowResize", function (event) {
|
|
153
|
-
if (_this.trackResize) {
|
|
154
|
-
_this.resize({
|
|
155
|
-
originalEvent: event
|
|
156
|
-
}).update();
|
|
71
|
+
var Map = class extends import_camera.default {
|
|
72
|
+
constructor(options) {
|
|
73
|
+
super((0, import_lodash.merge)({}, DefaultOptions, options));
|
|
74
|
+
this.renderTaskQueue = new import_task_queue.default();
|
|
75
|
+
this.trackResize = true;
|
|
76
|
+
this.onWindowOnline = () => {
|
|
77
|
+
this.update();
|
|
78
|
+
};
|
|
79
|
+
this.onWindowResize = (event) => {
|
|
80
|
+
if (this.trackResize) {
|
|
81
|
+
this.resize({ originalEvent: event }).update();
|
|
157
82
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
_this.initMiniContainer();
|
|
83
|
+
};
|
|
84
|
+
if (import_l7_utils.isMini) {
|
|
85
|
+
this.initMiniContainer();
|
|
162
86
|
} else {
|
|
163
|
-
|
|
87
|
+
this.initContainer();
|
|
164
88
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
window.addEventListener('online', _this.onWindowOnline, false);
|
|
172
|
-
window.addEventListener('resize', _this.onWindowResize, false);
|
|
173
|
-
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
89
|
+
this.resize();
|
|
90
|
+
this.handlers = new import_handler_manager.default(this, this.options);
|
|
91
|
+
if (typeof window !== "undefined") {
|
|
92
|
+
window.addEventListener("online", this.onWindowOnline, false);
|
|
93
|
+
window.addEventListener("resize", this.onWindowResize, false);
|
|
94
|
+
window.addEventListener("orientationchange", this.onWindowResize, false);
|
|
174
95
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
var hashName = typeof options.hash === 'string' && options.hash || undefined;
|
|
178
|
-
|
|
96
|
+
if (!import_l7_utils.isMini) {
|
|
97
|
+
const hashName = typeof options.hash === "string" && options.hash || void 0;
|
|
179
98
|
if (options.hash) {
|
|
180
|
-
|
|
99
|
+
this.hash = new import_hash.default(hashName).addTo(this);
|
|
181
100
|
}
|
|
182
101
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
_this.jumpTo({
|
|
102
|
+
if (!this.hash || !this.hash.onHashChange()) {
|
|
103
|
+
this.jumpTo({
|
|
186
104
|
center: options.center,
|
|
187
105
|
zoom: options.zoom,
|
|
188
106
|
bearing: options.bearing,
|
|
189
107
|
pitch: options.pitch
|
|
190
108
|
});
|
|
191
|
-
|
|
192
109
|
if (options.bounds) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
_this.fitBounds(options.bounds, (0, _merge2.default)({}, options.fitBoundsOptions, {
|
|
196
|
-
duration: 0
|
|
197
|
-
}));
|
|
110
|
+
this.resize();
|
|
111
|
+
this.fitBounds(options.bounds, (0, import_lodash.merge)({}, options.fitBoundsOptions, { duration: 0 }));
|
|
198
112
|
}
|
|
199
113
|
}
|
|
200
|
-
|
|
201
|
-
return _this;
|
|
202
114
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var height = dimensions[1];
|
|
210
|
-
this.transform.resize(width, height);
|
|
211
|
-
|
|
212
|
-
if (_l7Utils.isMini) {
|
|
213
|
-
return this;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
var fireMoving = !this.moving;
|
|
217
|
-
|
|
218
|
-
if (fireMoving) {
|
|
219
|
-
this.stop();
|
|
220
|
-
this.emit('movestart', new _l7Utils.$window.Event('movestart', eventData));
|
|
221
|
-
this.emit('move', new _l7Utils.$window.Event('move', eventData));
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
this.emit('resize', new _l7Utils.$window.Event('resize', eventData));
|
|
225
|
-
|
|
226
|
-
if (fireMoving) {
|
|
227
|
-
this.emit('moveend', new _l7Utils.$window.Event('moveend', eventData));
|
|
228
|
-
}
|
|
229
|
-
|
|
115
|
+
resize(eventData) {
|
|
116
|
+
const dimensions = this.containerDimensions();
|
|
117
|
+
const width = dimensions[0];
|
|
118
|
+
const height = dimensions[1];
|
|
119
|
+
this.transform.resize(width, height);
|
|
120
|
+
if (import_l7_utils.isMini) {
|
|
230
121
|
return this;
|
|
231
122
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}, {
|
|
238
|
-
key: "getCanvas",
|
|
239
|
-
value: function getCanvas() {
|
|
240
|
-
return this.canvas;
|
|
241
|
-
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "getCanvasContainer",
|
|
244
|
-
value: function getCanvasContainer() {
|
|
245
|
-
return this.canvasContainer;
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "project",
|
|
249
|
-
value: function project(lngLat) {
|
|
250
|
-
return this.transform.locationPoint(_lng_lat.default.convert(lngLat));
|
|
251
|
-
}
|
|
252
|
-
}, {
|
|
253
|
-
key: "unproject",
|
|
254
|
-
value: function unproject(point) {
|
|
255
|
-
return this.transform.pointLocation(_point.default.convert(point));
|
|
256
|
-
}
|
|
257
|
-
}, {
|
|
258
|
-
key: "getBounds",
|
|
259
|
-
value: function getBounds() {
|
|
260
|
-
return this.transform.getBounds();
|
|
261
|
-
}
|
|
262
|
-
}, {
|
|
263
|
-
key: "getMaxBounds",
|
|
264
|
-
value: function getMaxBounds() {
|
|
265
|
-
return this.transform.getMaxBounds();
|
|
123
|
+
const fireMoving = !this.moving;
|
|
124
|
+
if (fireMoving) {
|
|
125
|
+
this.stop();
|
|
126
|
+
this.emit("movestart", new import_l7_utils.$window.Event("movestart", eventData));
|
|
127
|
+
this.emit("move", new import_l7_utils.$window.Event("move", eventData));
|
|
266
128
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
|
|
129
|
+
this.emit("resize", new import_l7_utils.$window.Event("resize", eventData));
|
|
130
|
+
if (fireMoving) {
|
|
131
|
+
this.emit("moveend", new import_l7_utils.$window.Event("moveend", eventData));
|
|
271
132
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
getContainer() {
|
|
136
|
+
return this.container;
|
|
137
|
+
}
|
|
138
|
+
getCanvas() {
|
|
139
|
+
return this.canvas;
|
|
140
|
+
}
|
|
141
|
+
getCanvasContainer() {
|
|
142
|
+
return this.canvasContainer;
|
|
143
|
+
}
|
|
144
|
+
project(lngLat) {
|
|
145
|
+
return this.transform.locationPoint(import_lng_lat.default.convert(lngLat));
|
|
146
|
+
}
|
|
147
|
+
unproject(point) {
|
|
148
|
+
return this.transform.pointLocation(import_point.default.convert(point));
|
|
149
|
+
}
|
|
150
|
+
getBounds() {
|
|
151
|
+
return this.transform.getBounds();
|
|
152
|
+
}
|
|
153
|
+
getMaxBounds() {
|
|
154
|
+
return this.transform.getMaxBounds();
|
|
155
|
+
}
|
|
156
|
+
setMaxBounds(bounds) {
|
|
157
|
+
this.transform.setMaxBounds(import_lng_lat_bounds.default.convert(bounds));
|
|
158
|
+
}
|
|
159
|
+
setStyle(style) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
setMinZoom(minZoom) {
|
|
163
|
+
minZoom = minZoom === null || minZoom === void 0 ? defaultMinZoom : minZoom;
|
|
164
|
+
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
165
|
+
this.transform.minZoom = minZoom;
|
|
166
|
+
if (this.getZoom() < minZoom) {
|
|
167
|
+
this.setZoom(minZoom);
|
|
292
168
|
}
|
|
169
|
+
return this;
|
|
170
|
+
} else {
|
|
171
|
+
throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);
|
|
293
172
|
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (maxZoom >= this.transform.minZoom) {
|
|
305
|
-
this.transform.maxZoom = maxZoom;
|
|
306
|
-
|
|
307
|
-
if (this.getZoom() > maxZoom) {
|
|
308
|
-
this.setZoom(maxZoom);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return this;
|
|
312
|
-
} else {
|
|
313
|
-
throw new Error('maxZoom must be greater than the current minZoom');
|
|
173
|
+
}
|
|
174
|
+
getMinZoom() {
|
|
175
|
+
return this.transform.minZoom;
|
|
176
|
+
}
|
|
177
|
+
setMaxZoom(maxZoom) {
|
|
178
|
+
maxZoom = maxZoom === null || maxZoom === void 0 ? defaultMaxZoom : maxZoom;
|
|
179
|
+
if (maxZoom >= this.transform.minZoom) {
|
|
180
|
+
this.transform.maxZoom = maxZoom;
|
|
181
|
+
if (this.getZoom() > maxZoom) {
|
|
182
|
+
this.setZoom(maxZoom);
|
|
314
183
|
}
|
|
184
|
+
return this;
|
|
185
|
+
} else {
|
|
186
|
+
throw new Error("maxZoom must be greater than the current minZoom");
|
|
315
187
|
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
331
|
-
this.transform.minPitch = minPitch;
|
|
332
|
-
|
|
333
|
-
if (this.getPitch() < minPitch) {
|
|
334
|
-
this.setPitch(minPitch);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return this;
|
|
338
|
-
} else {
|
|
339
|
-
throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
|
|
188
|
+
}
|
|
189
|
+
getMaxZoom() {
|
|
190
|
+
return this.transform.maxZoom;
|
|
191
|
+
}
|
|
192
|
+
setMinPitch(minPitch) {
|
|
193
|
+
minPitch = minPitch === null || minPitch === void 0 ? defaultMinPitch : minPitch;
|
|
194
|
+
if (minPitch < defaultMinPitch) {
|
|
195
|
+
throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);
|
|
196
|
+
}
|
|
197
|
+
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
198
|
+
this.transform.minPitch = minPitch;
|
|
199
|
+
if (this.getPitch() < minPitch) {
|
|
200
|
+
this.setPitch(minPitch);
|
|
340
201
|
}
|
|
202
|
+
return this;
|
|
203
|
+
} else {
|
|
204
|
+
throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);
|
|
341
205
|
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if (maxPitch >= this.transform.minPitch) {
|
|
357
|
-
this.transform.maxPitch = maxPitch;
|
|
358
|
-
|
|
359
|
-
if (this.getPitch() > maxPitch) {
|
|
360
|
-
this.setPitch(maxPitch);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return this;
|
|
364
|
-
} else {
|
|
365
|
-
throw new Error('maxPitch must be greater than the current minPitch');
|
|
206
|
+
}
|
|
207
|
+
getMinPitch() {
|
|
208
|
+
return this.transform.minPitch;
|
|
209
|
+
}
|
|
210
|
+
setMaxPitch(maxPitch) {
|
|
211
|
+
maxPitch = maxPitch === null || maxPitch === void 0 ? defaultMaxPitch : maxPitch;
|
|
212
|
+
if (maxPitch > defaultMaxPitch) {
|
|
213
|
+
throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
|
|
214
|
+
}
|
|
215
|
+
if (maxPitch >= this.transform.minPitch) {
|
|
216
|
+
this.transform.maxPitch = maxPitch;
|
|
217
|
+
if (this.getPitch() > maxPitch) {
|
|
218
|
+
this.setPitch(maxPitch);
|
|
366
219
|
}
|
|
220
|
+
return this;
|
|
221
|
+
} else {
|
|
222
|
+
throw new Error("maxPitch must be greater than the current minPitch");
|
|
367
223
|
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
224
|
+
}
|
|
225
|
+
getMaxPitch() {
|
|
226
|
+
return this.transform.maxPitch;
|
|
227
|
+
}
|
|
228
|
+
getRenderWorldCopies() {
|
|
229
|
+
return this.transform.renderWorldCopies;
|
|
230
|
+
}
|
|
231
|
+
setRenderWorldCopies(renderWorldCopies) {
|
|
232
|
+
this.transform.renderWorldCopies = !!renderWorldCopies;
|
|
233
|
+
}
|
|
234
|
+
remove() {
|
|
235
|
+
this.container.removeChild(this.canvasContainer);
|
|
236
|
+
this.canvasContainer = null;
|
|
237
|
+
if (this.frame) {
|
|
238
|
+
this.frame.cancel();
|
|
239
|
+
this.frame = null;
|
|
240
|
+
}
|
|
241
|
+
this.renderTaskQueue.clear();
|
|
242
|
+
}
|
|
243
|
+
requestRenderFrame(cb) {
|
|
244
|
+
this.update();
|
|
245
|
+
return this.renderTaskQueue.add(cb);
|
|
246
|
+
}
|
|
247
|
+
cancelRenderFrame(id) {
|
|
248
|
+
return this.renderTaskQueue.remove(id);
|
|
249
|
+
}
|
|
250
|
+
triggerRepaint() {
|
|
251
|
+
if (!this.frame) {
|
|
252
|
+
this.frame = (0, import_util.renderframe)((paintStartTimeStamp) => {
|
|
253
|
+
import_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
391
254
|
this.frame = null;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.renderTaskQueue.clear();
|
|
395
|
-
}
|
|
396
|
-
}, {
|
|
397
|
-
key: "requestRenderFrame",
|
|
398
|
-
value: function requestRenderFrame(cb) {
|
|
399
|
-
this.update();
|
|
400
|
-
return this.renderTaskQueue.add(cb);
|
|
255
|
+
this.update(paintStartTimeStamp);
|
|
256
|
+
});
|
|
401
257
|
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
258
|
+
}
|
|
259
|
+
update(time) {
|
|
260
|
+
if (!this.frame) {
|
|
261
|
+
this.frame = (0, import_util.renderframe)((paintStartTimeStamp) => {
|
|
262
|
+
import_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
263
|
+
this.frame = null;
|
|
264
|
+
this.renderTaskQueue.run(time);
|
|
265
|
+
});
|
|
406
266
|
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
414
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
415
|
-
|
|
416
|
-
_this2.frame = null;
|
|
417
|
-
|
|
418
|
-
_this2.update(paintStartTimeStamp);
|
|
419
|
-
});
|
|
267
|
+
}
|
|
268
|
+
initContainer() {
|
|
269
|
+
if (typeof this.options.container === "string") {
|
|
270
|
+
this.container = window.document.getElementById(this.options.container);
|
|
271
|
+
if (!this.container) {
|
|
272
|
+
throw new Error(`Container '${this.options.container}' not found.`);
|
|
420
273
|
}
|
|
274
|
+
} else if (this.options.container instanceof HTMLElement) {
|
|
275
|
+
this.container = this.options.container;
|
|
276
|
+
} else {
|
|
277
|
+
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
421
278
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (!this.frame) {
|
|
428
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
429
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
430
|
-
|
|
431
|
-
_this3.frame = null;
|
|
432
|
-
|
|
433
|
-
_this3.renderTaskQueue.run(time);
|
|
434
|
-
});
|
|
435
|
-
}
|
|
279
|
+
const container = this.container;
|
|
280
|
+
container.classList.add("l7-map");
|
|
281
|
+
const canvasContainer = this.canvasContainer = import_l7_utils.DOM.create("div", "l7-canvas-container", container);
|
|
282
|
+
if (this.options.interactive) {
|
|
283
|
+
canvasContainer.classList.add("l7-interactive");
|
|
436
284
|
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
this.container
|
|
285
|
+
}
|
|
286
|
+
initMiniContainer() {
|
|
287
|
+
this.container = this.options.canvas;
|
|
288
|
+
this.canvasContainer = this.container;
|
|
289
|
+
}
|
|
290
|
+
containerDimensions() {
|
|
291
|
+
let width = 0;
|
|
292
|
+
let height = 0;
|
|
293
|
+
if (this.container) {
|
|
294
|
+
if (import_l7_utils.isMini) {
|
|
295
|
+
width = this.container.width / import_l7_utils.$window.devicePixelRatio;
|
|
296
|
+
height = this.container.height / import_l7_utils.$window.devicePixelRatio;
|
|
448
297
|
} else {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
var container = this.container;
|
|
453
|
-
container.classList.add('l7-map');
|
|
454
|
-
|
|
455
|
-
var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
|
|
456
|
-
|
|
457
|
-
if (this.options.interactive) {
|
|
458
|
-
canvasContainer.classList.add('l7-interactive');
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}, {
|
|
462
|
-
key: "initMiniContainer",
|
|
463
|
-
value: function initMiniContainer() {
|
|
464
|
-
this.container = this.options.canvas;
|
|
465
|
-
this.canvasContainer = this.container;
|
|
466
|
-
}
|
|
467
|
-
}, {
|
|
468
|
-
key: "containerDimensions",
|
|
469
|
-
value: function containerDimensions() {
|
|
470
|
-
var width = 0;
|
|
471
|
-
var height = 0;
|
|
472
|
-
|
|
473
|
-
if (this.container) {
|
|
474
|
-
if (_l7Utils.isMini) {
|
|
475
|
-
width = this.container.width / _l7Utils.$window.devicePixelRatio;
|
|
476
|
-
height = this.container.height / _l7Utils.$window.devicePixelRatio;
|
|
477
|
-
} else {
|
|
478
|
-
width = this.container.clientWidth;
|
|
479
|
-
height = this.container.clientHeight;
|
|
480
|
-
}
|
|
298
|
+
width = this.container.clientWidth;
|
|
299
|
+
height = this.container.clientHeight;
|
|
481
300
|
}
|
|
482
|
-
|
|
483
|
-
return [width, height];
|
|
484
301
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
exports
|
|
490
|
-
|
|
302
|
+
return [width, height];
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
306
|
+
0 && (module.exports = {
|
|
307
|
+
Map
|
|
308
|
+
});
|