@antv/l7-map 2.9.21 → 2.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/camera.js +115 -85
- package/es/css/l7.css +98 -0
- package/es/earthmap.js +27 -43
- package/es/geo/edge_insets.js +44 -14
- package/es/geo/lng_lat.js +15 -11
- package/es/geo/lng_lat_bounds.js +6 -10
- package/es/geo/mercator.js +24 -12
- package/es/geo/point.js +2 -8
- package/es/geo/simple.js +24 -12
- package/es/geo/transform.js +421 -120
- package/es/handler/IHandler.js +1 -2
- package/es/handler/blockable_map_event.js +13 -14
- package/es/handler/box_zoom.js +43 -27
- package/es/handler/click_zoom.js +3 -8
- package/es/handler/events/event.js +3 -6
- package/es/handler/events/index.js +4 -5
- package/es/handler/events/map_mouse_event.js +30 -20
- package/es/handler/events/map_touch_event.js +55 -25
- package/es/handler/events/map_wheel_event.js +24 -15
- package/es/handler/events/render_event.js +3 -6
- package/es/handler/handler_inertia.js +10 -12
- package/es/handler/handler_manager.js +75 -72
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +20 -15
- package/es/handler/map_event.js +23 -12
- package/es/handler/mouse/index.js +4 -5
- package/es/handler/mouse/mouse_handler.js +17 -21
- package/es/handler/mouse/mousepan_handler.js +5 -5
- package/es/handler/mouse/mousepitch_hander.js +7 -5
- package/es/handler/mouse/mouserotate_hander.js +7 -5
- package/es/handler/mouse/util.js +3 -3
- package/es/handler/scroll_zoom.js +103 -67
- package/es/handler/shim/dblclick_zoom.js +35 -8
- package/es/handler/shim/drag_pan.js +48 -12
- package/es/handler/shim/drag_rotate.js +39 -10
- package/es/handler/shim/touch_zoom_rotate.js +59 -16
- package/es/handler/tap/single_tap_recognizer.js +7 -17
- package/es/handler/tap/tap_drag_zoom.js +5 -18
- package/es/handler/tap/tap_recognizer.js +4 -15
- package/es/handler/tap/tap_zoom.js +4 -13
- package/es/handler/touch/index.js +5 -6
- package/es/handler/touch/touch_pan.js +9 -20
- package/es/handler/touch/touch_pitch.js +11 -23
- package/es/handler/touch/touch_rotate.js +15 -18
- package/es/handler/touch/touch_zoom.js +5 -19
- package/es/handler/touch/two_touch.js +14 -21
- package/es/hash.js +28 -16
- package/es/index.js +2 -3
- package/es/interface.js +1 -2
- package/es/map.js +26 -47
- package/es/util.js +15 -6
- package/es/utils/Aabb.js +11 -12
- package/es/utils/dom.js +30 -11
- package/es/utils/performance.js +10 -6
- package/es/utils/primitives.js +11 -10
- package/es/utils/task_queue.js +6 -13
- package/lib/camera.js +508 -721
- package/lib/css/l7.css +98 -0
- package/lib/earthmap.js +222 -392
- package/lib/geo/edge_insets.js +64 -83
- package/lib/geo/lng_lat.js +65 -81
- package/lib/geo/lng_lat_bounds.js +124 -165
- package/lib/geo/mercator.js +62 -78
- package/lib/geo/point.js +171 -239
- package/lib/geo/simple.js +61 -80
- package/lib/geo/transform.js +470 -653
- package/lib/handler/IHandler.js +17 -2
- package/lib/handler/blockable_map_event.js +63 -83
- package/lib/handler/box_zoom.js +123 -176
- package/lib/handler/click_zoom.js +56 -68
- package/lib/handler/events/event.js +35 -23
- package/lib/handler/events/index.js +35 -29
- package/lib/handler/events/map_mouse_event.js +42 -72
- package/lib/handler/events/map_touch_event.js +45 -80
- package/lib/handler/events/map_wheel_event.js +34 -58
- package/lib/handler/events/render_event.js +31 -52
- package/lib/handler/handler_inertia.js +113 -160
- package/lib/handler/handler_manager.js +379 -620
- package/lib/handler/handler_util.js +28 -10
- package/lib/handler/keyboard.js +114 -146
- package/lib/handler/map_event.js +84 -120
- package/lib/handler/mouse/index.js +35 -29
- package/lib/handler/mouse/mouse_handler.js +90 -123
- package/lib/handler/mouse/mousepan_handler.js +46 -65
- package/lib/handler/mouse/mousepitch_hander.js +44 -63
- package/lib/handler/mouse/mouserotate_hander.js +44 -63
- package/lib/handler/mouse/util.js +38 -20
- package/lib/handler/scroll_zoom.js +175 -258
- package/lib/handler/shim/dblclick_zoom.js +42 -48
- package/lib/handler/shim/drag_pan.js +48 -59
- package/lib/handler/shim/drag_rotate.js +43 -51
- package/lib/handler/shim/touch_zoom_rotate.js +58 -78
- package/lib/handler/tap/single_tap_recognizer.js +84 -117
- package/lib/handler/tap/tap_drag_zoom.js +92 -115
- package/lib/handler/tap/tap_recognizer.js +60 -78
- package/lib/handler/tap/tap_zoom.js +88 -119
- package/lib/handler/touch/index.js +38 -37
- package/lib/handler/touch/touch_pan.js +98 -132
- package/lib/handler/touch/touch_pitch.js +73 -117
- package/lib/handler/touch/touch_rotate.js +58 -94
- package/lib/handler/touch/touch_zoom.js +49 -84
- package/lib/handler/touch/two_touch.js +88 -128
- package/lib/hash.js +100 -133
- package/lib/index.js +19 -31
- package/lib/interface.js +17 -2
- package/lib/map.js +238 -420
- package/lib/util.js +67 -78
- package/lib/utils/Aabb.js +80 -132
- package/lib/utils/dom.js +84 -141
- package/lib/utils/performance.js +54 -42
- package/lib/utils/primitives.js +59 -51
- package/lib/utils/task_queue.js +61 -108
- package/package.json +11 -8
- package/es/camera.js.map +0 -1
- package/es/earthmap.js.map +0 -1
- package/es/geo/edge_insets.js.map +0 -1
- package/es/geo/lng_lat.js.map +0 -1
- package/es/geo/lng_lat_bounds.js.map +0 -1
- package/es/geo/mercator.js.map +0 -1
- package/es/geo/point.js.map +0 -1
- package/es/geo/simple.js.map +0 -1
- package/es/geo/transform.js.map +0 -1
- package/es/handler/IHandler.js.map +0 -1
- package/es/handler/blockable_map_event.js.map +0 -1
- package/es/handler/box_zoom.js.map +0 -1
- package/es/handler/click_zoom.js.map +0 -1
- package/es/handler/events/event.js.map +0 -1
- package/es/handler/events/index.js.map +0 -1
- package/es/handler/events/map_mouse_event.js.map +0 -1
- package/es/handler/events/map_touch_event.js.map +0 -1
- package/es/handler/events/map_wheel_event.js.map +0 -1
- package/es/handler/events/render_event.js.map +0 -1
- package/es/handler/handler_inertia.js.map +0 -1
- package/es/handler/handler_manager.js.map +0 -1
- package/es/handler/handler_util.js.map +0 -1
- package/es/handler/keyboard.js.map +0 -1
- package/es/handler/map_event.js.map +0 -1
- package/es/handler/mouse/index.js.map +0 -1
- package/es/handler/mouse/mouse_handler.js.map +0 -1
- package/es/handler/mouse/mousepan_handler.js.map +0 -1
- package/es/handler/mouse/mousepitch_hander.js.map +0 -1
- package/es/handler/mouse/mouserotate_hander.js.map +0 -1
- package/es/handler/mouse/util.js.map +0 -1
- package/es/handler/scroll_zoom.js.map +0 -1
- package/es/handler/shim/dblclick_zoom.js.map +0 -1
- package/es/handler/shim/drag_pan.js.map +0 -1
- package/es/handler/shim/drag_rotate.js.map +0 -1
- package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/es/handler/tap/single_tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_drag_zoom.js.map +0 -1
- package/es/handler/tap/tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_zoom.js.map +0 -1
- package/es/handler/touch/index.js.map +0 -1
- package/es/handler/touch/touch_pan.js.map +0 -1
- package/es/handler/touch/touch_pitch.js.map +0 -1
- package/es/handler/touch/touch_rotate.js.map +0 -1
- package/es/handler/touch/touch_zoom.js.map +0 -1
- package/es/handler/touch/two_touch.js.map +0 -1
- package/es/hash.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/interface.js.map +0 -1
- package/es/map.js.map +0 -1
- package/es/util.js.map +0 -1
- package/es/utils/Aabb.js.map +0 -1
- package/es/utils/dom.js.map +0 -1
- package/es/utils/performance.js.map +0 -1
- package/es/utils/primitives.js.map +0 -1
- package/es/utils/task_queue.js.map +0 -1
- package/lib/camera.js.map +0 -1
- package/lib/earthmap.js.map +0 -1
- package/lib/geo/edge_insets.js.map +0 -1
- package/lib/geo/lng_lat.js.map +0 -1
- package/lib/geo/lng_lat_bounds.js.map +0 -1
- package/lib/geo/mercator.js.map +0 -1
- package/lib/geo/point.js.map +0 -1
- package/lib/geo/simple.js.map +0 -1
- package/lib/geo/transform.js.map +0 -1
- package/lib/handler/IHandler.js.map +0 -1
- package/lib/handler/blockable_map_event.js.map +0 -1
- package/lib/handler/box_zoom.js.map +0 -1
- package/lib/handler/click_zoom.js.map +0 -1
- package/lib/handler/events/event.js.map +0 -1
- package/lib/handler/events/index.js.map +0 -1
- package/lib/handler/events/map_mouse_event.js.map +0 -1
- package/lib/handler/events/map_touch_event.js.map +0 -1
- package/lib/handler/events/map_wheel_event.js.map +0 -1
- package/lib/handler/events/render_event.js.map +0 -1
- package/lib/handler/handler_inertia.js.map +0 -1
- package/lib/handler/handler_manager.js.map +0 -1
- package/lib/handler/handler_util.js.map +0 -1
- package/lib/handler/keyboard.js.map +0 -1
- package/lib/handler/map_event.js.map +0 -1
- package/lib/handler/mouse/index.js.map +0 -1
- package/lib/handler/mouse/mouse_handler.js.map +0 -1
- package/lib/handler/mouse/mousepan_handler.js.map +0 -1
- package/lib/handler/mouse/mousepitch_hander.js.map +0 -1
- package/lib/handler/mouse/mouserotate_hander.js.map +0 -1
- package/lib/handler/mouse/util.js.map +0 -1
- package/lib/handler/scroll_zoom.js.map +0 -1
- package/lib/handler/shim/dblclick_zoom.js.map +0 -1
- package/lib/handler/shim/drag_pan.js.map +0 -1
- package/lib/handler/shim/drag_rotate.js.map +0 -1
- package/lib/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/lib/handler/tap/single_tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_drag_zoom.js.map +0 -1
- package/lib/handler/tap/tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_zoom.js.map +0 -1
- package/lib/handler/touch/index.js.map +0 -1
- package/lib/handler/touch/touch_pan.js.map +0 -1
- package/lib/handler/touch/touch_pitch.js.map +0 -1
- package/lib/handler/touch/touch_rotate.js.map +0 -1
- package/lib/handler/touch/touch_zoom.js.map +0 -1
- package/lib/handler/touch/two_touch.js.map +0 -1
- package/lib/hash.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interface.js.map +0 -1
- package/lib/map.js.map +0 -1
- package/lib/util.js.map +0 -1
- package/lib/utils/Aabb.js.map +0 -1
- package/lib/utils/dom.js.map +0 -1
- package/lib/utils/performance.js.map +0 -1
- package/lib/utils/primitives.js.map +0 -1
- package/lib/utils/task_queue.js.map +0 -1
package/es/camera.js
CHANGED
|
@@ -5,25 +5,28 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _merge from "lodash/merge";
|
|
9
8
|
|
|
10
9
|
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); }; }
|
|
11
10
|
|
|
12
11
|
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; } }
|
|
13
12
|
|
|
13
|
+
// @ts-ignore
|
|
14
14
|
import { EventEmitter } from 'eventemitter3';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
import { merge } from 'lodash';
|
|
16
|
+
import LngLat from "./geo/lng_lat";
|
|
17
|
+
import LngLatBounds from "./geo/lng_lat_bounds";
|
|
18
|
+
import Point from "./geo/point";
|
|
19
|
+
import Transform from "./geo/transform";
|
|
20
|
+
import { Event } from "./handler/events/event";
|
|
21
|
+
import { clamp, ease as defaultEasing, interpolate, now, pick, prefersReducedMotion, wrap } from "./util";
|
|
22
|
+
|
|
23
|
+
var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
23
24
|
_inherits(Camera, _EventEmitter);
|
|
24
25
|
|
|
25
26
|
var _super = _createSuper(Camera);
|
|
26
27
|
|
|
28
|
+
// public requestRenderFrame: (_: any) => number;
|
|
29
|
+
// public cancelRenderFrame: (_: number) => void;
|
|
27
30
|
function Camera(options) {
|
|
28
31
|
var _this;
|
|
29
32
|
|
|
@@ -31,46 +34,13 @@ var Camera = function (_EventEmitter) {
|
|
|
31
34
|
|
|
32
35
|
_this = _super.call(this);
|
|
33
36
|
|
|
34
|
-
_defineProperty(_assertThisInitialized(_this), "transform", void 0);
|
|
35
|
-
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "options", void 0);
|
|
37
|
-
|
|
38
|
-
_defineProperty(_assertThisInitialized(_this), "moving", void 0);
|
|
39
|
-
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "zooming", void 0);
|
|
41
|
-
|
|
42
|
-
_defineProperty(_assertThisInitialized(_this), "rotating", void 0);
|
|
43
|
-
|
|
44
|
-
_defineProperty(_assertThisInitialized(_this), "pitching", void 0);
|
|
45
|
-
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "padding", void 0);
|
|
47
|
-
|
|
48
|
-
_defineProperty(_assertThisInitialized(_this), "bearingSnap", void 0);
|
|
49
|
-
|
|
50
|
-
_defineProperty(_assertThisInitialized(_this), "easeEndTimeoutID", void 0);
|
|
51
|
-
|
|
52
|
-
_defineProperty(_assertThisInitialized(_this), "easeStart", void 0);
|
|
53
|
-
|
|
54
|
-
_defineProperty(_assertThisInitialized(_this), "easeOptions", void 0);
|
|
55
|
-
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "easeId", void 0);
|
|
57
|
-
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "onEaseFrame", void 0);
|
|
59
|
-
|
|
60
|
-
_defineProperty(_assertThisInitialized(_this), "onEaseEnd", void 0);
|
|
61
|
-
|
|
62
|
-
_defineProperty(_assertThisInitialized(_this), "easeFrameId", void 0);
|
|
63
|
-
|
|
64
|
-
_defineProperty(_assertThisInitialized(_this), "pitchEnabled", void 0);
|
|
65
|
-
|
|
66
|
-
_defineProperty(_assertThisInitialized(_this), "rotateEnabled", void 0);
|
|
67
|
-
|
|
68
37
|
_defineProperty(_assertThisInitialized(_this), "renderFrameCallback", function () {
|
|
69
38
|
var t = Math.min((now() - _this.easeStart) / _this.easeOptions.duration, 1);
|
|
70
39
|
|
|
71
40
|
_this.onEaseFrame(_this.easeOptions.easing(t));
|
|
72
41
|
|
|
73
42
|
if (t < 1) {
|
|
43
|
+
// this.easeFrameId = window.requestAnimationFrame(this.renderFrameCallback);
|
|
74
44
|
_this.easeFrameId = _this.requestRenderFrame(_this.renderFrameCallback);
|
|
75
45
|
} else {
|
|
76
46
|
_this.stop();
|
|
@@ -143,7 +113,7 @@ var Camera = function (_EventEmitter) {
|
|
|
143
113
|
}, {
|
|
144
114
|
key: "panTo",
|
|
145
115
|
value: function panTo(lnglat, options, eventData) {
|
|
146
|
-
return this.easeTo(
|
|
116
|
+
return this.easeTo(merge({
|
|
147
117
|
center: lnglat
|
|
148
118
|
}, options), eventData);
|
|
149
119
|
}
|
|
@@ -178,7 +148,7 @@ var Camera = function (_EventEmitter) {
|
|
|
178
148
|
}, {
|
|
179
149
|
key: "zoomTo",
|
|
180
150
|
value: function zoomTo(zoom, options, eventData) {
|
|
181
|
-
return this.easeTo(
|
|
151
|
+
return this.easeTo(merge({
|
|
182
152
|
zoom: zoom
|
|
183
153
|
}, options), eventData);
|
|
184
154
|
}
|
|
@@ -198,14 +168,14 @@ var Camera = function (_EventEmitter) {
|
|
|
198
168
|
}, {
|
|
199
169
|
key: "rotateTo",
|
|
200
170
|
value: function rotateTo(bearing, options, eventData) {
|
|
201
|
-
return this.easeTo(
|
|
171
|
+
return this.easeTo(merge({
|
|
202
172
|
bearing: bearing
|
|
203
173
|
}, options), eventData);
|
|
204
174
|
}
|
|
205
175
|
}, {
|
|
206
176
|
key: "resetNorth",
|
|
207
177
|
value: function resetNorth(options, eventData) {
|
|
208
|
-
this.rotateTo(0,
|
|
178
|
+
this.rotateTo(0, merge({
|
|
209
179
|
duration: 1000
|
|
210
180
|
}, options), eventData);
|
|
211
181
|
return this;
|
|
@@ -213,7 +183,7 @@ var Camera = function (_EventEmitter) {
|
|
|
213
183
|
}, {
|
|
214
184
|
key: "resetNorthPitch",
|
|
215
185
|
value: function resetNorthPitch(options, eventData) {
|
|
216
|
-
this.easeTo(
|
|
186
|
+
this.easeTo(merge({
|
|
217
187
|
bearing: 0,
|
|
218
188
|
pitch: 0,
|
|
219
189
|
duration: 1000
|
|
@@ -223,13 +193,15 @@ var Camera = function (_EventEmitter) {
|
|
|
223
193
|
}, {
|
|
224
194
|
key: "fitBounds",
|
|
225
195
|
value: function fitBounds(bounds, options, eventData) {
|
|
226
|
-
return this.fitInternal(
|
|
196
|
+
return this.fitInternal( // @ts-ignore
|
|
197
|
+
this.cameraForBounds(bounds, options), options, eventData);
|
|
227
198
|
}
|
|
228
199
|
}, {
|
|
229
200
|
key: "cameraForBounds",
|
|
230
201
|
value: function cameraForBounds(bounds, options) {
|
|
231
202
|
bounds = LngLatBounds.convert(bounds);
|
|
232
|
-
return this.cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), 0,
|
|
203
|
+
return this.cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), 0, // @ts-ignore
|
|
204
|
+
options);
|
|
233
205
|
}
|
|
234
206
|
}, {
|
|
235
207
|
key: "snapToNorth",
|
|
@@ -304,7 +276,7 @@ var Camera = function (_EventEmitter) {
|
|
|
304
276
|
|
|
305
277
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
306
278
|
var eventData = arguments.length > 1 ? arguments[1] : undefined;
|
|
307
|
-
options =
|
|
279
|
+
options = merge({
|
|
308
280
|
offset: [0, 0],
|
|
309
281
|
duration: 500,
|
|
310
282
|
easing: defaultEasing
|
|
@@ -366,7 +338,9 @@ var Camera = function (_EventEmitter) {
|
|
|
366
338
|
}
|
|
367
339
|
|
|
368
340
|
if (_this2.padding) {
|
|
369
|
-
tr.interpolatePadding(startPadding, padding, k);
|
|
341
|
+
tr.interpolatePadding(startPadding, padding, k); // When padding is being applied, Transform#centerPoint is changing continously,
|
|
342
|
+
// thus we need to recalculate offsetPoint every fra,e
|
|
343
|
+
|
|
370
344
|
pointAtOffset = tr.centerPoint.add(offsetAsPoint);
|
|
371
345
|
}
|
|
372
346
|
|
|
@@ -383,7 +357,8 @@ var Camera = function (_EventEmitter) {
|
|
|
383
357
|
_this2.fireMoveEvents(eventData);
|
|
384
358
|
}, function (interruptingEaseId) {
|
|
385
359
|
_this2.afterEase(eventData, interruptingEaseId);
|
|
386
|
-
},
|
|
360
|
+
}, // @ts-ignore
|
|
361
|
+
options);
|
|
387
362
|
return this;
|
|
388
363
|
}
|
|
389
364
|
}, {
|
|
@@ -394,13 +369,14 @@ var Camera = function (_EventEmitter) {
|
|
|
394
369
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
395
370
|
var eventData = arguments.length > 1 ? arguments[1] : undefined;
|
|
396
371
|
|
|
372
|
+
// Fall through to jumpTo if user has set prefers-reduced-motion
|
|
397
373
|
if (!options.essential && prefersReducedMotion()) {
|
|
398
374
|
var coercedOptions = pick(options, ['center', 'zoom', 'bearing', 'pitch', 'around']);
|
|
399
375
|
return this.jumpTo(coercedOptions, eventData);
|
|
400
376
|
}
|
|
401
377
|
|
|
402
378
|
this.stop();
|
|
403
|
-
options =
|
|
379
|
+
options = merge({
|
|
404
380
|
offset: [0, 0],
|
|
405
381
|
speed: 1.2,
|
|
406
382
|
curve: 1.42,
|
|
@@ -423,18 +399,31 @@ var Camera = function (_EventEmitter) {
|
|
|
423
399
|
this.normalizeCenter(center);
|
|
424
400
|
var from = tr.project(locationAtOffset);
|
|
425
401
|
var delta = tr.project(center).sub(from);
|
|
426
|
-
var rho = options.curve;
|
|
427
|
-
|
|
428
|
-
var
|
|
402
|
+
var rho = options.curve; // w₀: Initial visible span, measured in pixels at the initial scale.
|
|
403
|
+
|
|
404
|
+
var w0 = Math.max(tr.width, tr.height); // w₁: Final visible span, measured in pixels with respect to the initial scale.
|
|
405
|
+
|
|
406
|
+
var w1 = w0 / scale; // Length of the flight path as projected onto the ground plane, measured in pixels from
|
|
407
|
+
// the world image origin at the initial scale.
|
|
408
|
+
|
|
429
409
|
var u1 = delta.mag();
|
|
430
410
|
|
|
431
411
|
if ('minZoom' in options) {
|
|
432
|
-
var minZoom = clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);
|
|
412
|
+
var minZoom = clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom); // w<sub>m</sub>: Maximum visible span, measured in pixels with respect to the initial
|
|
413
|
+
// scale.
|
|
414
|
+
|
|
433
415
|
var wMax = w0 / tr.zoomScale(minZoom - startZoom);
|
|
434
416
|
rho = Math.sqrt(wMax / u1 * 2);
|
|
435
|
-
}
|
|
417
|
+
} // ρ²
|
|
418
|
+
|
|
436
419
|
|
|
437
420
|
var rho2 = rho * rho;
|
|
421
|
+
/**
|
|
422
|
+
* rᵢ: Returns the zoom-out factor at one end of the animation.
|
|
423
|
+
*
|
|
424
|
+
* @param i 0 for the ascent or 1 for the descent.
|
|
425
|
+
* @private
|
|
426
|
+
*/
|
|
438
427
|
|
|
439
428
|
function r(i) {
|
|
440
429
|
var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);
|
|
@@ -451,21 +440,27 @@ var Camera = function (_EventEmitter) {
|
|
|
451
440
|
|
|
452
441
|
function tanh(n) {
|
|
453
442
|
return sinh(n) / cosh(n);
|
|
454
|
-
}
|
|
443
|
+
} // r₀: Zoom-out factor during ascent.
|
|
444
|
+
|
|
455
445
|
|
|
456
|
-
var r0 = r(0);
|
|
446
|
+
var r0 = r(0); // w(s): Returns the visible span on the ground, measured in pixels with respect to the
|
|
447
|
+
// initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°.
|
|
457
448
|
|
|
458
449
|
var w = function w(s) {
|
|
459
450
|
return cosh(r0) / cosh(r0 + rho * s);
|
|
460
|
-
};
|
|
451
|
+
}; // u(s): Returns the distance along the flight path as projected onto the ground plane,
|
|
452
|
+
// measured in pixels from the world image origin at the initial scale.
|
|
453
|
+
|
|
461
454
|
|
|
462
455
|
var u = function u(s) {
|
|
463
456
|
return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;
|
|
464
|
-
};
|
|
457
|
+
}; // S: Total length of the flight path, measured in ρ-screenfuls.
|
|
465
458
|
|
|
466
|
-
|
|
459
|
+
|
|
460
|
+
var S = (r(1) - r0) / rho; // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.
|
|
467
461
|
|
|
468
462
|
if (Math.abs(u1) < 0.000001 || !isFinite(S)) {
|
|
463
|
+
// Perform a more or less instantaneous transition if the path is too short.
|
|
469
464
|
if (Math.abs(w0 - w1) < 0.000001) {
|
|
470
465
|
return this.easeTo(options, eventData);
|
|
471
466
|
}
|
|
@@ -499,7 +494,9 @@ var Camera = function (_EventEmitter) {
|
|
|
499
494
|
this.padding = !tr.isPaddingEqual(padding);
|
|
500
495
|
this.prepareEase(eventData, false);
|
|
501
496
|
this.ease(function (k) {
|
|
502
|
-
|
|
497
|
+
// s: The distance traveled along the flight path, measured in ρ-screenfuls.
|
|
498
|
+
var s = k * S; // @ts-ignore
|
|
499
|
+
|
|
503
500
|
var easeScale = 1 / w(s);
|
|
504
501
|
tr.zoom = k === 1 ? zoom : startZoom + tr.scaleZoom(easeScale);
|
|
505
502
|
|
|
@@ -512,7 +509,9 @@ var Camera = function (_EventEmitter) {
|
|
|
512
509
|
}
|
|
513
510
|
|
|
514
511
|
if (_this3.padding) {
|
|
515
|
-
tr.interpolatePadding(startPadding, padding, k);
|
|
512
|
+
tr.interpolatePadding(startPadding, padding, k); // When padding is being applied, Transform#centerPoint is changing continously,
|
|
513
|
+
// thus we need to recalculate offsetPoint every frame
|
|
514
|
+
|
|
516
515
|
pointAtOffset = tr.centerPoint.add(offsetAsPoint);
|
|
517
516
|
}
|
|
518
517
|
|
|
@@ -528,22 +527,34 @@ var Camera = function (_EventEmitter) {
|
|
|
528
527
|
}, {
|
|
529
528
|
key: "fitScreenCoordinates",
|
|
530
529
|
value: function fitScreenCoordinates(p0, p1, bearing, options, eventData) {
|
|
531
|
-
return this.fitInternal(
|
|
530
|
+
return this.fitInternal( // @ts-ignore
|
|
531
|
+
this.cameraForBoxAndBearing(this.transform.pointLocation(Point.convert(p0)), this.transform.pointLocation(Point.convert(p1)), bearing, // @ts-ignore
|
|
532
|
+
options), options, eventData);
|
|
532
533
|
}
|
|
533
534
|
}, {
|
|
534
535
|
key: "stop",
|
|
535
536
|
value: function stop(allowGestures, easeId) {
|
|
536
537
|
if (this.easeFrameId) {
|
|
537
|
-
this.cancelRenderFrame(this.easeFrameId);
|
|
538
|
-
|
|
538
|
+
this.cancelRenderFrame(this.easeFrameId); // @ts-ignore
|
|
539
|
+
|
|
540
|
+
delete this.easeFrameId; // @ts-ignore
|
|
541
|
+
|
|
539
542
|
delete this.onEaseFrame;
|
|
540
543
|
}
|
|
541
544
|
|
|
542
545
|
if (this.onEaseEnd) {
|
|
543
|
-
|
|
546
|
+
// The _onEaseEnd function might emit events which trigger new
|
|
547
|
+
// animation, which sets a new _onEaseEnd. Ensure we don't delete
|
|
548
|
+
// it unintentionally.
|
|
549
|
+
var onEaseEnd = this.onEaseEnd; // @ts-ignore
|
|
550
|
+
|
|
544
551
|
delete this.onEaseEnd;
|
|
545
552
|
onEaseEnd.call(this, easeId);
|
|
546
|
-
}
|
|
553
|
+
} // if (!allowGestures) {
|
|
554
|
+
// const handlers = (this: any).handlers;
|
|
555
|
+
// if (handlers) handlers.stop();
|
|
556
|
+
// }
|
|
557
|
+
|
|
547
558
|
|
|
548
559
|
return this;
|
|
549
560
|
}
|
|
@@ -618,9 +629,12 @@ var Camera = function (_EventEmitter) {
|
|
|
618
629
|
}, {
|
|
619
630
|
key: "afterEase",
|
|
620
631
|
value: function afterEase(eventData, easeId) {
|
|
632
|
+
// if this easing is being stopped to start another easing with
|
|
633
|
+
// the same id then don't fire any events to avoid extra start/stop events
|
|
621
634
|
if (this.easeId && easeId && this.easeId === easeId) {
|
|
622
635
|
return;
|
|
623
|
-
}
|
|
636
|
+
} // @ts-ignore
|
|
637
|
+
|
|
624
638
|
|
|
625
639
|
delete this.easeId;
|
|
626
640
|
var wasZooming = this.zooming;
|
|
@@ -669,7 +683,7 @@ var Camera = function (_EventEmitter) {
|
|
|
669
683
|
right: 0,
|
|
670
684
|
left: 0
|
|
671
685
|
};
|
|
672
|
-
options =
|
|
686
|
+
options = merge({
|
|
673
687
|
padding: defaultPadding,
|
|
674
688
|
offset: [0, 0],
|
|
675
689
|
maxZoom: this.transform.maxZoom
|
|
@@ -685,26 +699,40 @@ var Camera = function (_EventEmitter) {
|
|
|
685
699
|
};
|
|
686
700
|
}
|
|
687
701
|
|
|
688
|
-
options.padding =
|
|
702
|
+
options.padding = merge(defaultPadding, options.padding);
|
|
689
703
|
var tr = this.transform;
|
|
690
|
-
var edgePadding = tr.padding;
|
|
704
|
+
var edgePadding = tr.padding; // We want to calculate the upper right and lower left of the box defined by p0 and p1
|
|
705
|
+
// in a coordinate system rotate to match the destination bearing.
|
|
706
|
+
|
|
691
707
|
var p0world = tr.project(LngLat.convert(p0));
|
|
692
708
|
var p1world = tr.project(LngLat.convert(p1));
|
|
693
709
|
var p0rotated = p0world.rotate(-bearing * Math.PI / 180);
|
|
694
710
|
var p1rotated = p1world.rotate(-bearing * Math.PI / 180);
|
|
695
711
|
var upperRight = new Point(Math.max(p0rotated.x, p1rotated.x), Math.max(p0rotated.y, p1rotated.y));
|
|
696
|
-
var lowerLeft = new Point(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y));
|
|
712
|
+
var lowerLeft = new Point(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y)); // Calculate zoom: consider the original bbox and padding.
|
|
713
|
+
|
|
697
714
|
var size = upperRight.sub(lowerLeft);
|
|
698
|
-
var scaleX = (tr.width - (
|
|
699
|
-
|
|
715
|
+
var scaleX = (tr.width - ( // @ts-ignore
|
|
716
|
+
edgePadding.left + // @ts-ignore
|
|
717
|
+
edgePadding.right + // @ts-ignore
|
|
718
|
+
options.padding.left + // @ts-ignore
|
|
719
|
+
options.padding.right)) / size.x;
|
|
720
|
+
var scaleY = (tr.height - ( // @ts-ignore
|
|
721
|
+
edgePadding.top + // @ts-ignore
|
|
722
|
+
edgePadding.bottom + // @ts-ignore
|
|
723
|
+
options.padding.top + // @ts-ignore
|
|
724
|
+
options.padding.bottom)) / size.y;
|
|
700
725
|
|
|
701
726
|
if (scaleY < 0 || scaleX < 0) {
|
|
702
727
|
return;
|
|
703
728
|
}
|
|
704
729
|
|
|
705
|
-
var zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);
|
|
706
|
-
|
|
707
|
-
var
|
|
730
|
+
var zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom); // Calculate center: apply the zoom, the configured offset, as well as offset that exists as a result of padding.
|
|
731
|
+
|
|
732
|
+
var offset = Point.convert(options.offset); // @ts-ignore
|
|
733
|
+
|
|
734
|
+
var paddingOffsetX = (options.padding.left - options.padding.right) / 2; // @ts-ignore
|
|
735
|
+
|
|
708
736
|
var paddingOffsetY = (options.padding.top - options.padding.bottom) / 2;
|
|
709
737
|
var offsetAtInitialZoom = new Point(offset.x + paddingOffsetX, offset.y + paddingOffsetY);
|
|
710
738
|
var offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / tr.zoomScale(zoom));
|
|
@@ -718,12 +746,15 @@ var Camera = function (_EventEmitter) {
|
|
|
718
746
|
}, {
|
|
719
747
|
key: "fitInternal",
|
|
720
748
|
value: function fitInternal(calculatedOptions, options, eventData) {
|
|
749
|
+
// cameraForBounds warns + returns undefined if unable to fit:
|
|
721
750
|
if (!calculatedOptions) {
|
|
722
751
|
return this;
|
|
723
752
|
}
|
|
724
753
|
|
|
725
|
-
options =
|
|
726
|
-
|
|
754
|
+
options = merge(calculatedOptions, options); // Explictly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.
|
|
755
|
+
|
|
756
|
+
delete options.padding; // @ts-ignore
|
|
757
|
+
|
|
727
758
|
return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData);
|
|
728
759
|
}
|
|
729
760
|
}]);
|
|
@@ -731,5 +762,4 @@ var Camera = function (_EventEmitter) {
|
|
|
731
762
|
return Camera;
|
|
732
763
|
}(EventEmitter);
|
|
733
764
|
|
|
734
|
-
export { Camera as default };
|
|
735
|
-
//# sourceMappingURL=camera.js.map
|
|
765
|
+
export { Camera as default };
|
package/es/css/l7.css
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
.l7-map {
|
|
2
|
+
font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
position: relative;
|
|
5
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.l7-canvas {
|
|
9
|
+
position: absolute;
|
|
10
|
+
left: 0;
|
|
11
|
+
top: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.l7-map:-webkit-full-screen {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.l7-canary {
|
|
20
|
+
background-color: salmon;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.l7-canvas-container.l7-interactive,
|
|
24
|
+
.l7-ctrl-group button.l7-ctrl-compass {
|
|
25
|
+
cursor: -webkit-grab;
|
|
26
|
+
cursor: -moz-grab;
|
|
27
|
+
cursor: grab;
|
|
28
|
+
-moz-user-select: none;
|
|
29
|
+
-webkit-user-select: none;
|
|
30
|
+
-ms-user-select: none;
|
|
31
|
+
user-select: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.l7-canvas-container.l7-interactive.l7-track-pointer {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.l7-canvas-container.l7-interactive:active,
|
|
39
|
+
.l7-ctrl-group button.l7-ctrl-compass:active {
|
|
40
|
+
cursor: -webkit-grabbing;
|
|
41
|
+
cursor: -moz-grabbing;
|
|
42
|
+
cursor: grabbing;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.l7-canvas-container.l7-touch-zoom-rotate,
|
|
46
|
+
.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
|
|
47
|
+
touch-action: pan-x pan-y;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.l7-canvas-container.l7-touch-drag-pan,
|
|
51
|
+
.l7-canvas-container.l7-touch-drag-pan .l7-canvas {
|
|
52
|
+
touch-action: pinch-zoom;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
|
|
56
|
+
.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
|
|
57
|
+
touch-action: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.l7-ctrl-top-left,
|
|
61
|
+
.l7-ctrl-top-right,
|
|
62
|
+
.l7-ctrl-bottom-left,
|
|
63
|
+
.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }
|
|
64
|
+
.l7-ctrl-top-left { top: 0; left: 0; }
|
|
65
|
+
.l7-ctrl-top-right { top: 0; right: 0; }
|
|
66
|
+
.l7-ctrl-bottom-left { bottom: 0; left: 0; }
|
|
67
|
+
.l7-ctrl-bottom-right { right: 0; bottom: 0; }
|
|
68
|
+
|
|
69
|
+
.l7-ctrl {
|
|
70
|
+
clear: both;
|
|
71
|
+
pointer-events: auto;
|
|
72
|
+
|
|
73
|
+
/* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
|
|
74
|
+
transform: translate(0, 0);
|
|
75
|
+
}
|
|
76
|
+
.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }
|
|
77
|
+
.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }
|
|
78
|
+
.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }
|
|
79
|
+
.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
.l7-crosshair,
|
|
83
|
+
.l7-crosshair .l7-interactive,
|
|
84
|
+
.l7-crosshair .l7-interactive:active {
|
|
85
|
+
cursor: crosshair;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.l7-boxzoom {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
width: 0;
|
|
93
|
+
height: 0;
|
|
94
|
+
background: #fff;
|
|
95
|
+
border: 2px dotted #202020;
|
|
96
|
+
opacity: 0.5;
|
|
97
|
+
z-index: 10;
|
|
98
|
+
}
|
package/es/earthmap.js
CHANGED
|
@@ -5,14 +5,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
5
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import _merge from "lodash/merge";
|
|
9
8
|
|
|
10
9
|
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); }; }
|
|
11
10
|
|
|
12
11
|
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; } }
|
|
13
12
|
|
|
14
13
|
import { DOM } from '@antv/l7-utils';
|
|
15
|
-
import
|
|
14
|
+
import { merge } from 'lodash';
|
|
15
|
+
import Camera from "./camera";
|
|
16
16
|
|
|
17
17
|
function loadStyles(css, doc) {
|
|
18
18
|
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
@@ -55,15 +55,17 @@ function loadStyles(css, doc) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
loadStyles(".l7-map {\n font: 12px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;\n overflow: hidden;\n position: relative;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\n.l7-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.l7-map:-webkit-full-screen {\n width: 100%;\n height: 100%;\n}\n\n.l7-canary {\n background-color: salmon;\n}\n\n.l7-canvas-container.l7-interactive,\n.l7-ctrl-group button.l7-ctrl-compass {\n cursor: -webkit-grab;\n cursor: grab;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.l7-canvas-container.l7-interactive.l7-track-pointer {\n cursor: pointer;\n}\n\n.l7-canvas-container.l7-interactive:active,\n.l7-ctrl-group button.l7-ctrl-compass:active {\n cursor: -webkit-grabbing;\n cursor: grabbing;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate,\n.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {\n -ms-touch-action: pan-x pan-y;\n touch-action: pan-x pan-y;\n}\n\n.l7-canvas-container.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: pinch-zoom;\n touch-action: pinch-zoom;\n}\n\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,\n.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {\n -ms-touch-action: none;\n touch-action: none;\n}\n\n.l7-ctrl-top-left,\n.l7-ctrl-top-right,\n.l7-ctrl-bottom-left,\n.l7-ctrl-bottom-right { position: absolute; pointer-events: none; z-index: 2; }\n.l7-ctrl-top-left { top: 0; left: 0; }\n.l7-ctrl-top-right { top: 0; right: 0; }\n.l7-ctrl-bottom-left { bottom: 0; left: 0; }\n.l7-ctrl-bottom-right { right: 0; bottom: 0; }\n\n.l7-ctrl {\n clear: both;\n pointer-events: auto;\n\n /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */\n -webkit-transform: translate(0, 0);\n transform: translate(0, 0);\n}\n.l7-ctrl-top-left .l7-ctrl { margin: 10px 0 0 10px; float: left; }\n.l7-ctrl-top-right .l7-ctrl { margin: 10px 10px 0 0; float: right; }\n.l7-ctrl-bottom-left .l7-ctrl { margin: 0 0 10px 10px; float: left; }\n.l7-ctrl-bottom-right .l7-ctrl { margin: 0 10px 10px 0; float: right; }\n\n\n.l7-crosshair,\n.l7-crosshair .l7-interactive,\n.l7-crosshair .l7-interactive:active {\n cursor: crosshair;\n}\n\n.l7-boxzoom {\n position: absolute;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n background: #fff;\n border: 2px dotted #202020;\n opacity: 0.5;\n z-index: 10;\n}\n");
|
|
58
|
-
import LngLat from
|
|
59
|
-
import LngLatBounds from
|
|
60
|
-
|
|
61
|
-
import
|
|
62
|
-
import
|
|
63
|
-
import {
|
|
64
|
-
import
|
|
58
|
+
import LngLat from "./geo/lng_lat";
|
|
59
|
+
import LngLatBounds from "./geo/lng_lat_bounds"; // @ts-ignore
|
|
60
|
+
|
|
61
|
+
import Point from "./geo/point";
|
|
62
|
+
import HandlerManager from "./handler/handler_manager";
|
|
63
|
+
import { renderframe } from "./util";
|
|
64
|
+
import { PerformanceUtils } from "./utils/performance";
|
|
65
|
+
import TaskQueue from "./utils/task_queue";
|
|
65
66
|
var defaultMinZoom = -2;
|
|
66
|
-
var defaultMaxZoom = 22;
|
|
67
|
+
var defaultMaxZoom = 22; // the default values, but also the valid range
|
|
68
|
+
|
|
67
69
|
var defaultMinPitch = 0;
|
|
68
70
|
var defaultMaxPitch = 60;
|
|
69
71
|
var DefaultOptions = {
|
|
@@ -93,7 +95,7 @@ var DefaultOptions = {
|
|
|
93
95
|
pitchEnabled: true,
|
|
94
96
|
rotateEnabled: true
|
|
95
97
|
};
|
|
96
|
-
export var EarthMap = function (_Camera) {
|
|
98
|
+
export var EarthMap = /*#__PURE__*/function (_Camera) {
|
|
97
99
|
_inherits(EarthMap, _Camera);
|
|
98
100
|
|
|
99
101
|
var _super = _createSuper(EarthMap);
|
|
@@ -103,36 +105,10 @@ export var EarthMap = function (_Camera) {
|
|
|
103
105
|
|
|
104
106
|
_classCallCheck(this, EarthMap);
|
|
105
107
|
|
|
106
|
-
_this = _super.call(this,
|
|
107
|
-
|
|
108
|
-
_defineProperty(_assertThisInitialized(_this), "doubleClickZoom", void 0);
|
|
109
|
-
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "dragRotate", void 0);
|
|
111
|
-
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "dragPan", void 0);
|
|
113
|
-
|
|
114
|
-
_defineProperty(_assertThisInitialized(_this), "touchZoomRotate", void 0);
|
|
115
|
-
|
|
116
|
-
_defineProperty(_assertThisInitialized(_this), "scrollZoom", void 0);
|
|
117
|
-
|
|
118
|
-
_defineProperty(_assertThisInitialized(_this), "keyboard", void 0);
|
|
119
|
-
|
|
120
|
-
_defineProperty(_assertThisInitialized(_this), "touchPitch", void 0);
|
|
121
|
-
|
|
122
|
-
_defineProperty(_assertThisInitialized(_this), "boxZoom", void 0);
|
|
123
|
-
|
|
124
|
-
_defineProperty(_assertThisInitialized(_this), "handlers", void 0);
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "container", void 0);
|
|
127
|
-
|
|
128
|
-
_defineProperty(_assertThisInitialized(_this), "canvas", void 0);
|
|
129
|
-
|
|
130
|
-
_defineProperty(_assertThisInitialized(_this), "canvasContainer", void 0);
|
|
108
|
+
_this = _super.call(this, merge({}, DefaultOptions, options));
|
|
131
109
|
|
|
132
110
|
_defineProperty(_assertThisInitialized(_this), "renderTaskQueue", new TaskQueue());
|
|
133
111
|
|
|
134
|
-
_defineProperty(_assertThisInitialized(_this), "frame", void 0);
|
|
135
|
-
|
|
136
112
|
_defineProperty(_assertThisInitialized(_this), "trackResize", true);
|
|
137
113
|
|
|
138
114
|
_defineProperty(_assertThisInitialized(_this), "onWindowOnline", function () {
|
|
@@ -167,7 +143,8 @@ export var EarthMap = function (_Camera) {
|
|
|
167
143
|
value: function resize(eventData) {
|
|
168
144
|
var dimensions = this.containerDimensions();
|
|
169
145
|
var width = dimensions[0];
|
|
170
|
-
var height = dimensions[1];
|
|
146
|
+
var height = dimensions[1]; // this.resizeCanvas(width, height);
|
|
147
|
+
|
|
171
148
|
this.transform.resize(width, height);
|
|
172
149
|
var fireMoving = !this.moving;
|
|
173
150
|
|
|
@@ -406,7 +383,14 @@ export var EarthMap = function (_Camera) {
|
|
|
406
383
|
|
|
407
384
|
if (this.options.interactive) {
|
|
408
385
|
canvasContainer.classList.add('l7-interactive');
|
|
409
|
-
}
|
|
386
|
+
} // this.canvas = DOM.create(
|
|
387
|
+
// 'canvas',
|
|
388
|
+
// 'l7-canvas',
|
|
389
|
+
// canvasContainer,
|
|
390
|
+
// ) as HTMLCanvasElement;
|
|
391
|
+
// this.canvas.setAttribute('tabindex', '-');
|
|
392
|
+
// this.canvas.setAttribute('aria-label', 'Map');
|
|
393
|
+
|
|
410
394
|
}
|
|
411
395
|
}, {
|
|
412
396
|
key: "containerDimensions",
|
|
@@ -426,12 +410,12 @@ export var EarthMap = function (_Camera) {
|
|
|
426
410
|
value: function resizeCanvas(width, height) {
|
|
427
411
|
var pixelRatio = DOM.DPR || 1;
|
|
428
412
|
this.canvas.width = pixelRatio * width;
|
|
429
|
-
this.canvas.height = pixelRatio * height;
|
|
413
|
+
this.canvas.height = pixelRatio * height; // Maintain the same canvas size, potentially downscaling it for HiDPI displays
|
|
414
|
+
|
|
430
415
|
this.canvas.style.width = "".concat(width, "px");
|
|
431
416
|
this.canvas.style.height = "".concat(height, "px");
|
|
432
417
|
}
|
|
433
418
|
}]);
|
|
434
419
|
|
|
435
420
|
return EarthMap;
|
|
436
|
-
}(Camera);
|
|
437
|
-
//# sourceMappingURL=earthmap.js.map
|
|
421
|
+
}(Camera);
|