@antv/l7-map 2.21.11-beta.5 → 2.21.11-beta.6
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/README.md +27 -6
- package/es/index.d.ts +3 -4
- package/es/index.js +2 -4
- package/es/map/camera.d.ts +690 -0
- package/es/map/camera.js +1138 -0
- package/{lib → es/map}/css/l7.css +41 -7
- package/es/map/events.d.ts +384 -0
- package/es/map/events.js +222 -0
- package/es/map/geo/edge_insets.d.ts +97 -0
- package/es/{geo → map/geo}/edge_insets.js +55 -33
- package/es/map/geo/lng_lat.d.ts +116 -0
- package/es/map/geo/lng_lat.js +159 -0
- package/es/map/geo/lng_lat_bounds.d.ts +217 -0
- package/es/map/geo/lng_lat_bounds.js +334 -0
- package/es/map/geo/mercator_coordinate.d.ts +113 -0
- package/es/map/geo/mercator_coordinate.js +142 -0
- package/es/map/geo/transform.d.ts +262 -0
- package/es/map/geo/transform.js +736 -0
- package/{lib → es/map}/handler/box_zoom.d.ts +30 -24
- package/es/map/handler/box_zoom.js +145 -0
- package/es/map/handler/click_zoom.d.ts +24 -0
- package/es/map/handler/click_zoom.js +47 -0
- package/es/map/handler/cooperative_gestures.d.ts +40 -0
- package/es/map/handler/cooperative_gestures.js +94 -0
- package/es/map/handler/drag_handler.d.ts +88 -0
- package/es/map/handler/drag_handler.js +89 -0
- package/es/map/handler/drag_move_state_manager.d.ts +30 -0
- package/es/map/handler/drag_move_state_manager.js +94 -0
- package/es/map/handler/handler_util.d.ts +3 -0
- package/es/{handler → map/handler}/handler_util.js +1 -2
- package/es/map/handler/keyboard.d.ts +88 -0
- package/es/map/handler/keyboard.js +197 -0
- package/es/map/handler/map_event.d.ts +46 -0
- package/es/map/handler/map_event.js +131 -0
- package/es/map/handler/mouse.d.ts +30 -0
- package/es/map/handler/mouse.js +85 -0
- package/es/map/handler/one_finger_touch_drag.d.ts +15 -0
- package/es/map/handler/one_finger_touch_drag.js +39 -0
- package/es/map/handler/scroll_zoom.d.ts +102 -0
- package/es/map/handler/scroll_zoom.js +312 -0
- package/es/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
- package/es/{handler → map/handler}/shim/dblclick_zoom.js +20 -16
- package/es/map/handler/shim/drag_pan.d.ts +79 -0
- package/es/map/handler/shim/drag_pan.js +77 -0
- package/es/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
- package/es/map/handler/shim/drag_rotate.js +66 -0
- package/es/map/handler/shim/two_fingers_touch.d.ts +74 -0
- package/es/map/handler/shim/two_fingers_touch.js +106 -0
- package/es/map/handler/tap_drag_zoom.d.ts +28 -0
- package/es/map/handler/tap_drag_zoom.js +92 -0
- package/es/map/handler/tap_recognizer.d.ts +35 -0
- package/es/map/handler/tap_recognizer.js +107 -0
- package/es/map/handler/tap_zoom.d.ts +28 -0
- package/es/map/handler/tap_zoom.js +87 -0
- package/es/map/handler/touch_pan.d.ts +40 -0
- package/es/map/handler/touch_pan.js +85 -0
- package/es/map/handler/transform-provider.d.ts +23 -0
- package/es/map/handler/transform-provider.js +35 -0
- package/es/map/handler/two_fingers_touch.d.ts +107 -0
- package/es/map/handler/two_fingers_touch.js +289 -0
- package/es/map/handler_inertia.d.ts +20 -0
- package/es/{handler → map}/handler_inertia.js +36 -50
- package/es/map/handler_manager.d.ts +154 -0
- package/es/map/handler_manager.js +466 -0
- package/es/map/map.d.ts +625 -0
- package/es/map/map.js +972 -0
- package/es/map/util/abort_error.d.ts +15 -0
- package/es/map/util/abort_error.js +21 -0
- package/es/map/util/browser.d.ts +10 -0
- package/es/map/util/browser.js +30 -0
- package/es/map/util/dom.d.ts +30 -0
- package/es/map/util/dom.js +105 -0
- package/es/map/util/evented.d.ts +75 -0
- package/es/map/util/evented.js +158 -0
- package/es/map/util/task_queue.d.ts +18 -0
- package/es/map/util/task_queue.js +54 -0
- package/es/map/util/util.d.ts +104 -0
- package/es/map/util/util.js +155 -0
- package/lib/index.d.ts +3 -4
- package/lib/index.js +12 -42
- package/lib/map/camera.d.ts +690 -0
- package/lib/map/camera.js +1145 -0
- package/{es → lib/map}/css/l7.css +41 -7
- package/lib/map/events.d.ts +384 -0
- package/lib/map/events.js +231 -0
- package/lib/map/geo/edge_insets.d.ts +97 -0
- package/lib/{geo → map/geo}/edge_insets.js +56 -35
- package/lib/map/geo/lng_lat.d.ts +116 -0
- package/lib/map/geo/lng_lat.js +166 -0
- package/lib/map/geo/lng_lat_bounds.d.ts +217 -0
- package/lib/map/geo/lng_lat_bounds.js +341 -0
- package/lib/map/geo/mercator_coordinate.d.ts +113 -0
- package/lib/map/geo/mercator_coordinate.js +157 -0
- package/lib/map/geo/transform.d.ts +262 -0
- package/lib/map/geo/transform.js +744 -0
- package/{es → lib/map}/handler/box_zoom.d.ts +30 -24
- package/lib/map/handler/box_zoom.js +153 -0
- package/lib/map/handler/click_zoom.d.ts +24 -0
- package/lib/map/handler/click_zoom.js +54 -0
- package/lib/map/handler/cooperative_gestures.d.ts +40 -0
- package/lib/map/handler/cooperative_gestures.js +101 -0
- package/lib/map/handler/drag_handler.d.ts +88 -0
- package/lib/map/handler/drag_handler.js +97 -0
- package/lib/map/handler/drag_move_state_manager.d.ts +30 -0
- package/lib/map/handler/drag_move_state_manager.js +103 -0
- package/lib/map/handler/handler_util.d.ts +3 -0
- package/lib/{handler → map/handler}/handler_util.js +1 -2
- package/lib/map/handler/keyboard.d.ts +88 -0
- package/lib/map/handler/keyboard.js +205 -0
- package/lib/map/handler/map_event.d.ts +46 -0
- package/lib/map/handler/map_event.js +140 -0
- package/lib/map/handler/mouse.d.ts +30 -0
- package/lib/map/handler/mouse.js +93 -0
- package/lib/map/handler/one_finger_touch_drag.d.ts +15 -0
- package/lib/map/handler/one_finger_touch_drag.js +47 -0
- package/lib/map/handler/scroll_zoom.d.ts +102 -0
- package/lib/map/handler/scroll_zoom.js +320 -0
- package/lib/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
- package/lib/{handler → map/handler}/shim/dblclick_zoom.js +21 -17
- package/lib/map/handler/shim/drag_pan.d.ts +79 -0
- package/lib/map/handler/shim/drag_pan.js +85 -0
- package/lib/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
- package/lib/map/handler/shim/drag_rotate.js +74 -0
- package/lib/map/handler/shim/two_fingers_touch.d.ts +74 -0
- package/lib/map/handler/shim/two_fingers_touch.js +114 -0
- package/lib/map/handler/tap_drag_zoom.d.ts +28 -0
- package/lib/map/handler/tap_drag_zoom.js +99 -0
- package/lib/map/handler/tap_recognizer.d.ts +35 -0
- package/lib/map/handler/tap_recognizer.js +116 -0
- package/lib/map/handler/tap_zoom.d.ts +28 -0
- package/lib/map/handler/tap_zoom.js +94 -0
- package/lib/map/handler/touch_pan.d.ts +40 -0
- package/lib/map/handler/touch_pan.js +92 -0
- package/lib/map/handler/transform-provider.d.ts +23 -0
- package/lib/map/handler/transform-provider.js +43 -0
- package/lib/map/handler/two_fingers_touch.d.ts +107 -0
- package/lib/map/handler/two_fingers_touch.js +296 -0
- package/lib/map/handler_inertia.d.ts +20 -0
- package/lib/{handler → map}/handler_inertia.js +38 -53
- package/lib/map/handler_manager.d.ts +154 -0
- package/lib/map/handler_manager.js +474 -0
- package/lib/map/map.d.ts +625 -0
- package/lib/map/map.js +979 -0
- package/lib/map/util/abort_error.d.ts +15 -0
- package/lib/map/util/abort_error.js +29 -0
- package/lib/map/util/browser.d.ts +10 -0
- package/lib/map/util/browser.js +36 -0
- package/lib/map/util/dom.d.ts +30 -0
- package/lib/map/util/dom.js +113 -0
- package/lib/map/util/evented.d.ts +75 -0
- package/lib/map/util/evented.js +167 -0
- package/lib/map/util/task_queue.d.ts +18 -0
- package/lib/map/util/task_queue.js +62 -0
- package/lib/map/util/util.d.ts +104 -0
- package/lib/map/util/util.js +171 -0
- package/package.json +6 -3
- package/es/camera.d.ts +0 -86
- package/es/camera.js +0 -639
- package/es/earthmap.d.ts +0 -69
- package/es/earthmap.js +0 -445
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -59
- package/es/geo/lng_lat_bounds.d.ts +0 -25
- package/es/geo/lng_lat_bounds.js +0 -118
- package/es/geo/mercator.d.ts +0 -30
- package/es/geo/mercator.js +0 -72
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -153
- package/es/geo/simple.d.ts +0 -30
- package/es/geo/simple.js +0 -75
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -895
- 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 -58
- package/es/handler/box_zoom.js +0 -162
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -40
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -12
- package/es/handler/events/index.d.ts +0 -4
- package/es/handler/events/index.js +0 -4
- package/es/handler/events/map_mouse_event.d.ts +0 -34
- package/es/handler/events/map_mouse_event.js +0 -45
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -75
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -33
- package/es/handler/events/render_event.d.ts +0 -6
- package/es/handler/events/render_event.js +0 -10
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -487
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -131
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -89
- 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 -99
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -21
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -24
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -24
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -12
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -315
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -75
- package/es/handler/shim/drag_rotate.js +0 -64
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -104
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -77
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -89
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -46
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -81
- 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 -91
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -75
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -57
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -37
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -98
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -121
- 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 -472
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -70
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -72
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -117
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -58
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -37
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -60
- package/lib/camera.d.ts +0 -86
- package/lib/camera.js +0 -648
- package/lib/earthmap.d.ts +0 -69
- package/lib/earthmap.js +0 -451
- package/lib/geo/edge_insets.d.ts +0 -54
- package/lib/geo/lng_lat.d.ts +0 -18
- package/lib/geo/lng_lat.js +0 -67
- package/lib/geo/lng_lat_bounds.d.ts +0 -25
- package/lib/geo/lng_lat_bounds.js +0 -126
- package/lib/geo/mercator.d.ts +0 -30
- package/lib/geo/mercator.js +0 -88
- package/lib/geo/point.d.ts +0 -40
- package/lib/geo/point.js +0 -161
- package/lib/geo/simple.d.ts +0 -30
- package/lib/geo/simple.js +0 -92
- package/lib/geo/transform.d.ts +0 -198
- package/lib/geo/transform.js +0 -906
- package/lib/handler/IHandler.d.ts +0 -34
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.d.ts +0 -17
- package/lib/handler/blockable_map_event.js +0 -66
- package/lib/handler/box_zoom.js +0 -168
- package/lib/handler/click_zoom.d.ts +0 -16
- package/lib/handler/click_zoom.js +0 -48
- package/lib/handler/events/event.d.ts +0 -4
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.d.ts +0 -4
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.d.ts +0 -34
- package/lib/handler/events/map_mouse_event.js +0 -53
- package/lib/handler/events/map_touch_event.d.ts +0 -57
- package/lib/handler/events/map_touch_event.js +0 -83
- package/lib/handler/events/map_wheel_event.d.ts +0 -33
- package/lib/handler/events/map_wheel_event.js +0 -41
- package/lib/handler/events/render_event.d.ts +0 -6
- package/lib/handler/events/render_event.js +0 -18
- package/lib/handler/handler_inertia.d.ts +0 -23
- package/lib/handler/handler_manager.d.ts +0 -61
- package/lib/handler/handler_manager.js +0 -495
- package/lib/handler/handler_util.d.ts +0 -4
- package/lib/handler/keyboard.d.ts +0 -36
- package/lib/handler/keyboard.js +0 -138
- package/lib/handler/map_event.d.ts +0 -29
- package/lib/handler/map_event.js +0 -97
- package/lib/handler/mouse/index.d.ts +0 -4
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.d.ts +0 -22
- package/lib/handler/mouse/mouse_handler.js +0 -107
- package/lib/handler/mouse/mousepan_handler.d.ts +0 -10
- package/lib/handler/mouse/mousepan_handler.js +0 -29
- package/lib/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/lib/handler/mouse/mousepitch_hander.js +0 -32
- package/lib/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/lib/handler/mouse/mouserotate_hander.js +0 -32
- package/lib/handler/mouse/util.d.ts +0 -6
- package/lib/handler/mouse/util.js +0 -19
- package/lib/handler/scroll_zoom.d.ts +0 -93
- package/lib/handler/scroll_zoom.js +0 -322
- package/lib/handler/shim/drag_pan.d.ts +0 -61
- package/lib/handler/shim/drag_pan.js +0 -83
- package/lib/handler/shim/drag_rotate.js +0 -72
- package/lib/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/lib/handler/shim/touch_zoom_rotate.js +0 -112
- package/lib/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/lib/handler/tap/single_tap_recognizer.js +0 -86
- package/lib/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/lib/handler/tap/tap_drag_zoom.js +0 -97
- package/lib/handler/tap/tap_recognizer.d.ts +0 -17
- package/lib/handler/tap/tap_recognizer.js +0 -56
- package/lib/handler/tap/tap_zoom.d.ts +0 -22
- package/lib/handler/tap/tap_zoom.js +0 -89
- package/lib/handler/touch/index.d.ts +0 -5
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.d.ts +0 -30
- package/lib/handler/touch/touch_pan.js +0 -100
- package/lib/handler/touch/touch_pitch.d.ts +0 -13
- package/lib/handler/touch/touch_pitch.js +0 -83
- package/lib/handler/touch/touch_rotate.d.ts +0 -12
- package/lib/handler/touch/touch_rotate.js +0 -65
- package/lib/handler/touch/touch_zoom.d.ts +0 -12
- package/lib/handler/touch/touch_zoom.js +0 -45
- package/lib/handler/touch/two_touch.d.ts +0 -23
- package/lib/handler/touch/two_touch.js +0 -106
- package/lib/hash.d.ts +0 -14
- package/lib/hash.js +0 -129
- package/lib/interface.d.ts +0 -34
- package/lib/interface.js +0 -5
- package/lib/map.d.ts +0 -70
- package/lib/map.js +0 -478
- package/lib/util.d.ts +0 -25
- package/lib/util.js +0 -89
- package/lib/utils/Aabb.d.ts +0 -12
- package/lib/utils/Aabb.js +0 -80
- package/lib/utils/dom.d.ts +0 -4
- package/lib/utils/dom.js +0 -125
- package/lib/utils/performance.d.ts +0 -17
- package/lib/utils/performance.js +0 -64
- package/lib/utils/primitives.d.ts +0 -6
- package/lib/utils/primitives.js +0 -45
- package/lib/utils/task_queue.d.ts +0 -13
- package/lib/utils/task_queue.js +0 -67
package/es/earthmap.js
DELETED
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { DOM, lodashUtil } from '@antv/l7-utils';
|
|
3
|
-
import Camera from "./camera";
|
|
4
|
-
function loadStyles(css, doc) {
|
|
5
|
-
var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
|
|
6
|
-
var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
|
|
7
|
-
if (isMiniAli || isWeChatMiniProgram) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (!doc) doc = document;
|
|
11
|
-
if (!doc) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
var head = doc.head || doc.getElementsByTagName('head')[0];
|
|
15
|
-
if (!head) {
|
|
16
|
-
head = doc.createElement('head');
|
|
17
|
-
var body = doc.body || doc.getElementsByTagName('body')[0];
|
|
18
|
-
if (body) {
|
|
19
|
-
body.parentNode.insertBefore(head, body);
|
|
20
|
-
} else {
|
|
21
|
-
doc.documentElement.appendChild(head);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
var style = doc.createElement('style');
|
|
25
|
-
style.type = 'text/css';
|
|
26
|
-
if (style.styleSheet) {
|
|
27
|
-
style.styleSheet.cssText = css;
|
|
28
|
-
} else {
|
|
29
|
-
style.appendChild(doc.createTextNode(css));
|
|
30
|
-
}
|
|
31
|
-
head.appendChild(style);
|
|
32
|
-
return style;
|
|
33
|
-
}
|
|
34
|
-
loadStyles(`.l7-map {
|
|
35
|
-
font:
|
|
36
|
-
12px/20px 'Helvetica Neue',
|
|
37
|
-
Arial,
|
|
38
|
-
Helvetica,
|
|
39
|
-
sans-serif;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
position: relative;
|
|
42
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.l7-canvas {
|
|
46
|
-
position: absolute;
|
|
47
|
-
left: 0;
|
|
48
|
-
top: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.l7-map:-webkit-full-screen {
|
|
52
|
-
width: 100%;
|
|
53
|
-
height: 100%;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.l7-canary {
|
|
57
|
-
background-color: salmon;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.l7-canvas-container.l7-interactive,
|
|
61
|
-
.l7-ctrl-group button.l7-ctrl-compass {
|
|
62
|
-
cursor: grab;
|
|
63
|
-
-moz-user-select: none;
|
|
64
|
-
-webkit-user-select: none;
|
|
65
|
-
-ms-user-select: none;
|
|
66
|
-
user-select: none;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.l7-canvas-container.l7-interactive.l7-track-pointer {
|
|
70
|
-
cursor: pointer;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.l7-canvas-container.l7-interactive:active,
|
|
74
|
-
.l7-ctrl-group button.l7-ctrl-compass:active {
|
|
75
|
-
cursor: grabbing;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.l7-canvas-container.l7-touch-zoom-rotate,
|
|
79
|
-
.l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
|
|
80
|
-
touch-action: pan-x pan-y;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.l7-canvas-container.l7-touch-drag-pan,
|
|
84
|
-
.l7-canvas-container.l7-touch-drag-pan .l7-canvas {
|
|
85
|
-
touch-action: pinch-zoom;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
|
|
89
|
-
.l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
|
|
90
|
-
touch-action: none;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.l7-ctrl-top-left,
|
|
94
|
-
.l7-ctrl-top-right,
|
|
95
|
-
.l7-ctrl-bottom-left,
|
|
96
|
-
.l7-ctrl-bottom-right {
|
|
97
|
-
position: absolute;
|
|
98
|
-
pointer-events: none;
|
|
99
|
-
z-index: 2;
|
|
100
|
-
}
|
|
101
|
-
.l7-ctrl-top-left {
|
|
102
|
-
top: 0;
|
|
103
|
-
left: 0;
|
|
104
|
-
}
|
|
105
|
-
.l7-ctrl-top-right {
|
|
106
|
-
top: 0;
|
|
107
|
-
right: 0;
|
|
108
|
-
}
|
|
109
|
-
.l7-ctrl-bottom-left {
|
|
110
|
-
bottom: 0;
|
|
111
|
-
left: 0;
|
|
112
|
-
}
|
|
113
|
-
.l7-ctrl-bottom-right {
|
|
114
|
-
right: 0;
|
|
115
|
-
bottom: 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.l7-ctrl {
|
|
119
|
-
clear: both;
|
|
120
|
-
pointer-events: auto;
|
|
121
|
-
|
|
122
|
-
/* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
|
|
123
|
-
-webkit-transform: translate(0, 0);
|
|
124
|
-
transform: translate(0, 0);
|
|
125
|
-
}
|
|
126
|
-
.l7-ctrl-top-left .l7-ctrl {
|
|
127
|
-
margin: 10px 0 0 10px;
|
|
128
|
-
float: left;
|
|
129
|
-
}
|
|
130
|
-
.l7-ctrl-top-right .l7-ctrl {
|
|
131
|
-
margin: 10px 10px 0 0;
|
|
132
|
-
float: right;
|
|
133
|
-
}
|
|
134
|
-
.l7-ctrl-bottom-left .l7-ctrl {
|
|
135
|
-
margin: 0 0 10px 10px;
|
|
136
|
-
float: left;
|
|
137
|
-
}
|
|
138
|
-
.l7-ctrl-bottom-right .l7-ctrl {
|
|
139
|
-
margin: 0 10px 10px 0;
|
|
140
|
-
float: right;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.l7-crosshair,
|
|
144
|
-
.l7-crosshair .l7-interactive,
|
|
145
|
-
.l7-crosshair .l7-interactive:active {
|
|
146
|
-
cursor: crosshair;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.l7-boxzoom {
|
|
150
|
-
position: absolute;
|
|
151
|
-
top: 0;
|
|
152
|
-
left: 0;
|
|
153
|
-
width: 0;
|
|
154
|
-
height: 0;
|
|
155
|
-
background: #fff;
|
|
156
|
-
border: 2px dotted #202020;
|
|
157
|
-
opacity: 0.5;
|
|
158
|
-
z-index: 10;
|
|
159
|
-
}
|
|
160
|
-
`);
|
|
161
|
-
import LngLat from "./geo/lng_lat";
|
|
162
|
-
import LngLatBounds from "./geo/lng_lat_bounds";
|
|
163
|
-
// @ts-ignore
|
|
164
|
-
|
|
165
|
-
import Point from "./geo/point";
|
|
166
|
-
import HandlerManager from "./handler/handler_manager";
|
|
167
|
-
import { renderframe } from "./util";
|
|
168
|
-
import { PerformanceUtils } from "./utils/performance";
|
|
169
|
-
import TaskQueue from "./utils/task_queue";
|
|
170
|
-
const defaultMinZoom = -2;
|
|
171
|
-
const defaultMaxZoom = 22;
|
|
172
|
-
const {
|
|
173
|
-
merge
|
|
174
|
-
} = lodashUtil;
|
|
175
|
-
// the default values, but also the valid range
|
|
176
|
-
const defaultMinPitch = 0;
|
|
177
|
-
const defaultMaxPitch = 60;
|
|
178
|
-
const DefaultOptions = {
|
|
179
|
-
hash: false,
|
|
180
|
-
zoom: -1,
|
|
181
|
-
center: [112, 32],
|
|
182
|
-
pitch: 0,
|
|
183
|
-
bearing: 0,
|
|
184
|
-
interactive: true,
|
|
185
|
-
minZoom: defaultMinZoom,
|
|
186
|
-
maxZoom: defaultMaxZoom,
|
|
187
|
-
minPitch: defaultMinPitch,
|
|
188
|
-
maxPitch: defaultMaxPitch,
|
|
189
|
-
scrollZoom: true,
|
|
190
|
-
boxZoom: true,
|
|
191
|
-
dragRotate: true,
|
|
192
|
-
dragPan: true,
|
|
193
|
-
keyboard: true,
|
|
194
|
-
doubleClickZoom: true,
|
|
195
|
-
touchZoomRotate: true,
|
|
196
|
-
touchPitch: true,
|
|
197
|
-
bearingSnap: 7,
|
|
198
|
-
clickTolerance: 3,
|
|
199
|
-
pitchWithRotate: true,
|
|
200
|
-
trackResize: true,
|
|
201
|
-
renderWorldCopies: true,
|
|
202
|
-
pitchEnabled: true,
|
|
203
|
-
rotateEnabled: true
|
|
204
|
-
};
|
|
205
|
-
export class EarthMap extends Camera {
|
|
206
|
-
constructor(options) {
|
|
207
|
-
super(merge({}, DefaultOptions, options));
|
|
208
|
-
_defineProperty(this, "doubleClickZoom", void 0);
|
|
209
|
-
_defineProperty(this, "dragRotate", void 0);
|
|
210
|
-
_defineProperty(this, "dragPan", void 0);
|
|
211
|
-
_defineProperty(this, "touchZoomRotate", void 0);
|
|
212
|
-
_defineProperty(this, "scrollZoom", void 0);
|
|
213
|
-
_defineProperty(this, "keyboard", void 0);
|
|
214
|
-
_defineProperty(this, "touchPitch", void 0);
|
|
215
|
-
_defineProperty(this, "boxZoom", void 0);
|
|
216
|
-
_defineProperty(this, "handlers", void 0);
|
|
217
|
-
_defineProperty(this, "container", void 0);
|
|
218
|
-
_defineProperty(this, "canvas", void 0);
|
|
219
|
-
_defineProperty(this, "canvasContainer", void 0);
|
|
220
|
-
_defineProperty(this, "renderTaskQueue", new TaskQueue());
|
|
221
|
-
_defineProperty(this, "frame", void 0);
|
|
222
|
-
_defineProperty(this, "trackResize", true);
|
|
223
|
-
_defineProperty(this, "onWindowOnline", () => {
|
|
224
|
-
this.update();
|
|
225
|
-
});
|
|
226
|
-
_defineProperty(this, "onWindowResize", event => {
|
|
227
|
-
if (this.trackResize) {
|
|
228
|
-
this.resize({
|
|
229
|
-
originalEvent: event
|
|
230
|
-
}).update();
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
this.initContainer();
|
|
234
|
-
this.resize();
|
|
235
|
-
this.handlers = new HandlerManager(this, this.options);
|
|
236
|
-
if (typeof window !== 'undefined') {
|
|
237
|
-
window.addEventListener('online', this.onWindowOnline, false);
|
|
238
|
-
window.addEventListener('resize', this.onWindowResize, false);
|
|
239
|
-
window.addEventListener('orientationchange', this.onWindowResize, false);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
resize(eventData) {
|
|
243
|
-
const dimensions = this.containerDimensions();
|
|
244
|
-
const width = dimensions[0];
|
|
245
|
-
const height = dimensions[1];
|
|
246
|
-
|
|
247
|
-
// this.resizeCanvas(width, height);
|
|
248
|
-
this.transform.resize(width, height);
|
|
249
|
-
const fireMoving = !this.moving;
|
|
250
|
-
if (fireMoving) {
|
|
251
|
-
this.stop();
|
|
252
|
-
this.emit('movestart', new Event('movestart', eventData));
|
|
253
|
-
this.emit('move', new Event('move', eventData));
|
|
254
|
-
}
|
|
255
|
-
this.emit('resize', new Event('resize', eventData));
|
|
256
|
-
if (fireMoving) {
|
|
257
|
-
this.emit('moveend', new Event('moveend', eventData));
|
|
258
|
-
}
|
|
259
|
-
return this;
|
|
260
|
-
}
|
|
261
|
-
getContainer() {
|
|
262
|
-
return this.container;
|
|
263
|
-
}
|
|
264
|
-
getCanvas() {
|
|
265
|
-
return this.canvas;
|
|
266
|
-
}
|
|
267
|
-
getCanvasContainer() {
|
|
268
|
-
return this.canvasContainer;
|
|
269
|
-
}
|
|
270
|
-
project(lngLat) {
|
|
271
|
-
return this.transform.locationPoint(LngLat.convert(lngLat));
|
|
272
|
-
}
|
|
273
|
-
unproject(point) {
|
|
274
|
-
return this.transform.pointLocation(Point.convert(point));
|
|
275
|
-
}
|
|
276
|
-
getBounds() {
|
|
277
|
-
return this.transform.getBounds();
|
|
278
|
-
}
|
|
279
|
-
getMaxBounds() {
|
|
280
|
-
return this.transform.getMaxBounds();
|
|
281
|
-
}
|
|
282
|
-
setMaxBounds(bounds) {
|
|
283
|
-
this.transform.setMaxBounds(LngLatBounds.convert(bounds));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
287
|
-
setStyle(style) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
setMinZoom(minZoom) {
|
|
291
|
-
minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
|
|
292
|
-
if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
|
|
293
|
-
this.transform.minZoom = minZoom;
|
|
294
|
-
if (this.getZoom() < minZoom) {
|
|
295
|
-
this.setZoom(minZoom);
|
|
296
|
-
}
|
|
297
|
-
return this;
|
|
298
|
-
} else {
|
|
299
|
-
throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
getMinZoom() {
|
|
303
|
-
return this.transform.minZoom;
|
|
304
|
-
}
|
|
305
|
-
setMaxZoom(maxZoom) {
|
|
306
|
-
maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
|
|
307
|
-
if (maxZoom >= this.transform.minZoom) {
|
|
308
|
-
this.transform.maxZoom = maxZoom;
|
|
309
|
-
if (this.getZoom() > maxZoom) {
|
|
310
|
-
this.setZoom(maxZoom);
|
|
311
|
-
}
|
|
312
|
-
return this;
|
|
313
|
-
} else {
|
|
314
|
-
throw new Error('maxZoom must be greater than the current minZoom');
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
getMaxZoom() {
|
|
318
|
-
return this.transform.maxZoom;
|
|
319
|
-
}
|
|
320
|
-
setMinPitch(minPitch) {
|
|
321
|
-
minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
|
|
322
|
-
if (minPitch < defaultMinPitch) {
|
|
323
|
-
throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);
|
|
324
|
-
}
|
|
325
|
-
if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
|
|
326
|
-
this.transform.minPitch = minPitch;
|
|
327
|
-
if (this.getPitch() < minPitch) {
|
|
328
|
-
this.setPitch(minPitch);
|
|
329
|
-
}
|
|
330
|
-
return this;
|
|
331
|
-
} else {
|
|
332
|
-
throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
getMinPitch() {
|
|
336
|
-
return this.transform.minPitch;
|
|
337
|
-
}
|
|
338
|
-
setMaxPitch(maxPitch) {
|
|
339
|
-
maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
|
|
340
|
-
if (maxPitch > defaultMaxPitch) {
|
|
341
|
-
throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
|
|
342
|
-
}
|
|
343
|
-
if (maxPitch >= this.transform.minPitch) {
|
|
344
|
-
this.transform.maxPitch = maxPitch;
|
|
345
|
-
if (this.getPitch() > maxPitch) {
|
|
346
|
-
this.setPitch(maxPitch);
|
|
347
|
-
}
|
|
348
|
-
return this;
|
|
349
|
-
} else {
|
|
350
|
-
throw new Error('maxPitch must be greater than the current minPitch');
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
getMaxPitch() {
|
|
354
|
-
return this.transform.maxPitch;
|
|
355
|
-
}
|
|
356
|
-
getRenderWorldCopies() {
|
|
357
|
-
return this.transform.renderWorldCopies;
|
|
358
|
-
}
|
|
359
|
-
setRenderWorldCopies(renderWorldCopies) {
|
|
360
|
-
this.transform.renderWorldCopies = !!renderWorldCopies;
|
|
361
|
-
}
|
|
362
|
-
remove() {
|
|
363
|
-
if (this.frame) {
|
|
364
|
-
this.frame.cancel();
|
|
365
|
-
this.frame = null;
|
|
366
|
-
}
|
|
367
|
-
this.renderTaskQueue.clear();
|
|
368
|
-
//销毁事件
|
|
369
|
-
this.handlers.destroy();
|
|
370
|
-
if (typeof window !== 'undefined') {
|
|
371
|
-
window.removeEventListener('online', this.onWindowOnline, false);
|
|
372
|
-
window.removeEventListener('resize', this.onWindowResize, false);
|
|
373
|
-
window.removeEventListener('orientationchange', this.onWindowResize, false);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
requestRenderFrame(cb) {
|
|
377
|
-
this.update();
|
|
378
|
-
return this.renderTaskQueue.add(cb);
|
|
379
|
-
}
|
|
380
|
-
cancelRenderFrame(id) {
|
|
381
|
-
return this.renderTaskQueue.remove(id);
|
|
382
|
-
}
|
|
383
|
-
triggerRepaint() {
|
|
384
|
-
if (!this.frame) {
|
|
385
|
-
this.frame = renderframe(paintStartTimeStamp => {
|
|
386
|
-
PerformanceUtils.frame(paintStartTimeStamp);
|
|
387
|
-
this.frame = null;
|
|
388
|
-
this.update(paintStartTimeStamp);
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
update(time) {
|
|
393
|
-
if (!this.frame) {
|
|
394
|
-
this.frame = renderframe(paintStartTimeStamp => {
|
|
395
|
-
PerformanceUtils.frame(paintStartTimeStamp);
|
|
396
|
-
this.frame = null;
|
|
397
|
-
this.renderTaskQueue.run(time);
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
initContainer() {
|
|
402
|
-
if (typeof this.options.container === 'string') {
|
|
403
|
-
this.container = window.document.getElementById(this.options.container);
|
|
404
|
-
if (!this.container) {
|
|
405
|
-
throw new Error(`Container '${this.options.container}' not found.`);
|
|
406
|
-
}
|
|
407
|
-
} else if (this.options.container instanceof HTMLElement) {
|
|
408
|
-
this.container = this.options.container;
|
|
409
|
-
} else {
|
|
410
|
-
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
|
|
411
|
-
}
|
|
412
|
-
const container = this.container;
|
|
413
|
-
container.classList.add('l7-map');
|
|
414
|
-
const canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
|
|
415
|
-
if (this.options.interactive) {
|
|
416
|
-
canvasContainer.classList.add('l7-interactive');
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// this.canvas = DOM.create(
|
|
420
|
-
// 'canvas',
|
|
421
|
-
// 'l7-canvas',
|
|
422
|
-
// canvasContainer,
|
|
423
|
-
// ) as HTMLCanvasElement;
|
|
424
|
-
// this.canvas.setAttribute('tabindex', '-');
|
|
425
|
-
// this.canvas.setAttribute('aria-label', 'Map');
|
|
426
|
-
}
|
|
427
|
-
containerDimensions() {
|
|
428
|
-
let width = 0;
|
|
429
|
-
let height = 0;
|
|
430
|
-
if (this.container) {
|
|
431
|
-
width = this.container.clientWidth || 400;
|
|
432
|
-
height = this.container.clientHeight || 300;
|
|
433
|
-
}
|
|
434
|
-
return [width, height];
|
|
435
|
-
}
|
|
436
|
-
resizeCanvas(width, height) {
|
|
437
|
-
const pixelRatio = DOM.DPR || 1;
|
|
438
|
-
this.canvas.width = pixelRatio * width;
|
|
439
|
-
this.canvas.height = pixelRatio * height;
|
|
440
|
-
|
|
441
|
-
// Maintain the same canvas size, potentially downscaling it for HiDPI displays
|
|
442
|
-
this.canvas.style.width = `${width}px`;
|
|
443
|
-
this.canvas.style.height = `${height}px`;
|
|
444
|
-
}
|
|
445
|
-
}
|
package/es/geo/edge_insets.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import Point from './point';
|
|
2
|
-
/**
|
|
3
|
-
* An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
|
|
4
|
-
* This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
|
|
5
|
-
* on top of the map and having the vanishing point shift as UI elements resize.
|
|
6
|
-
*
|
|
7
|
-
* @param {number} [top=0]
|
|
8
|
-
* @param {number} [bottom=0]
|
|
9
|
-
* @param {number} [left=0]
|
|
10
|
-
* @param {number} [right=0]
|
|
11
|
-
*/
|
|
12
|
-
export default class EdgeInsets {
|
|
13
|
-
top: number;
|
|
14
|
-
bottom: number;
|
|
15
|
-
left: number;
|
|
16
|
-
right: number;
|
|
17
|
-
constructor(top?: number, bottom?: number, left?: number, right?: number);
|
|
18
|
-
/**
|
|
19
|
-
* Interpolates the inset in-place.
|
|
20
|
-
* This maintains the current inset value for any inset not present in `target`.
|
|
21
|
-
*
|
|
22
|
-
* @param {PaddingOptions} target
|
|
23
|
-
* @param {number} t
|
|
24
|
-
* @returns {EdgeInsets}
|
|
25
|
-
* @memberof EdgeInsets
|
|
26
|
-
*/
|
|
27
|
-
interpolate(start: IPaddingOptions | EdgeInsets, target: IPaddingOptions, t: number): EdgeInsets;
|
|
28
|
-
/**
|
|
29
|
-
* Utility method that computes the new apprent center or vanishing point after applying insets.
|
|
30
|
-
* This is in pixels and with the top left being (0.0) and +y being downwards.
|
|
31
|
-
*
|
|
32
|
-
* @param {number} width
|
|
33
|
-
* @param {number} height
|
|
34
|
-
* @returns {Point}
|
|
35
|
-
* @memberof EdgeInsets
|
|
36
|
-
*/
|
|
37
|
-
getCenter(width: number, height: number): Point;
|
|
38
|
-
equals(other: IPaddingOptions): boolean;
|
|
39
|
-
clone(): EdgeInsets;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the current sdtate as json, useful when you want to have a
|
|
42
|
-
* read-only representation of the inset.
|
|
43
|
-
*
|
|
44
|
-
* @returns {PaddingOptions}
|
|
45
|
-
* @memberof EdgeInsets
|
|
46
|
-
*/
|
|
47
|
-
toJSON(): IPaddingOptions;
|
|
48
|
-
}
|
|
49
|
-
export interface IPaddingOptions {
|
|
50
|
-
top?: number;
|
|
51
|
-
bottom?: number;
|
|
52
|
-
right?: number;
|
|
53
|
-
left?: number;
|
|
54
|
-
}
|
package/es/geo/lng_lat.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const earthRadius = 6371008.8;
|
|
2
|
-
export type LngLatLike = LngLat | {
|
|
3
|
-
lng: number;
|
|
4
|
-
lat: number;
|
|
5
|
-
} | {
|
|
6
|
-
lon: number;
|
|
7
|
-
lat: number;
|
|
8
|
-
} | [number, number];
|
|
9
|
-
export default class LngLat {
|
|
10
|
-
static convert(input: LngLatLike): LngLat;
|
|
11
|
-
lng: number;
|
|
12
|
-
lat: number;
|
|
13
|
-
constructor(lng: number, lat: number);
|
|
14
|
-
wrap(): LngLat;
|
|
15
|
-
toArray(): [number, number];
|
|
16
|
-
toString(): string;
|
|
17
|
-
distanceTo(lngLat: LngLat): number;
|
|
18
|
-
}
|
package/es/geo/lng_lat.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { wrap } from "../util";
|
|
3
|
-
export const earthRadius = 6371008.8;
|
|
4
|
-
export default class LngLat {
|
|
5
|
-
static convert(input) {
|
|
6
|
-
if (input instanceof LngLat) {
|
|
7
|
-
return input;
|
|
8
|
-
}
|
|
9
|
-
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
|
|
10
|
-
return new LngLat(Number(input[0]), Number(input[1]));
|
|
11
|
-
}
|
|
12
|
-
if (!Array.isArray(input) && typeof input === 'object' && input !== null) {
|
|
13
|
-
const lng = 'lng' in input ? input.lng : input.lon;
|
|
14
|
-
return new LngLat(
|
|
15
|
-
// flow can't refine this to have one of lng or lat, so we have to cast to any
|
|
16
|
-
Number(lng), Number(input.lat));
|
|
17
|
-
}
|
|
18
|
-
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>]');
|
|
19
|
-
}
|
|
20
|
-
constructor(lng, lat) {
|
|
21
|
-
_defineProperty(this, "lng", void 0);
|
|
22
|
-
_defineProperty(this, "lat", void 0);
|
|
23
|
-
if (isNaN(lng) || isNaN(lat)) {
|
|
24
|
-
throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
|
|
25
|
-
}
|
|
26
|
-
this.lng = +lng;
|
|
27
|
-
this.lat = +lat;
|
|
28
|
-
if (this.lat > 90 || this.lat < -90) {
|
|
29
|
-
throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
wrap() {
|
|
33
|
-
return new LngLat(wrap(this.lng, -180, 180), this.lat);
|
|
34
|
-
}
|
|
35
|
-
toArray() {
|
|
36
|
-
return [this.lng, this.lat];
|
|
37
|
-
}
|
|
38
|
-
// public toBounds(radius: number = 0) {
|
|
39
|
-
// const earthCircumferenceInMetersAtEquator = 40075017;
|
|
40
|
-
// const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
|
|
41
|
-
// const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
|
|
42
|
-
|
|
43
|
-
// return new LngLatBounds(
|
|
44
|
-
// new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
|
|
45
|
-
// new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
|
|
46
|
-
// );
|
|
47
|
-
// }
|
|
48
|
-
toString() {
|
|
49
|
-
return `LngLat(${this.lng}, ${this.lat})`;
|
|
50
|
-
}
|
|
51
|
-
distanceTo(lngLat) {
|
|
52
|
-
const rad = Math.PI / 180;
|
|
53
|
-
const lat1 = this.lat * rad;
|
|
54
|
-
const lat2 = lngLat.lat * rad;
|
|
55
|
-
const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
56
|
-
const maxMeters = earthRadius * Math.acos(Math.min(a, 1));
|
|
57
|
-
return maxMeters;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { LngLatLike } from './lng_lat';
|
|
2
|
-
import LngLat from './lng_lat';
|
|
3
|
-
export type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];
|
|
4
|
-
export default class LngLatBounds {
|
|
5
|
-
static convert(input: LngLatBoundsLike): LngLatBounds;
|
|
6
|
-
private ne;
|
|
7
|
-
private sw;
|
|
8
|
-
constructor(sw?: any, ne?: any);
|
|
9
|
-
setNorthEast(ne: LngLatLike): this;
|
|
10
|
-
setSouthWest(sw: LngLatLike): this;
|
|
11
|
-
extend(obj: LngLatLike | LngLatBoundsLike): this;
|
|
12
|
-
getCenter(): LngLat;
|
|
13
|
-
getSouthWest(): LngLat;
|
|
14
|
-
getNorthEast(): LngLat;
|
|
15
|
-
getNorthWest(): LngLat;
|
|
16
|
-
getSouthEast(): LngLat;
|
|
17
|
-
getWest(): number;
|
|
18
|
-
getSouth(): number;
|
|
19
|
-
getEast(): number;
|
|
20
|
-
getNorth(): number;
|
|
21
|
-
toArray(): [[number, number], [number, number]];
|
|
22
|
-
toString(): string;
|
|
23
|
-
isEmpty(): boolean;
|
|
24
|
-
contains(lnglat: LngLatLike): boolean;
|
|
25
|
-
}
|