@antv/l7-map 2.18.0 → 2.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -718
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -369
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -108
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -73
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -154
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -84
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -224
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -87
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -961
- package/es/handler/IHandler.d.ts +0 -34
- package/es/handler/IHandler.js +0 -1
- package/es/handler/blockable_map_event.d.ts +0 -17
- package/es/handler/blockable_map_event.js +0 -78
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -180
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -54
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -11
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -64
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -95
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -50
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -26
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -157
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -577
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -9
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -143
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -125
- package/es/handler/mouse/index.d.ts +0 -4
- package/es/handler/mouse/index.js +0 -4
- package/es/handler/mouse/mouse_handler.d.ts +0 -22
- package/es/handler/mouse/mouse_handler.js +0 -118
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -44
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -46
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -46
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -11
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -325
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -67
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -84
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -74
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -115
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -97
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -106
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -54
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -109
- package/es/handler/touch/index.d.ts +0 -5
- package/es/handler/touch/index.js +0 -5
- package/es/handler/touch/touch_pan.d.ts +0 -30
- package/es/handler/touch/touch_pan.js +0 -110
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -93
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -77
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -54
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -125
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -134
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- package/es/interface.d.ts +0 -34
- package/es/interface.js +0 -1
- package/es/map.d.ts +0 -70
- package/es/map.js +0 -387
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -88
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -112
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -140
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -47
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -89
- package/lib/camera.js +0 -724
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -376
- package/lib/geo/edge_insets.js +0 -114
- package/lib/geo/lng_lat.js +0 -81
- package/lib/geo/lng_lat_bounds.js +0 -161
- package/lib/geo/mercator.js +0 -100
- package/lib/geo/point.js +0 -231
- package/lib/geo/simple.js +0 -104
- package/lib/geo/transform.js +0 -971
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -84
- package/lib/handler/box_zoom.js +0 -186
- package/lib/handler/click_zoom.js +0 -61
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.js +0 -70
- package/lib/handler/events/map_touch_event.js +0 -100
- package/lib/handler/events/map_wheel_event.js +0 -57
- package/lib/handler/events/render_event.js +0 -33
- package/lib/handler/handler_inertia.js +0 -162
- package/lib/handler/handler_manager.js +0 -584
- package/lib/handler/handler_util.js +0 -15
- package/lib/handler/keyboard.js +0 -151
- package/lib/handler/map_event.js +0 -131
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.js +0 -124
- package/lib/handler/mouse/mousepan_handler.js +0 -49
- package/lib/handler/mouse/mousepitch_hander.js +0 -51
- package/lib/handler/mouse/mouserotate_hander.js +0 -51
- package/lib/handler/mouse/util.js +0 -22
- package/lib/handler/scroll_zoom.js +0 -333
- package/lib/handler/shim/dblclick_zoom.js +0 -74
- package/lib/handler/shim/drag_pan.js +0 -91
- package/lib/handler/shim/drag_rotate.js +0 -81
- package/lib/handler/shim/touch_zoom_rotate.js +0 -122
- package/lib/handler/tap/single_tap_recognizer.js +0 -106
- package/lib/handler/tap/tap_drag_zoom.js +0 -112
- package/lib/handler/tap/tap_recognizer.js +0 -63
- package/lib/handler/tap/tap_zoom.js +0 -115
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.js +0 -117
- package/lib/handler/touch/touch_pitch.js +0 -98
- package/lib/handler/touch/touch_rotate.js +0 -82
- package/lib/handler/touch/touch_zoom.js +0 -59
- package/lib/handler/touch/two_touch.js +0 -131
- package/lib/hash.js +0 -143
- package/lib/index.js +0 -49
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -394
- package/lib/util.js +0 -108
- package/lib/utils/Aabb.js +0 -119
- package/lib/utils/dom.js +0 -147
- package/lib/utils/performance.js +0 -70
- package/lib/utils/primitives.js +0 -54
- package/lib/utils/task_queue.js +0 -97
package/lib/css/l7.css
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
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/lib/earthmap.js
DELETED
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.EarthMap = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
16
|
-
var _camera = _interopRequireDefault(require("./camera"));
|
|
17
|
-
var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
|
|
18
|
-
var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
|
|
19
|
-
var _point = _interopRequireDefault(require("./geo/point"));
|
|
20
|
-
var _handler_manager = _interopRequireDefault(require("./handler/handler_manager"));
|
|
21
|
-
var _util = require("./util");
|
|
22
|
-
var _performance = require("./utils/performance");
|
|
23
|
-
var _task_queue = _interopRequireDefault(require("./utils/task_queue"));
|
|
24
|
-
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); }; }
|
|
25
|
-
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; } }
|
|
26
|
-
function loadStyles(css, doc) {
|
|
27
|
-
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
28
|
-
var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
|
|
29
|
-
if (isMiniAli || isWeChatMiniProgram) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (!doc) doc = document;
|
|
33
|
-
if (!doc) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
37
|
-
if (!head) {
|
|
38
|
-
head = doc.createElement('head');
|
|
39
|
-
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
40
|
-
if (body) {
|
|
41
|
-
body.parentNode.insertBefore(head, body);
|
|
42
|
-
} else {
|
|
43
|
-
doc.documentElement.appendChild(head);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
var style = doc.createElement('style');
|
|
47
|
-
style.type = 'text/css';
|
|
48
|
-
if (style.styleSheet) {
|
|
49
|
-
style.styleSheet.cssText = css;
|
|
50
|
-
} else {
|
|
51
|
-
style.appendChild(doc.createTextNode(css));
|
|
52
|
-
}
|
|
53
|
-
head.appendChild(style);
|
|
54
|
-
return style;
|
|
55
|
-
}
|
|
56
|
-
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"); // @ts-ignore
|
|
57
|
-
var defaultMinZoom = -2;
|
|
58
|
-
var defaultMaxZoom = 22;
|
|
59
|
-
var merge = _l7Utils.lodashUtil.merge;
|
|
60
|
-
// the default values, but also the valid range
|
|
61
|
-
var defaultMinPitch = 0;
|
|
62
|
-
var defaultMaxPitch = 60;
|
|
63
|
-
var DefaultOptions = {
|
|
64
|
-
hash: false,
|
|
65
|
-
zoom: -1,
|
|
66
|
-
center: [112, 32],
|
|
67
|
-
pitch: 0,
|
|
68
|
-
bearing: 0,
|
|
69
|
-
interactive: true,
|
|
70
|
-
minZoom: defaultMinZoom,
|
|
71
|
-
maxZoom: defaultMaxZoom,
|
|
72
|
-
minPitch: defaultMinPitch,
|
|
73
|
-
maxPitch: defaultMaxPitch,
|
|
74
|
-
scrollZoom: true,
|
|
75
|
-
boxZoom: true,
|
|
76
|
-
dragRotate: true,
|
|
77
|
-
dragPan: true,
|
|
78
|
-
keyboard: true,
|
|
79
|
-
doubleClickZoom: true,
|
|
80
|
-
touchZoomRotate: true,
|
|
81
|
-
touchPitch: true,
|
|
82
|
-
bearingSnap: 7,
|
|
83
|
-
clickTolerance: 3,
|
|
84
|
-
pitchWithRotate: true,
|
|
85
|
-
trackResize: true,
|
|
86
|
-
renderWorldCopies: true,
|
|
87
|
-
pitchEnabled: true,
|
|
88
|
-
rotateEnabled: true
|
|
89
|
-
};
|
|
90
|
-
var EarthMap = /*#__PURE__*/function (_Camera) {
|
|
91
|
-
(0, _inherits2.default)(EarthMap, _Camera);
|
|
92
|
-
var _super = _createSuper(EarthMap);
|
|
93
|
-
function EarthMap(options) {
|
|
94
|
-
var _this;
|
|
95
|
-
(0, _classCallCheck2.default)(this, EarthMap);
|
|
96
|
-
_this = _super.call(this, merge({}, DefaultOptions, options));
|
|
97
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderTaskQueue", new _task_queue.default());
|
|
98
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "trackResize", true);
|
|
99
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowOnline", function () {
|
|
100
|
-
_this.update();
|
|
101
|
-
});
|
|
102
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onWindowResize", function (event) {
|
|
103
|
-
if (_this.trackResize) {
|
|
104
|
-
_this.resize({
|
|
105
|
-
originalEvent: event
|
|
106
|
-
}).update();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
_this.initContainer();
|
|
110
|
-
_this.resize();
|
|
111
|
-
_this.handlers = new _handler_manager.default((0, _assertThisInitialized2.default)(_this), _this.options);
|
|
112
|
-
if (typeof window !== 'undefined') {
|
|
113
|
-
window.addEventListener('online', _this.onWindowOnline, false);
|
|
114
|
-
window.addEventListener('resize', _this.onWindowResize, false);
|
|
115
|
-
window.addEventListener('orientationchange', _this.onWindowResize, false);
|
|
116
|
-
}
|
|
117
|
-
return _this;
|
|
118
|
-
}
|
|
119
|
-
(0, _createClass2.default)(EarthMap, [{
|
|
120
|
-
key: "resize",
|
|
121
|
-
value: function resize(eventData) {
|
|
122
|
-
var dimensions = this.containerDimensions();
|
|
123
|
-
var width = dimensions[0];
|
|
124
|
-
var height = dimensions[1];
|
|
125
|
-
|
|
126
|
-
// this.resizeCanvas(width, height);
|
|
127
|
-
this.transform.resize(width, height);
|
|
128
|
-
var fireMoving = !this.moving;
|
|
129
|
-
if (fireMoving) {
|
|
130
|
-
this.stop();
|
|
131
|
-
this.emit('movestart', new Event('movestart', eventData));
|
|
132
|
-
this.emit('move', new Event('move', eventData));
|
|
133
|
-
}
|
|
134
|
-
this.emit('resize', new Event('resize', eventData));
|
|
135
|
-
if (fireMoving) {
|
|
136
|
-
this.emit('moveend', new Event('moveend', eventData));
|
|
137
|
-
}
|
|
138
|
-
return this;
|
|
139
|
-
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "getContainer",
|
|
142
|
-
value: function getContainer() {
|
|
143
|
-
return this.container;
|
|
144
|
-
}
|
|
145
|
-
}, {
|
|
146
|
-
key: "getCanvas",
|
|
147
|
-
value: function getCanvas() {
|
|
148
|
-
return this.canvas;
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
key: "getCanvasContainer",
|
|
152
|
-
value: function getCanvasContainer() {
|
|
153
|
-
return this.canvasContainer;
|
|
154
|
-
}
|
|
155
|
-
}, {
|
|
156
|
-
key: "project",
|
|
157
|
-
value: function project(lngLat) {
|
|
158
|
-
return this.transform.locationPoint(_lng_lat.default.convert(lngLat));
|
|
159
|
-
}
|
|
160
|
-
}, {
|
|
161
|
-
key: "unproject",
|
|
162
|
-
value: function unproject(point) {
|
|
163
|
-
return this.transform.pointLocation(_point.default.convert(point));
|
|
164
|
-
}
|
|
165
|
-
}, {
|
|
166
|
-
key: "getBounds",
|
|
167
|
-
value: function getBounds() {
|
|
168
|
-
return this.transform.getBounds();
|
|
169
|
-
}
|
|
170
|
-
}, {
|
|
171
|
-
key: "getMaxBounds",
|
|
172
|
-
value: function getMaxBounds() {
|
|
173
|
-
return this.transform.getMaxBounds();
|
|
174
|
-
}
|
|
175
|
-
}, {
|
|
176
|
-
key: "setMaxBounds",
|
|
177
|
-
value: function setMaxBounds(bounds) {
|
|
178
|
-
this.transform.setMaxBounds(_lng_lat_bounds.default.convert(bounds));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
182
|
-
}, {
|
|
183
|
-
key: "setStyle",
|
|
184
|
-
value: function setStyle(style) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "setMinZoom",
|
|
189
|
-
value: function setMinZoom(minZoom) {
|
|
190
|
-
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
|
|
191
|
-
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
192
|
-
this.transform.minZoom = minZoom;
|
|
193
|
-
if (this.getZoom() < minZoom) {
|
|
194
|
-
this.setZoom(minZoom);
|
|
195
|
-
}
|
|
196
|
-
return this;
|
|
197
|
-
} else {
|
|
198
|
-
throw new Error("minZoom must be between ".concat(defaultMinZoom, " and the current maxZoom, inclusive"));
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "getMinZoom",
|
|
203
|
-
value: function getMinZoom() {
|
|
204
|
-
return this.transform.minZoom;
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "setMaxZoom",
|
|
208
|
-
value: function setMaxZoom(maxZoom) {
|
|
209
|
-
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
|
|
210
|
-
if (maxZoom >= this.transform.minZoom) {
|
|
211
|
-
this.transform.maxZoom = maxZoom;
|
|
212
|
-
if (this.getZoom() > maxZoom) {
|
|
213
|
-
this.setZoom(maxZoom);
|
|
214
|
-
}
|
|
215
|
-
return this;
|
|
216
|
-
} else {
|
|
217
|
-
throw new Error('maxZoom must be greater than the current minZoom');
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "getMaxZoom",
|
|
222
|
-
value: function getMaxZoom() {
|
|
223
|
-
return this.transform.maxZoom;
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
key: "setMinPitch",
|
|
227
|
-
value: function setMinPitch(minPitch) {
|
|
228
|
-
minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
|
|
229
|
-
if (minPitch < defaultMinPitch) {
|
|
230
|
-
throw new Error("minPitch must be greater than or equal to ".concat(defaultMinPitch));
|
|
231
|
-
}
|
|
232
|
-
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
233
|
-
this.transform.minPitch = minPitch;
|
|
234
|
-
if (this.getPitch() < minPitch) {
|
|
235
|
-
this.setPitch(minPitch);
|
|
236
|
-
}
|
|
237
|
-
return this;
|
|
238
|
-
} else {
|
|
239
|
-
throw new Error("minPitch must be between ".concat(defaultMinPitch, " and the current maxPitch, inclusive"));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}, {
|
|
243
|
-
key: "getMinPitch",
|
|
244
|
-
value: function getMinPitch() {
|
|
245
|
-
return this.transform.minPitch;
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "setMaxPitch",
|
|
249
|
-
value: function setMaxPitch(maxPitch) {
|
|
250
|
-
maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
|
|
251
|
-
if (maxPitch > defaultMaxPitch) {
|
|
252
|
-
throw new Error("maxPitch must be less than or equal to ".concat(defaultMaxPitch));
|
|
253
|
-
}
|
|
254
|
-
if (maxPitch >= this.transform.minPitch) {
|
|
255
|
-
this.transform.maxPitch = maxPitch;
|
|
256
|
-
if (this.getPitch() > maxPitch) {
|
|
257
|
-
this.setPitch(maxPitch);
|
|
258
|
-
}
|
|
259
|
-
return this;
|
|
260
|
-
} else {
|
|
261
|
-
throw new Error('maxPitch must be greater than the current minPitch');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}, {
|
|
265
|
-
key: "getMaxPitch",
|
|
266
|
-
value: function getMaxPitch() {
|
|
267
|
-
return this.transform.maxPitch;
|
|
268
|
-
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "getRenderWorldCopies",
|
|
271
|
-
value: function getRenderWorldCopies() {
|
|
272
|
-
return this.transform.renderWorldCopies;
|
|
273
|
-
}
|
|
274
|
-
}, {
|
|
275
|
-
key: "setRenderWorldCopies",
|
|
276
|
-
value: function setRenderWorldCopies(renderWorldCopies) {
|
|
277
|
-
this.transform.renderWorldCopies = !!renderWorldCopies;
|
|
278
|
-
}
|
|
279
|
-
}, {
|
|
280
|
-
key: "remove",
|
|
281
|
-
value: function remove() {
|
|
282
|
-
if (this.frame) {
|
|
283
|
-
this.frame.cancel();
|
|
284
|
-
this.frame = null;
|
|
285
|
-
}
|
|
286
|
-
this.renderTaskQueue.clear();
|
|
287
|
-
}
|
|
288
|
-
}, {
|
|
289
|
-
key: "requestRenderFrame",
|
|
290
|
-
value: function requestRenderFrame(cb) {
|
|
291
|
-
this.update();
|
|
292
|
-
return this.renderTaskQueue.add(cb);
|
|
293
|
-
}
|
|
294
|
-
}, {
|
|
295
|
-
key: "cancelRenderFrame",
|
|
296
|
-
value: function cancelRenderFrame(id) {
|
|
297
|
-
return this.renderTaskQueue.remove(id);
|
|
298
|
-
}
|
|
299
|
-
}, {
|
|
300
|
-
key: "triggerRepaint",
|
|
301
|
-
value: function triggerRepaint() {
|
|
302
|
-
var _this2 = this;
|
|
303
|
-
if (!this.frame) {
|
|
304
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
305
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
306
|
-
_this2.frame = null;
|
|
307
|
-
_this2.update(paintStartTimeStamp);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}, {
|
|
312
|
-
key: "update",
|
|
313
|
-
value: function update(time) {
|
|
314
|
-
var _this3 = this;
|
|
315
|
-
if (!this.frame) {
|
|
316
|
-
this.frame = (0, _util.renderframe)(function (paintStartTimeStamp) {
|
|
317
|
-
_performance.PerformanceUtils.frame(paintStartTimeStamp);
|
|
318
|
-
_this3.frame = null;
|
|
319
|
-
_this3.renderTaskQueue.run(time);
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}, {
|
|
324
|
-
key: "initContainer",
|
|
325
|
-
value: function initContainer() {
|
|
326
|
-
if (typeof this.options.container === 'string') {
|
|
327
|
-
this.container = window.document.getElementById(this.options.container);
|
|
328
|
-
if (!this.container) {
|
|
329
|
-
throw new Error("Container '".concat(this.options.container, "' not found."));
|
|
330
|
-
}
|
|
331
|
-
} else if (this.options.container instanceof HTMLElement) {
|
|
332
|
-
this.container = this.options.container;
|
|
333
|
-
} else {
|
|
334
|
-
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
335
|
-
}
|
|
336
|
-
var container = this.container;
|
|
337
|
-
container.classList.add('l7-map');
|
|
338
|
-
var canvasContainer = this.canvasContainer = _l7Utils.DOM.create('div', 'l7-canvas-container', container);
|
|
339
|
-
if (this.options.interactive) {
|
|
340
|
-
canvasContainer.classList.add('l7-interactive');
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// this.canvas = DOM.create(
|
|
344
|
-
// 'canvas',
|
|
345
|
-
// 'l7-canvas',
|
|
346
|
-
// canvasContainer,
|
|
347
|
-
// ) as HTMLCanvasElement;
|
|
348
|
-
// this.canvas.setAttribute('tabindex', '-');
|
|
349
|
-
// this.canvas.setAttribute('aria-label', 'Map');
|
|
350
|
-
}
|
|
351
|
-
}, {
|
|
352
|
-
key: "containerDimensions",
|
|
353
|
-
value: function containerDimensions() {
|
|
354
|
-
var width = 0;
|
|
355
|
-
var height = 0;
|
|
356
|
-
if (this.container) {
|
|
357
|
-
width = this.container.clientWidth || 400;
|
|
358
|
-
height = this.container.clientHeight || 300;
|
|
359
|
-
}
|
|
360
|
-
return [width, height];
|
|
361
|
-
}
|
|
362
|
-
}, {
|
|
363
|
-
key: "resizeCanvas",
|
|
364
|
-
value: function resizeCanvas(width, height) {
|
|
365
|
-
var pixelRatio = _l7Utils.DOM.DPR || 1;
|
|
366
|
-
this.canvas.width = pixelRatio * width;
|
|
367
|
-
this.canvas.height = pixelRatio * height;
|
|
368
|
-
|
|
369
|
-
// Maintain the same canvas size, potentially downscaling it for HiDPI displays
|
|
370
|
-
this.canvas.style.width = "".concat(width, "px");
|
|
371
|
-
this.canvas.style.height = "".concat(height, "px");
|
|
372
|
-
}
|
|
373
|
-
}]);
|
|
374
|
-
return EarthMap;
|
|
375
|
-
}(_camera.default);
|
|
376
|
-
exports.EarthMap = EarthMap;
|
package/lib/geo/edge_insets.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _util = require("../util");
|
|
11
|
-
var _point = _interopRequireDefault(require("./point"));
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
/**
|
|
14
|
-
* An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
|
|
15
|
-
* This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
|
|
16
|
-
* on top of the map and having the vanishing point shift as UI elements resize.
|
|
17
|
-
*
|
|
18
|
-
* @param {number} [top=0]
|
|
19
|
-
* @param {number} [bottom=0]
|
|
20
|
-
* @param {number} [left=0]
|
|
21
|
-
* @param {number} [right=0]
|
|
22
|
-
*/
|
|
23
|
-
var EdgeInsets = /*#__PURE__*/function () {
|
|
24
|
-
function EdgeInsets() {
|
|
25
|
-
var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
26
|
-
var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
27
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
28
|
-
var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
29
|
-
(0, _classCallCheck2.default)(this, EdgeInsets);
|
|
30
|
-
if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
|
|
31
|
-
throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
|
|
32
|
-
}
|
|
33
|
-
this.top = top;
|
|
34
|
-
this.bottom = bottom;
|
|
35
|
-
this.left = left;
|
|
36
|
-
this.right = right;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Interpolates the inset in-place.
|
|
41
|
-
* This maintains the current inset value for any inset not present in `target`.
|
|
42
|
-
*
|
|
43
|
-
* @param {PaddingOptions} target
|
|
44
|
-
* @param {number} t
|
|
45
|
-
* @returns {EdgeInsets}
|
|
46
|
-
* @memberof EdgeInsets
|
|
47
|
-
*/
|
|
48
|
-
(0, _createClass2.default)(EdgeInsets, [{
|
|
49
|
-
key: "interpolate",
|
|
50
|
-
value: function interpolate(start, target, t) {
|
|
51
|
-
if (target.top != null && start.top != null) {
|
|
52
|
-
this.top = (0, _util.interpolate)(start.top, target.top, t);
|
|
53
|
-
}
|
|
54
|
-
if (target.bottom != null && start.bottom != null) {
|
|
55
|
-
this.bottom = (0, _util.interpolate)(start.bottom, target.bottom, t);
|
|
56
|
-
}
|
|
57
|
-
if (target.left != null && start.left != null) {
|
|
58
|
-
this.left = (0, _util.interpolate)(start.left, target.left, t);
|
|
59
|
-
}
|
|
60
|
-
if (target.right != null && start.right != null) {
|
|
61
|
-
this.right = (0, _util.interpolate)(start.right, target.right, t);
|
|
62
|
-
}
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Utility method that computes the new apprent center or vanishing point after applying insets.
|
|
68
|
-
* This is in pixels and with the top left being (0.0) and +y being downwards.
|
|
69
|
-
*
|
|
70
|
-
* @param {number} width
|
|
71
|
-
* @param {number} height
|
|
72
|
-
* @returns {Point}
|
|
73
|
-
* @memberof EdgeInsets
|
|
74
|
-
*/
|
|
75
|
-
}, {
|
|
76
|
-
key: "getCenter",
|
|
77
|
-
value: function getCenter(width, height) {
|
|
78
|
-
// Clamp insets so they never overflow width/height and always calculate a valid center
|
|
79
|
-
var x = (0, _util.clamp)((this.left + width - this.right) / 2, 0, width);
|
|
80
|
-
var y = (0, _util.clamp)((this.top + height - this.bottom) / 2, 0, height);
|
|
81
|
-
return new _point.default(x, y);
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "equals",
|
|
85
|
-
value: function equals(other) {
|
|
86
|
-
return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "clone",
|
|
90
|
-
value: function clone() {
|
|
91
|
-
return new EdgeInsets(this.top, this.bottom, this.left, this.right);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Returns the current sdtate as json, useful when you want to have a
|
|
96
|
-
* read-only representation of the inset.
|
|
97
|
-
*
|
|
98
|
-
* @returns {PaddingOptions}
|
|
99
|
-
* @memberof EdgeInsets
|
|
100
|
-
*/
|
|
101
|
-
}, {
|
|
102
|
-
key: "toJSON",
|
|
103
|
-
value: function toJSON() {
|
|
104
|
-
return {
|
|
105
|
-
top: this.top,
|
|
106
|
-
bottom: this.bottom,
|
|
107
|
-
left: this.left,
|
|
108
|
-
right: this.right
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}]);
|
|
112
|
-
return EdgeInsets;
|
|
113
|
-
}();
|
|
114
|
-
exports.default = EdgeInsets;
|
package/lib/geo/lng_lat.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.earthRadius = exports.default = void 0;
|
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _util = require("../util");
|
|
12
|
-
var earthRadius = 6371008.8;
|
|
13
|
-
exports.earthRadius = earthRadius;
|
|
14
|
-
var LngLat = /*#__PURE__*/function () {
|
|
15
|
-
function LngLat(lng, lat) {
|
|
16
|
-
(0, _classCallCheck2.default)(this, LngLat);
|
|
17
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
18
|
-
throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
|
|
19
|
-
}
|
|
20
|
-
this.lng = +lng;
|
|
21
|
-
this.lat = +lat;
|
|
22
|
-
if (this.lat > 90 || this.lat < -90) {
|
|
23
|
-
throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
(0, _createClass2.default)(LngLat, [{
|
|
27
|
-
key: "wrap",
|
|
28
|
-
value: function wrap() {
|
|
29
|
-
return new LngLat((0, _util.wrap)(this.lng, -180, 180), this.lat);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "toArray",
|
|
33
|
-
value: function toArray() {
|
|
34
|
-
return [this.lng, this.lat];
|
|
35
|
-
}
|
|
36
|
-
// public toBounds(radius: number = 0) {
|
|
37
|
-
// const earthCircumferenceInMetersAtEquator = 40075017;
|
|
38
|
-
// const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
|
|
39
|
-
// const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
|
|
40
|
-
|
|
41
|
-
// return new LngLatBounds(
|
|
42
|
-
// new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
|
|
43
|
-
// new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
|
|
44
|
-
// );
|
|
45
|
-
// }
|
|
46
|
-
}, {
|
|
47
|
-
key: "toString",
|
|
48
|
-
value: function toString() {
|
|
49
|
-
return "LngLat(".concat(this.lng, ", ").concat(this.lat, ")");
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "distanceTo",
|
|
53
|
-
value: function distanceTo(lngLat) {
|
|
54
|
-
var rad = Math.PI / 180;
|
|
55
|
-
var lat1 = this.lat * rad;
|
|
56
|
-
var lat2 = lngLat.lat * rad;
|
|
57
|
-
var a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
58
|
-
var maxMeters = earthRadius * Math.acos(Math.min(a, 1));
|
|
59
|
-
return maxMeters;
|
|
60
|
-
}
|
|
61
|
-
}], [{
|
|
62
|
-
key: "convert",
|
|
63
|
-
value: function convert(input) {
|
|
64
|
-
if (input instanceof LngLat) {
|
|
65
|
-
return input;
|
|
66
|
-
}
|
|
67
|
-
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
|
|
68
|
-
return new LngLat(Number(input[0]), Number(input[1]));
|
|
69
|
-
}
|
|
70
|
-
if (!Array.isArray(input) && (0, _typeof2.default)(input) === 'object' && input !== null) {
|
|
71
|
-
var lng = 'lng' in input ? input.lng : input.lon;
|
|
72
|
-
return new LngLat(
|
|
73
|
-
// flow can't refine this to have one of lng or lat, so we have to cast to any
|
|
74
|
-
Number(lng), Number(input.lat));
|
|
75
|
-
}
|
|
76
|
-
throw new Error('`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]');
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
return LngLat;
|
|
80
|
-
}();
|
|
81
|
-
exports.default = LngLat;
|