@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
|
@@ -1,41 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _event = require("./event");
|
|
10
|
-
class MapWheelEvent extends _event.Event {
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
constructor(type, map, originalEvent) {
|
|
15
|
-
super(type);
|
|
16
|
-
/**
|
|
17
|
-
* The event type.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* The DOM event which caused the map event.
|
|
21
|
-
*/
|
|
22
|
-
(0, _defineProperty2.default)(this, "originalEvent", void 0);
|
|
23
|
-
(0, _defineProperty2.default)(this, "defaultPrevented", void 0);
|
|
24
|
-
/**
|
|
25
|
-
* The `Map` object that fired the event.
|
|
26
|
-
*/
|
|
27
|
-
(0, _defineProperty2.default)(this, "target", void 0);
|
|
28
|
-
this.originalEvent = originalEvent;
|
|
29
|
-
this.defaultPrevented = false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Prevents subsequent default processing of the event by the map.
|
|
34
|
-
*
|
|
35
|
-
* Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
|
|
36
|
-
*/
|
|
37
|
-
preventDefault() {
|
|
38
|
-
this.defaultPrevented = true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.default = MapWheelEvent;
|
|
@@ -1,18 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _event = require("./event");
|
|
10
|
-
class RenderFrameEvent extends _event.Event {
|
|
11
|
-
constructor(type, timeStamp) {
|
|
12
|
-
super(type);
|
|
13
|
-
(0, _defineProperty2.default)(this, "type", 'renderFrame');
|
|
14
|
-
(0, _defineProperty2.default)(this, "timeStamp", void 0);
|
|
15
|
-
this.timeStamp = timeStamp;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.default = RenderFrameEvent;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { EarthMap } from '../earthmap';
|
|
2
|
-
import type { Map } from '../map';
|
|
3
|
-
import type { IDragPanOptions } from './shim/drag_pan';
|
|
4
|
-
export interface IInertiaOptions {
|
|
5
|
-
linearity: number;
|
|
6
|
-
easing: (t: number) => number;
|
|
7
|
-
deceleration: number;
|
|
8
|
-
maxSpeed: number;
|
|
9
|
-
}
|
|
10
|
-
export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
|
|
11
|
-
export default class HandlerInertia {
|
|
12
|
-
private map;
|
|
13
|
-
private inertiaBuffer;
|
|
14
|
-
constructor(map: Map | EarthMap);
|
|
15
|
-
clear(): void;
|
|
16
|
-
record(settings: any): void;
|
|
17
|
-
drainInertiaBuffer(): void;
|
|
18
|
-
onMoveEnd(panInertiaOptions?: IDragPanOptions): ({
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
} & {
|
|
21
|
-
noMoveStart: boolean;
|
|
22
|
-
}) | undefined;
|
|
23
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { EarthMap } from '../earthmap';
|
|
2
|
-
import type { Map } from '../map';
|
|
3
|
-
import type { IHandlerResult } from './IHandler';
|
|
4
|
-
import RenderFrameEvent from './events/render_event';
|
|
5
|
-
export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
|
|
6
|
-
export interface IHandlerOptions {
|
|
7
|
-
interactive: boolean;
|
|
8
|
-
boxZoom: boolean;
|
|
9
|
-
dragRotate: boolean;
|
|
10
|
-
dragPan: boolean;
|
|
11
|
-
keyboard: boolean;
|
|
12
|
-
doubleClickZoom: boolean;
|
|
13
|
-
touchZoomRotate: boolean;
|
|
14
|
-
touchPitch: boolean;
|
|
15
|
-
trackResize: boolean;
|
|
16
|
-
renderWorldCopies: boolean;
|
|
17
|
-
bearingSnap: number;
|
|
18
|
-
clickTolerance: number;
|
|
19
|
-
pitchWithRotate: boolean;
|
|
20
|
-
pitchEnabled: boolean;
|
|
21
|
-
rotateEnabled: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare class HandlerManager {
|
|
24
|
-
private map;
|
|
25
|
-
private el;
|
|
26
|
-
private handlers;
|
|
27
|
-
private eventsInProgress;
|
|
28
|
-
private frameId;
|
|
29
|
-
private inertia;
|
|
30
|
-
private bearingSnap;
|
|
31
|
-
private handlersById;
|
|
32
|
-
private updatingCamera;
|
|
33
|
-
private changes;
|
|
34
|
-
private previousActiveHandlers;
|
|
35
|
-
private bearingChanged;
|
|
36
|
-
private rotateEnabled;
|
|
37
|
-
private pitchEnabled;
|
|
38
|
-
private listeners;
|
|
39
|
-
constructor(map: Map | EarthMap, options: IHandlerOptions);
|
|
40
|
-
destroy(): void;
|
|
41
|
-
stop(): void;
|
|
42
|
-
isActive(): boolean;
|
|
43
|
-
isZooming(): boolean;
|
|
44
|
-
isRotating(): boolean;
|
|
45
|
-
isMoving(): boolean;
|
|
46
|
-
handleWindowEvent: (e: InputEvent) => void;
|
|
47
|
-
handleEvent: (e: InputEvent | RenderFrameEvent, eventName?: string) => void;
|
|
48
|
-
mergeIHandlerResult(mergedIHandlerResult: IHandlerResult, eventsInProgress: {
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
}, HandlerResult: IHandlerResult, name: string, e?: InputEvent): void;
|
|
51
|
-
triggerRenderFrame(): void;
|
|
52
|
-
private addDefaultHandlers;
|
|
53
|
-
private add;
|
|
54
|
-
private blockedByActive;
|
|
55
|
-
private getMapTouches;
|
|
56
|
-
private applyChanges;
|
|
57
|
-
private updateMapTransform;
|
|
58
|
-
private fireEvents;
|
|
59
|
-
private fireEvent;
|
|
60
|
-
}
|
|
61
|
-
export default HandlerManager;
|
|
@@ -1,495 +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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
10
|
-
var _point = _interopRequireDefault(require("../geo/point"));
|
|
11
|
-
var _dom = _interopRequireDefault(require("../utils/dom"));
|
|
12
|
-
var _blockable_map_event = _interopRequireDefault(require("./blockable_map_event"));
|
|
13
|
-
var _box_zoom = _interopRequireDefault(require("./box_zoom"));
|
|
14
|
-
var _click_zoom = _interopRequireDefault(require("./click_zoom"));
|
|
15
|
-
var _event = require("./events/event");
|
|
16
|
-
var _render_event = _interopRequireDefault(require("./events/render_event"));
|
|
17
|
-
var _handler_inertia = _interopRequireDefault(require("./handler_inertia"));
|
|
18
|
-
var _keyboard = _interopRequireDefault(require("./keyboard"));
|
|
19
|
-
var _map_event = _interopRequireDefault(require("./map_event"));
|
|
20
|
-
var _mouse = require("./mouse");
|
|
21
|
-
var _scroll_zoom = _interopRequireDefault(require("./scroll_zoom"));
|
|
22
|
-
var _dblclick_zoom = _interopRequireDefault(require("./shim/dblclick_zoom"));
|
|
23
|
-
var _drag_pan = _interopRequireDefault(require("./shim/drag_pan"));
|
|
24
|
-
var _drag_rotate = _interopRequireDefault(require("./shim/drag_rotate"));
|
|
25
|
-
var _touch_zoom_rotate = _interopRequireDefault(require("./shim/touch_zoom_rotate"));
|
|
26
|
-
var _tap_drag_zoom = _interopRequireDefault(require("./tap/tap_drag_zoom"));
|
|
27
|
-
var _tap_zoom = _interopRequireDefault(require("./tap/tap_zoom"));
|
|
28
|
-
var _touch = require("./touch");
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
// tslint:disable-next-line: no-submodule-imports
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
merge
|
|
34
|
-
} = _l7Utils.lodashUtil;
|
|
35
|
-
const isMoving = p => p.zoom || p.drag || p.pitch || p.rotate;
|
|
36
|
-
function hasChange(result) {
|
|
37
|
-
return result.panDelta && result.panDelta.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta;
|
|
38
|
-
}
|
|
39
|
-
class HandlerManager {
|
|
40
|
-
constructor(map, options) {
|
|
41
|
-
(0, _defineProperty2.default)(this, "map", void 0);
|
|
42
|
-
(0, _defineProperty2.default)(this, "el", void 0);
|
|
43
|
-
(0, _defineProperty2.default)(this, "handlers", void 0);
|
|
44
|
-
(0, _defineProperty2.default)(this, "eventsInProgress", void 0);
|
|
45
|
-
(0, _defineProperty2.default)(this, "frameId", void 0);
|
|
46
|
-
(0, _defineProperty2.default)(this, "inertia", void 0);
|
|
47
|
-
(0, _defineProperty2.default)(this, "bearingSnap", void 0);
|
|
48
|
-
(0, _defineProperty2.default)(this, "handlersById", void 0);
|
|
49
|
-
(0, _defineProperty2.default)(this, "updatingCamera", void 0);
|
|
50
|
-
(0, _defineProperty2.default)(this, "changes", void 0);
|
|
51
|
-
(0, _defineProperty2.default)(this, "previousActiveHandlers", void 0);
|
|
52
|
-
(0, _defineProperty2.default)(this, "bearingChanged", void 0);
|
|
53
|
-
(0, _defineProperty2.default)(this, "rotateEnabled", void 0);
|
|
54
|
-
(0, _defineProperty2.default)(this, "pitchEnabled", void 0);
|
|
55
|
-
(0, _defineProperty2.default)(this, "listeners", void 0);
|
|
56
|
-
(0, _defineProperty2.default)(this, "handleWindowEvent", e => {
|
|
57
|
-
this.handleEvent(e, `${e.type}Window`);
|
|
58
|
-
});
|
|
59
|
-
(0, _defineProperty2.default)(this, "handleEvent", (e, eventName) => {
|
|
60
|
-
if (e.type === 'blur') {
|
|
61
|
-
this.stop();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this.updatingCamera = true;
|
|
65
|
-
const inputEvent = e.type === 'renderFrame' ? undefined : e;
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
* We don't call e.preventDefault() for any events by default.
|
|
69
|
-
* Handlers are responsible for calling it where necessary.
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
const mergedIHandlerResult = {
|
|
73
|
-
needsRenderFrame: false
|
|
74
|
-
};
|
|
75
|
-
const eventsInProgress = {};
|
|
76
|
-
const activeHandlers = {};
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
const mapTouches = e.touches ?
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
this.getMapTouches(e.touches) : undefined;
|
|
81
|
-
const points = mapTouches ? _dom.default.touchPos(this.el, mapTouches) : _dom.default.mousePos(this.el, e);
|
|
82
|
-
for (const {
|
|
83
|
-
handlerName,
|
|
84
|
-
handler,
|
|
85
|
-
allowed
|
|
86
|
-
} of this.handlers) {
|
|
87
|
-
if (!handler.isEnabled()) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
let data;
|
|
91
|
-
if (this.blockedByActive(activeHandlers, allowed, handlerName)) {
|
|
92
|
-
handler.reset();
|
|
93
|
-
} else {
|
|
94
|
-
const handerName = eventName || e.type;
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
if (handler && handler[handerName]) {
|
|
97
|
-
// @ts-ignore
|
|
98
|
-
data = handler[handerName](e, points, mapTouches);
|
|
99
|
-
this.mergeIHandlerResult(mergedIHandlerResult, eventsInProgress, data, handlerName, inputEvent);
|
|
100
|
-
if (data && data.needsRenderFrame) {
|
|
101
|
-
this.triggerRenderFrame();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
// @ts-ignore
|
|
106
|
-
if (data || handler.isActive()) {
|
|
107
|
-
activeHandlers[handlerName] = handler;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const deactivatedHandlers = {};
|
|
111
|
-
for (const name in this.previousActiveHandlers) {
|
|
112
|
-
if (!activeHandlers[name]) {
|
|
113
|
-
deactivatedHandlers[name] = inputEvent;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
this.previousActiveHandlers = activeHandlers;
|
|
117
|
-
if (Object.keys(deactivatedHandlers).length || hasChange(mergedIHandlerResult)) {
|
|
118
|
-
this.changes.push([mergedIHandlerResult, eventsInProgress, deactivatedHandlers]);
|
|
119
|
-
this.triggerRenderFrame();
|
|
120
|
-
}
|
|
121
|
-
if (Object.keys(activeHandlers).length || hasChange(mergedIHandlerResult)) {
|
|
122
|
-
this.map.stop(true);
|
|
123
|
-
}
|
|
124
|
-
this.updatingCamera = false;
|
|
125
|
-
const {
|
|
126
|
-
cameraAnimation
|
|
127
|
-
} = mergedIHandlerResult;
|
|
128
|
-
if (cameraAnimation) {
|
|
129
|
-
this.inertia.clear();
|
|
130
|
-
this.fireEvents({}, {});
|
|
131
|
-
this.changes = [];
|
|
132
|
-
cameraAnimation(this.map);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
this.map = map;
|
|
136
|
-
this.el = this.map.getCanvasContainer();
|
|
137
|
-
this.handlers = [];
|
|
138
|
-
this.handlersById = {};
|
|
139
|
-
this.changes = [];
|
|
140
|
-
this.inertia = new _handler_inertia.default(map);
|
|
141
|
-
this.bearingSnap = options.bearingSnap;
|
|
142
|
-
this.rotateEnabled = options.rotateEnabled;
|
|
143
|
-
this.pitchEnabled = options.pitchEnabled;
|
|
144
|
-
this.previousActiveHandlers = {};
|
|
145
|
-
|
|
146
|
-
// Track whether map is currently moving, to compute start/move/end events
|
|
147
|
-
this.eventsInProgress = {};
|
|
148
|
-
this.addDefaultHandlers(options);
|
|
149
|
-
const el = this.el;
|
|
150
|
-
this.listeners = [];
|
|
151
|
-
// l7 - mini
|
|
152
|
-
this.listeners = [
|
|
153
|
-
// Bind touchstart and touchmove with passive: false because, even though
|
|
154
|
-
// they only fire a map events and therefore could theoretically be
|
|
155
|
-
// passive, binding with passive: true causes iOS not to respect
|
|
156
|
-
// e.preventDefault() in _other_ handlers, even if they are non-passive
|
|
157
|
-
// (see https://bugs.webkit.org/show_bug.cgi?id=184251)
|
|
158
|
-
[el, 'touchstart', {
|
|
159
|
-
passive: false
|
|
160
|
-
}], [el, 'touchmove', {
|
|
161
|
-
passive: false
|
|
162
|
-
}], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
|
|
163
|
-
// Bind window-level event listeners for move and up/end events. In the absence of
|
|
164
|
-
// the pointer capture API, which is not supported by all necessary platforms,
|
|
165
|
-
// window-level event listeners give us the best shot at capturing events that
|
|
166
|
-
// fall outside the map canvas element. Use `{capture: true}` for the move event
|
|
167
|
-
// to prevent map move events from being fired during a drag.
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
[window.document, 'mousemove', {
|
|
170
|
-
capture: true
|
|
171
|
-
}],
|
|
172
|
-
// @ts-ignore
|
|
173
|
-
[window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
|
|
174
|
-
capture: false
|
|
175
|
-
}], [el, 'keyup', undefined], [el, 'wheel', {
|
|
176
|
-
passive: false
|
|
177
|
-
}], [el, 'contextmenu', undefined],
|
|
178
|
-
// @ts-ignore
|
|
179
|
-
[window, 'blur', undefined]];
|
|
180
|
-
for (const [target, type, listenerOptions] of this.listeners) {
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
_dom.default.addEventListener(target, type,
|
|
183
|
-
// @ts-ignore
|
|
184
|
-
target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
destroy() {
|
|
188
|
-
for (const [target, type, listenerOptions] of this.listeners) {
|
|
189
|
-
// @ts-ignore
|
|
190
|
-
_dom.default.removeEventListener(target, type,
|
|
191
|
-
// @ts-ignore
|
|
192
|
-
target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
stop() {
|
|
196
|
-
// do nothing if this method was triggered by a gesture update
|
|
197
|
-
if (this.updatingCamera) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
for (const {
|
|
201
|
-
handler
|
|
202
|
-
} of this.handlers) {
|
|
203
|
-
handler.reset();
|
|
204
|
-
}
|
|
205
|
-
this.inertia.clear();
|
|
206
|
-
this.fireEvents({}, {});
|
|
207
|
-
this.changes = [];
|
|
208
|
-
}
|
|
209
|
-
isActive() {
|
|
210
|
-
for (const {
|
|
211
|
-
handler
|
|
212
|
-
} of this.handlers) {
|
|
213
|
-
if (handler.isActive()) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
isZooming() {
|
|
220
|
-
return !!this.eventsInProgress.zoom || this.map.scrollZoom.isZooming();
|
|
221
|
-
}
|
|
222
|
-
isRotating() {
|
|
223
|
-
return !!this.eventsInProgress.rotate;
|
|
224
|
-
}
|
|
225
|
-
isMoving() {
|
|
226
|
-
return Boolean(isMoving(this.eventsInProgress)) || this.isZooming();
|
|
227
|
-
}
|
|
228
|
-
mergeIHandlerResult(mergedIHandlerResult, eventsInProgress, HandlerResult, name, e) {
|
|
229
|
-
if (!HandlerResult) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
merge(mergedIHandlerResult, HandlerResult);
|
|
233
|
-
const eventData = {
|
|
234
|
-
handlerName: name,
|
|
235
|
-
originalEvent: HandlerResult.originalEvent || e
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
// track which handler changed which camera property
|
|
239
|
-
if (HandlerResult.zoomDelta !== undefined) {
|
|
240
|
-
eventsInProgress.zoom = eventData;
|
|
241
|
-
}
|
|
242
|
-
if (HandlerResult.panDelta !== undefined) {
|
|
243
|
-
eventsInProgress.drag = eventData;
|
|
244
|
-
}
|
|
245
|
-
if (HandlerResult.pitchDelta !== undefined) {
|
|
246
|
-
eventsInProgress.pitch = eventData;
|
|
247
|
-
}
|
|
248
|
-
if (HandlerResult.bearingDelta !== undefined) {
|
|
249
|
-
eventsInProgress.rotate = eventData;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
triggerRenderFrame() {
|
|
253
|
-
if (this.frameId === undefined) {
|
|
254
|
-
this.frameId = this.map.requestRenderFrame(timeStamp => {
|
|
255
|
-
// @ts-ignore
|
|
256
|
-
delete this.frameId;
|
|
257
|
-
this.handleEvent(new _render_event.default('renderFrame', timeStamp));
|
|
258
|
-
this.applyChanges();
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
addDefaultHandlers(options) {
|
|
263
|
-
const map = this.map;
|
|
264
|
-
const el = map.getCanvasContainer();
|
|
265
|
-
this.add('mapEvent', new _map_event.default(map, options));
|
|
266
|
-
const boxZoom = map.boxZoom = new _box_zoom.default(map, options);
|
|
267
|
-
this.add('boxZoom', boxZoom);
|
|
268
|
-
const tapZoom = new _tap_zoom.default();
|
|
269
|
-
const clickZoom = new _click_zoom.default();
|
|
270
|
-
map.doubleClickZoom = new _dblclick_zoom.default(clickZoom, tapZoom);
|
|
271
|
-
this.add('tapZoom', tapZoom);
|
|
272
|
-
this.add('clickZoom', clickZoom);
|
|
273
|
-
const tapDragZoom = new _tap_drag_zoom.default();
|
|
274
|
-
this.add('tapDragZoom', tapDragZoom);
|
|
275
|
-
const touchPitch = map.touchPitch = new _touch.TouchPitchHandler();
|
|
276
|
-
this.add('touchPitch', touchPitch);
|
|
277
|
-
const mouseRotate = new _mouse.MouseRotateHandler(options);
|
|
278
|
-
const mousePitch = new _mouse.MousePitchHandler(options);
|
|
279
|
-
map.dragRotate = new _drag_rotate.default(options, mouseRotate, mousePitch);
|
|
280
|
-
this.add('mouseRotate', mouseRotate, ['mousePitch']);
|
|
281
|
-
this.add('mousePitch', mousePitch, ['mouseRotate']);
|
|
282
|
-
const mousePan = new _mouse.MousePanHandler(options);
|
|
283
|
-
const touchPan = new _touch.TouchPanHandler(options);
|
|
284
|
-
map.dragPan = new _drag_pan.default(el, mousePan, touchPan);
|
|
285
|
-
this.add('mousePan', mousePan);
|
|
286
|
-
this.add('touchPan', touchPan, ['touchZoom', 'touchRotate']);
|
|
287
|
-
const touchRotate = new _touch.TouchRotateHandler();
|
|
288
|
-
const touchZoom = new _touch.TouchZoomHandler();
|
|
289
|
-
map.touchZoomRotate = new _touch_zoom_rotate.default(el, touchZoom, touchRotate, tapDragZoom);
|
|
290
|
-
this.add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);
|
|
291
|
-
this.add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);
|
|
292
|
-
const scrollZoom = map.scrollZoom = new _scroll_zoom.default(map, this);
|
|
293
|
-
this.add('scrollZoom', scrollZoom, ['mousePan']);
|
|
294
|
-
const keyboard = map.keyboard = new _keyboard.default();
|
|
295
|
-
this.add('keyboard', keyboard);
|
|
296
|
-
this.add('blockableMapEvent', new _blockable_map_event.default(map));
|
|
297
|
-
for (const name of ['boxZoom', 'doubleClickZoom', 'tapDragZoom', 'touchPitch', 'dragRotate', 'dragPan', 'touchZoomRotate', 'scrollZoom', 'keyboard']) {
|
|
298
|
-
// @ts-ignore
|
|
299
|
-
if (options.interactive && options[name]) {
|
|
300
|
-
// @ts-ignore
|
|
301
|
-
map[name].enable(options[name]);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
add(handlerName, handler, allowed) {
|
|
306
|
-
this.handlers.push({
|
|
307
|
-
handlerName,
|
|
308
|
-
handler,
|
|
309
|
-
allowed
|
|
310
|
-
});
|
|
311
|
-
this.handlersById[handlerName] = handler;
|
|
312
|
-
}
|
|
313
|
-
blockedByActive(activeHandlers, allowed, myName) {
|
|
314
|
-
for (const name in activeHandlers) {
|
|
315
|
-
if (name === myName) {
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
if (!allowed || allowed.indexOf(name) < 0) {
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
getMapTouches(touches) {
|
|
325
|
-
const mapTouches = [];
|
|
326
|
-
for (const t of touches) {
|
|
327
|
-
const target = t.target;
|
|
328
|
-
if (this.el.contains(target)) {
|
|
329
|
-
mapTouches.push(t);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return mapTouches;
|
|
333
|
-
}
|
|
334
|
-
applyChanges() {
|
|
335
|
-
const combined = {};
|
|
336
|
-
const combinedEventsInProgress = {};
|
|
337
|
-
const combinedDeactivatedHandlers = {};
|
|
338
|
-
for (const [change, eventsInProgress, deactivatedHandlers] of this.changes) {
|
|
339
|
-
if (change.panDelta) {
|
|
340
|
-
combined.panDelta = (combined.panDelta || new _point.default(0, 0))._add(change.panDelta);
|
|
341
|
-
}
|
|
342
|
-
if (change.zoomDelta) {
|
|
343
|
-
combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;
|
|
344
|
-
}
|
|
345
|
-
if (change.bearingDelta) {
|
|
346
|
-
combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;
|
|
347
|
-
}
|
|
348
|
-
if (change.pitchDelta) {
|
|
349
|
-
combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;
|
|
350
|
-
}
|
|
351
|
-
if (change.around !== undefined) {
|
|
352
|
-
combined.around = change.around;
|
|
353
|
-
}
|
|
354
|
-
if (change.pinchAround !== undefined) {
|
|
355
|
-
combined.pinchAround = change.pinchAround;
|
|
356
|
-
}
|
|
357
|
-
if (change.noInertia) {
|
|
358
|
-
combined.noInertia = change.noInertia;
|
|
359
|
-
}
|
|
360
|
-
merge(combinedEventsInProgress, eventsInProgress);
|
|
361
|
-
merge(combinedDeactivatedHandlers, deactivatedHandlers);
|
|
362
|
-
}
|
|
363
|
-
this.updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);
|
|
364
|
-
this.changes = [];
|
|
365
|
-
}
|
|
366
|
-
updateMapTransform(combinedResult, combinedEventsInProgress, deactivatedHandlers) {
|
|
367
|
-
const map = this.map;
|
|
368
|
-
const tr = map.transform;
|
|
369
|
-
if (!hasChange(combinedResult)) {
|
|
370
|
-
return this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
|
|
371
|
-
}
|
|
372
|
-
const {
|
|
373
|
-
panDelta,
|
|
374
|
-
zoomDelta,
|
|
375
|
-
bearingDelta,
|
|
376
|
-
pitchDelta,
|
|
377
|
-
pinchAround
|
|
378
|
-
} = combinedResult;
|
|
379
|
-
let {
|
|
380
|
-
around
|
|
381
|
-
} = combinedResult;
|
|
382
|
-
if (pinchAround !== undefined) {
|
|
383
|
-
around = pinchAround;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// stop any ongoing camera animations (easeTo, flyTo)
|
|
387
|
-
map.stop(true);
|
|
388
|
-
around = around || map.transform.centerPoint;
|
|
389
|
-
const loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);
|
|
390
|
-
if (bearingDelta && this.rotateEnabled) {
|
|
391
|
-
tr.bearing += bearingDelta;
|
|
392
|
-
}
|
|
393
|
-
if (pitchDelta && this.pitchEnabled) {
|
|
394
|
-
tr.pitch += pitchDelta;
|
|
395
|
-
}
|
|
396
|
-
if (zoomDelta) {
|
|
397
|
-
tr.zoom += zoomDelta;
|
|
398
|
-
}
|
|
399
|
-
tr.setLocationAtPoint(loc, around);
|
|
400
|
-
this.map.update();
|
|
401
|
-
if (!combinedResult.noInertia) {
|
|
402
|
-
this.inertia.record(combinedResult);
|
|
403
|
-
}
|
|
404
|
-
this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
|
|
405
|
-
}
|
|
406
|
-
fireEvents(newEventsInProgress, deactivatedHandlers) {
|
|
407
|
-
const wasMoving = isMoving(this.eventsInProgress);
|
|
408
|
-
const nowMoving = isMoving(newEventsInProgress);
|
|
409
|
-
const startEvents = {};
|
|
410
|
-
for (const eventName in newEventsInProgress) {
|
|
411
|
-
if (newEventsInProgress[eventName]) {
|
|
412
|
-
const {
|
|
413
|
-
originalEvent
|
|
414
|
-
} = newEventsInProgress[eventName];
|
|
415
|
-
if (!this.eventsInProgress[eventName]) {
|
|
416
|
-
startEvents[`${eventName}start`] = originalEvent;
|
|
417
|
-
}
|
|
418
|
-
this.eventsInProgress[eventName] = newEventsInProgress[eventName];
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// fire start events only after this.eventsInProgress has been updated
|
|
423
|
-
if (!wasMoving && nowMoving) {
|
|
424
|
-
this.fireEvent('movestart', nowMoving.originalEvent);
|
|
425
|
-
}
|
|
426
|
-
for (const name in startEvents) {
|
|
427
|
-
if (startEvents[name]) {
|
|
428
|
-
this.fireEvent(name, startEvents[name]);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
if (newEventsInProgress.rotate) {
|
|
432
|
-
this.bearingChanged = true;
|
|
433
|
-
}
|
|
434
|
-
if (nowMoving) {
|
|
435
|
-
this.fireEvent('move', nowMoving.originalEvent);
|
|
436
|
-
}
|
|
437
|
-
for (const eventName in newEventsInProgress) {
|
|
438
|
-
if (newEventsInProgress[eventName]) {
|
|
439
|
-
const {
|
|
440
|
-
originalEvent
|
|
441
|
-
} = newEventsInProgress[eventName];
|
|
442
|
-
this.fireEvent(eventName, originalEvent);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const endEvents = {};
|
|
446
|
-
let originalEndEvent;
|
|
447
|
-
for (const eventName in this.eventsInProgress) {
|
|
448
|
-
if (this.eventsInProgress[eventName]) {
|
|
449
|
-
const {
|
|
450
|
-
handlerName,
|
|
451
|
-
originalEvent
|
|
452
|
-
} = this.eventsInProgress[eventName];
|
|
453
|
-
if (!this.handlersById[handlerName].isActive()) {
|
|
454
|
-
delete this.eventsInProgress[eventName];
|
|
455
|
-
originalEndEvent = deactivatedHandlers[handlerName] || originalEvent;
|
|
456
|
-
endEvents[`${eventName}end`] = originalEndEvent;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
for (const name in endEvents) {
|
|
461
|
-
if (endEvents[name]) {
|
|
462
|
-
this.fireEvent(name, endEvents[name]);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
const stillMoving = isMoving(this.eventsInProgress);
|
|
466
|
-
if ((wasMoving || nowMoving) && !stillMoving) {
|
|
467
|
-
this.updatingCamera = true;
|
|
468
|
-
const inertialEase = this.inertia.onMoveEnd(this.map.dragPan.inertiaOptions);
|
|
469
|
-
const shouldSnapToNorth = bearing => bearing !== 0 && -this.bearingSnap < bearing && bearing < this.bearingSnap;
|
|
470
|
-
if (inertialEase) {
|
|
471
|
-
if (shouldSnapToNorth(inertialEase.bearing || this.map.getBearing())) {
|
|
472
|
-
inertialEase.bearing = 0;
|
|
473
|
-
}
|
|
474
|
-
this.map.easeTo(inertialEase, {
|
|
475
|
-
originalEvent: originalEndEvent
|
|
476
|
-
});
|
|
477
|
-
} else {
|
|
478
|
-
this.map.emit('moveend', new _event.Event('moveend', {
|
|
479
|
-
originalEvent: originalEndEvent
|
|
480
|
-
}));
|
|
481
|
-
if (shouldSnapToNorth(this.map.getBearing())) {
|
|
482
|
-
this.map.resetNorth();
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
this.bearingChanged = false;
|
|
486
|
-
this.updatingCamera = false;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
fireEvent(type, e) {
|
|
490
|
-
this.map.emit(type, new _event.Event(type, e ? {
|
|
491
|
-
originalEvent: e
|
|
492
|
-
} : {}));
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
var _default = exports.default = HandlerManager;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { EarthMap } from '../earthmap';
|
|
2
|
-
import type { Map } from '../map';
|
|
3
|
-
/**
|
|
4
|
-
* The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using
|
|
5
|
-
* the following keyboard shortcuts:
|
|
6
|
-
*
|
|
7
|
-
* - `=` / `+`: Increase the zoom level by 1.
|
|
8
|
-
* - `Shift-=` / `Shift-+`: Increase the zoom level by 2.
|
|
9
|
-
* - `-`: Decrease the zoom level by 1.
|
|
10
|
-
* - `Shift--`: Decrease the zoom level by 2.
|
|
11
|
-
* - Arrow keys: Pan by 100 pixels.
|
|
12
|
-
* - `Shift+⇢`: Increase the rotation by 15 degrees.
|
|
13
|
-
* - `Shift+⇠`: Decrease the rotation by 15 degrees.
|
|
14
|
-
* - `Shift+⇡`: Increase the pitch by 10 degrees.
|
|
15
|
-
* - `Shift+⇣`: Decrease the pitch by 10 degrees.
|
|
16
|
-
*/
|
|
17
|
-
declare class KeyboardHandler {
|
|
18
|
-
private enabled;
|
|
19
|
-
private active;
|
|
20
|
-
private panStep;
|
|
21
|
-
private bearingStep;
|
|
22
|
-
private pitchStep;
|
|
23
|
-
/**
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
constructor();
|
|
27
|
-
reset(): void;
|
|
28
|
-
keydown(e: KeyboardEvent): {
|
|
29
|
-
cameraAnimation: (map: Map | EarthMap) => void;
|
|
30
|
-
} | undefined;
|
|
31
|
-
enable(): void;
|
|
32
|
-
disable(): void;
|
|
33
|
-
isEnabled(): boolean;
|
|
34
|
-
isActive(): boolean;
|
|
35
|
-
}
|
|
36
|
-
export default KeyboardHandler;
|