@antv/l7-map 2.21.11-beta.4 → 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
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HandlerManager = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
|
|
10
|
+
var _box_zoom = require("./handler/box_zoom");
|
|
11
|
+
var _click_zoom = require("./handler/click_zoom");
|
|
12
|
+
var _cooperative_gestures = require("./handler/cooperative_gestures");
|
|
13
|
+
var _keyboard = require("./handler/keyboard");
|
|
14
|
+
var _map_event = require("./handler/map_event");
|
|
15
|
+
var _mouse = require("./handler/mouse");
|
|
16
|
+
var _scroll_zoom = require("./handler/scroll_zoom");
|
|
17
|
+
var _dblclick_zoom = require("./handler/shim/dblclick_zoom");
|
|
18
|
+
var _drag_pan = require("./handler/shim/drag_pan");
|
|
19
|
+
var _drag_rotate = require("./handler/shim/drag_rotate");
|
|
20
|
+
var _two_fingers_touch = require("./handler/shim/two_fingers_touch");
|
|
21
|
+
var _tap_drag_zoom = require("./handler/tap_drag_zoom");
|
|
22
|
+
var _tap_zoom = require("./handler/tap_zoom");
|
|
23
|
+
var _touch_pan = require("./handler/touch_pan");
|
|
24
|
+
var _two_fingers_touch2 = require("./handler/two_fingers_touch");
|
|
25
|
+
var _handler_inertia = require("./handler_inertia");
|
|
26
|
+
var _browser = require("./util/browser");
|
|
27
|
+
var _dom = require("./util/dom");
|
|
28
|
+
var _evented = require("./util/evented");
|
|
29
|
+
var _util = require("./util/util");
|
|
30
|
+
const isMoving = p => p.zoom || p.drag || p.pitch || p.rotate;
|
|
31
|
+
class RenderFrameEvent extends _evented.Event {
|
|
32
|
+
constructor(type, timeStamp) {
|
|
33
|
+
super(type);
|
|
34
|
+
(0, _defineProperty2.default)(this, "type", 'renderFrame');
|
|
35
|
+
(0, _defineProperty2.default)(this, "timeStamp", void 0);
|
|
36
|
+
this.timeStamp = timeStamp;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Handlers interpret dom events and return camera changes that should be
|
|
42
|
+
* applied to the map (`HandlerResult`s). The camera changes are all deltas.
|
|
43
|
+
* The handler itself should have no knowledge of the map's current state.
|
|
44
|
+
* This makes it easier to merge multiple results and keeps handlers simpler.
|
|
45
|
+
* For example, if there is a mousedown and mousemove, the mousePan handler
|
|
46
|
+
* would return a `panDelta` on the mousemove.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* All handler methods that are called with events can optionally return a `HandlerResult`.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
function hasChange(result) {
|
|
54
|
+
return result.panDelta && result.panDelta.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta;
|
|
55
|
+
}
|
|
56
|
+
class HandlerManager {
|
|
57
|
+
constructor(map, options) {
|
|
58
|
+
(0, _defineProperty2.default)(this, "_map", void 0);
|
|
59
|
+
(0, _defineProperty2.default)(this, "_el", void 0);
|
|
60
|
+
(0, _defineProperty2.default)(this, "_handlers", void 0);
|
|
61
|
+
(0, _defineProperty2.default)(this, "_eventsInProgress", void 0);
|
|
62
|
+
(0, _defineProperty2.default)(this, "_frameId", void 0);
|
|
63
|
+
(0, _defineProperty2.default)(this, "_inertia", void 0);
|
|
64
|
+
(0, _defineProperty2.default)(this, "_bearingSnap", void 0);
|
|
65
|
+
(0, _defineProperty2.default)(this, "_handlersById", void 0);
|
|
66
|
+
(0, _defineProperty2.default)(this, "_updatingCamera", void 0);
|
|
67
|
+
(0, _defineProperty2.default)(this, "_changes", void 0);
|
|
68
|
+
(0, _defineProperty2.default)(this, "_zoom", void 0);
|
|
69
|
+
(0, _defineProperty2.default)(this, "_previousActiveHandlers", void 0);
|
|
70
|
+
(0, _defineProperty2.default)(this, "_listeners", void 0);
|
|
71
|
+
(0, _defineProperty2.default)(this, "handleWindowEvent", e => {
|
|
72
|
+
this.handleEvent(e, `${e.type}Window`);
|
|
73
|
+
});
|
|
74
|
+
(0, _defineProperty2.default)(this, "handleEvent", (e, eventName) => {
|
|
75
|
+
if (e.type === 'blur') {
|
|
76
|
+
this.stop(true);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this._updatingCamera = true;
|
|
80
|
+
const inputEvent = e.type === 'renderFrame' ? undefined : e;
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* We don't call e.preventDefault() for any events by default.
|
|
84
|
+
* Handlers are responsible for calling it where necessary.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
const mergedHandlerResult = {
|
|
88
|
+
needsRenderFrame: false
|
|
89
|
+
};
|
|
90
|
+
const eventsInProgress = {};
|
|
91
|
+
const activeHandlers = {};
|
|
92
|
+
const eventTouches = e.touches;
|
|
93
|
+
const mapTouches = eventTouches ? this._getMapTouches(eventTouches) : undefined;
|
|
94
|
+
const points = mapTouches ? _dom.DOM.touchPos(this._map.getCanvasContainer(), mapTouches) : _dom.DOM.mousePos(this._map.getCanvasContainer(), e);
|
|
95
|
+
for (const {
|
|
96
|
+
handlerName,
|
|
97
|
+
handler,
|
|
98
|
+
allowed
|
|
99
|
+
} of this._handlers) {
|
|
100
|
+
if (!handler.isEnabled()) continue;
|
|
101
|
+
let data;
|
|
102
|
+
if (this._blockedByActive(activeHandlers, allowed, handlerName)) {
|
|
103
|
+
handler.reset();
|
|
104
|
+
} else {
|
|
105
|
+
if (handler[eventName || e.type]) {
|
|
106
|
+
data = handler[eventName || e.type](e, points, mapTouches);
|
|
107
|
+
this.mergeHandlerResult(mergedHandlerResult, eventsInProgress, data, handlerName, inputEvent);
|
|
108
|
+
if (data && data.needsRenderFrame) {
|
|
109
|
+
this._triggerRenderFrame();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (data || handler.isActive()) {
|
|
114
|
+
activeHandlers[handlerName] = handler;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const deactivatedHandlers = {};
|
|
118
|
+
for (const name in this._previousActiveHandlers) {
|
|
119
|
+
if (!activeHandlers[name]) {
|
|
120
|
+
deactivatedHandlers[name] = inputEvent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this._previousActiveHandlers = activeHandlers;
|
|
124
|
+
if (Object.keys(deactivatedHandlers).length || hasChange(mergedHandlerResult)) {
|
|
125
|
+
this._changes.push([mergedHandlerResult, eventsInProgress, deactivatedHandlers]);
|
|
126
|
+
this._triggerRenderFrame();
|
|
127
|
+
}
|
|
128
|
+
if (Object.keys(activeHandlers).length || hasChange(mergedHandlerResult)) {
|
|
129
|
+
this._map._stop(true);
|
|
130
|
+
}
|
|
131
|
+
this._updatingCamera = false;
|
|
132
|
+
const {
|
|
133
|
+
cameraAnimation
|
|
134
|
+
} = mergedHandlerResult;
|
|
135
|
+
if (cameraAnimation) {
|
|
136
|
+
this._inertia.clear();
|
|
137
|
+
this._fireEvents({}, {}, true);
|
|
138
|
+
this._changes = [];
|
|
139
|
+
cameraAnimation(this._map);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
this._map = map;
|
|
143
|
+
this._el = this._map.getCanvasContainer();
|
|
144
|
+
this._handlers = [];
|
|
145
|
+
this._handlersById = {};
|
|
146
|
+
this._changes = [];
|
|
147
|
+
this._inertia = new _handler_inertia.HandlerInertia(map);
|
|
148
|
+
this._bearingSnap = options.bearingSnap || 7;
|
|
149
|
+
this._previousActiveHandlers = {};
|
|
150
|
+
|
|
151
|
+
// Track whether map is currently moving, to compute start/move/end events
|
|
152
|
+
this._eventsInProgress = {};
|
|
153
|
+
this._addDefaultHandlers(options);
|
|
154
|
+
const el = this._el;
|
|
155
|
+
this._listeners = [
|
|
156
|
+
// This needs to be `passive: true` so that a double tap fires two
|
|
157
|
+
// pairs of touchstart/end events in iOS Safari 13. If this is set to
|
|
158
|
+
// `passive: false` then the second pair of events is only fired if
|
|
159
|
+
// preventDefault() is called on the first touchstart. Calling preventDefault()
|
|
160
|
+
// undesirably prevents click events.
|
|
161
|
+
[el, 'touchstart', {
|
|
162
|
+
passive: true
|
|
163
|
+
}],
|
|
164
|
+
// This needs to be `passive: false` so that scrolls and pinches can be
|
|
165
|
+
// prevented in browsers that don't support `touch-actions: none`, for example iOS Safari 12.
|
|
166
|
+
[el, 'touchmove', {
|
|
167
|
+
passive: false
|
|
168
|
+
}], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
|
|
169
|
+
// Bind window-level event listeners for move and up/end events. In the absence of
|
|
170
|
+
// the pointer capture API, which is not supported by all necessary platforms,
|
|
171
|
+
// window-level event listeners give us the best shot at capturing events that
|
|
172
|
+
// fall outside the map canvas element. Use `{capture: true}` for the move event
|
|
173
|
+
// to prevent map move events from being fired during a drag.
|
|
174
|
+
[document, 'mousemove', {
|
|
175
|
+
capture: true
|
|
176
|
+
}], [document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
|
|
177
|
+
capture: false
|
|
178
|
+
}], [el, 'keyup', undefined], [el, 'wheel', {
|
|
179
|
+
passive: false
|
|
180
|
+
}], [el, 'contextmenu', undefined], [window, 'blur', undefined]];
|
|
181
|
+
for (const [target, type, listenerOptions] of this._listeners) {
|
|
182
|
+
_dom.DOM.addEventListener(target, type, target === document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
destroy() {
|
|
186
|
+
for (const [target, type, listenerOptions] of this._listeners) {
|
|
187
|
+
_dom.DOM.removeEventListener(target, type, target === document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
_addDefaultHandlers(options) {
|
|
191
|
+
const map = this._map;
|
|
192
|
+
const el = map.getCanvasContainer();
|
|
193
|
+
this._add('mapEvent', new _map_event.MapEventHandler(map, options));
|
|
194
|
+
const boxZoom = map.boxZoom = new _box_zoom.BoxZoomHandler(map, options);
|
|
195
|
+
this._add('boxZoom', boxZoom);
|
|
196
|
+
if (options.interactive && options.boxZoom) {
|
|
197
|
+
boxZoom.enable();
|
|
198
|
+
}
|
|
199
|
+
const cooperativeGestures = map.cooperativeGestures = new _cooperative_gestures.CooperativeGesturesHandler(map, options.cooperativeGestures);
|
|
200
|
+
this._add('cooperativeGestures', cooperativeGestures);
|
|
201
|
+
if (options.cooperativeGestures) {
|
|
202
|
+
cooperativeGestures.enable();
|
|
203
|
+
}
|
|
204
|
+
const tapZoom = new _tap_zoom.TapZoomHandler(map);
|
|
205
|
+
const clickZoom = new _click_zoom.ClickZoomHandler(map);
|
|
206
|
+
map.doubleClickZoom = new _dblclick_zoom.DoubleClickZoomHandler(clickZoom, tapZoom);
|
|
207
|
+
this._add('tapZoom', tapZoom);
|
|
208
|
+
this._add('clickZoom', clickZoom);
|
|
209
|
+
if (options.interactive && options.doubleClickZoom) {
|
|
210
|
+
map.doubleClickZoom.enable();
|
|
211
|
+
}
|
|
212
|
+
const tapDragZoom = new _tap_drag_zoom.TapDragZoomHandler();
|
|
213
|
+
this._add('tapDragZoom', tapDragZoom);
|
|
214
|
+
const touchPitch = map.touchPitch = new _two_fingers_touch2.TwoFingersTouchPitchHandler(map);
|
|
215
|
+
this._add('touchPitch', touchPitch);
|
|
216
|
+
if (options.interactive && options.touchPitch) {
|
|
217
|
+
map.touchPitch.enable(options.touchPitch);
|
|
218
|
+
}
|
|
219
|
+
const mouseRotate = (0, _mouse.generateMouseRotationHandler)(options);
|
|
220
|
+
const mousePitch = (0, _mouse.generateMousePitchHandler)(options);
|
|
221
|
+
map.dragRotate = new _drag_rotate.DragRotateHandler(options, mouseRotate, mousePitch);
|
|
222
|
+
this._add('mouseRotate', mouseRotate, ['mousePitch']);
|
|
223
|
+
this._add('mousePitch', mousePitch, ['mouseRotate']);
|
|
224
|
+
if (options.interactive && options.dragRotate) {
|
|
225
|
+
map.dragRotate.enable();
|
|
226
|
+
}
|
|
227
|
+
const mousePan = (0, _mouse.generateMousePanHandler)(options);
|
|
228
|
+
const touchPan = new _touch_pan.TouchPanHandler(options, map);
|
|
229
|
+
map.dragPan = new _drag_pan.DragPanHandler(el, mousePan, touchPan);
|
|
230
|
+
this._add('mousePan', mousePan);
|
|
231
|
+
this._add('touchPan', touchPan, ['touchZoom', 'touchRotate']);
|
|
232
|
+
if (options.interactive && options.dragPan) {
|
|
233
|
+
map.dragPan.enable(options.dragPan);
|
|
234
|
+
}
|
|
235
|
+
const touchRotate = new _two_fingers_touch2.TwoFingersTouchRotateHandler();
|
|
236
|
+
const touchZoom = new _two_fingers_touch2.TwoFingersTouchZoomHandler();
|
|
237
|
+
map.touchZoomRotate = new _two_fingers_touch.TwoFingersTouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);
|
|
238
|
+
this._add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);
|
|
239
|
+
this._add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);
|
|
240
|
+
if (options.interactive && options.touchZoomRotate) {
|
|
241
|
+
map.touchZoomRotate.enable(options.touchZoomRotate);
|
|
242
|
+
}
|
|
243
|
+
const scrollZoom = map.scrollZoom = new _scroll_zoom.ScrollZoomHandler(map, () => this._triggerRenderFrame());
|
|
244
|
+
this._add('scrollZoom', scrollZoom, ['mousePan']);
|
|
245
|
+
if (options.interactive && options.scrollZoom) {
|
|
246
|
+
map.scrollZoom.enable(options.scrollZoom);
|
|
247
|
+
}
|
|
248
|
+
const keyboard = map.keyboard = new _keyboard.KeyboardHandler(map);
|
|
249
|
+
this._add('keyboard', keyboard);
|
|
250
|
+
if (options.interactive && options.keyboard) {
|
|
251
|
+
map.keyboard.enable();
|
|
252
|
+
}
|
|
253
|
+
this._add('blockableMapEvent', new _map_event.BlockableMapEventHandler(map));
|
|
254
|
+
}
|
|
255
|
+
_add(handlerName, handler, allowed) {
|
|
256
|
+
this._handlers.push({
|
|
257
|
+
handlerName,
|
|
258
|
+
handler,
|
|
259
|
+
allowed
|
|
260
|
+
});
|
|
261
|
+
this._handlersById[handlerName] = handler;
|
|
262
|
+
}
|
|
263
|
+
stop(allowEndAnimation) {
|
|
264
|
+
// do nothing if this method was triggered by a gesture update
|
|
265
|
+
if (this._updatingCamera) return;
|
|
266
|
+
for (const {
|
|
267
|
+
handler
|
|
268
|
+
} of this._handlers) {
|
|
269
|
+
handler.reset();
|
|
270
|
+
}
|
|
271
|
+
this._inertia.clear();
|
|
272
|
+
this._fireEvents({}, {}, allowEndAnimation);
|
|
273
|
+
this._changes = [];
|
|
274
|
+
}
|
|
275
|
+
isActive() {
|
|
276
|
+
for (const {
|
|
277
|
+
handler
|
|
278
|
+
} of this._handlers) {
|
|
279
|
+
if (handler.isActive()) return true;
|
|
280
|
+
}
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
isZooming() {
|
|
284
|
+
return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming();
|
|
285
|
+
}
|
|
286
|
+
isRotating() {
|
|
287
|
+
return !!this._eventsInProgress.rotate;
|
|
288
|
+
}
|
|
289
|
+
isMoving() {
|
|
290
|
+
return Boolean(isMoving(this._eventsInProgress)) || this.isZooming();
|
|
291
|
+
}
|
|
292
|
+
_blockedByActive(activeHandlers, allowed, myName) {
|
|
293
|
+
for (const name in activeHandlers) {
|
|
294
|
+
if (name === myName) continue;
|
|
295
|
+
if (!allowed || allowed.indexOf(name) < 0) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
_getMapTouches(touches) {
|
|
302
|
+
const mapTouches = [];
|
|
303
|
+
for (const t of touches) {
|
|
304
|
+
const target = t.target;
|
|
305
|
+
if (this._el.contains(target)) {
|
|
306
|
+
mapTouches.push(t);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return mapTouches;
|
|
310
|
+
}
|
|
311
|
+
mergeHandlerResult(mergedHandlerResult, eventsInProgress, handlerResult, name, e) {
|
|
312
|
+
if (!handlerResult) return;
|
|
313
|
+
(0, _util.extend)(mergedHandlerResult, handlerResult);
|
|
314
|
+
const eventData = {
|
|
315
|
+
handlerName: name,
|
|
316
|
+
originalEvent: handlerResult.originalEvent || e
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// track which handler changed which camera property
|
|
320
|
+
if (handlerResult.zoomDelta !== undefined) {
|
|
321
|
+
eventsInProgress.zoom = eventData;
|
|
322
|
+
}
|
|
323
|
+
if (handlerResult.panDelta !== undefined) {
|
|
324
|
+
eventsInProgress.drag = eventData;
|
|
325
|
+
}
|
|
326
|
+
if (handlerResult.pitchDelta !== undefined) {
|
|
327
|
+
eventsInProgress.pitch = eventData;
|
|
328
|
+
}
|
|
329
|
+
if (handlerResult.bearingDelta !== undefined) {
|
|
330
|
+
eventsInProgress.rotate = eventData;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
_applyChanges() {
|
|
334
|
+
const combined = {};
|
|
335
|
+
const combinedEventsInProgress = {};
|
|
336
|
+
const combinedDeactivatedHandlers = {};
|
|
337
|
+
for (const [change, eventsInProgress, deactivatedHandlers] of this._changes) {
|
|
338
|
+
if (change.panDelta) combined.panDelta = (combined.panDelta || new _pointGeometry.default(0, 0))._add(change.panDelta);
|
|
339
|
+
if (change.zoomDelta) combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;
|
|
340
|
+
if (change.bearingDelta) combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;
|
|
341
|
+
if (change.pitchDelta) combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;
|
|
342
|
+
if (change.around !== undefined) combined.around = change.around;
|
|
343
|
+
if (change.pinchAround !== undefined) combined.pinchAround = change.pinchAround;
|
|
344
|
+
if (change.noInertia) combined.noInertia = change.noInertia;
|
|
345
|
+
(0, _util.extend)(combinedEventsInProgress, eventsInProgress);
|
|
346
|
+
(0, _util.extend)(combinedDeactivatedHandlers, deactivatedHandlers);
|
|
347
|
+
}
|
|
348
|
+
this._updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);
|
|
349
|
+
this._changes = [];
|
|
350
|
+
}
|
|
351
|
+
_updateMapTransform(combinedResult, combinedEventsInProgress, deactivatedHandlers) {
|
|
352
|
+
const map = this._map;
|
|
353
|
+
const tr = map._getTransformForUpdate();
|
|
354
|
+
if (!hasChange(combinedResult)) {
|
|
355
|
+
return this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);
|
|
356
|
+
}
|
|
357
|
+
const {
|
|
358
|
+
panDelta,
|
|
359
|
+
zoomDelta,
|
|
360
|
+
bearingDelta,
|
|
361
|
+
pitchDelta,
|
|
362
|
+
pinchAround
|
|
363
|
+
} = combinedResult;
|
|
364
|
+
let {
|
|
365
|
+
around
|
|
366
|
+
} = combinedResult;
|
|
367
|
+
if (pinchAround !== undefined) {
|
|
368
|
+
around = pinchAround;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// stop any ongoing camera animations (easeTo, flyTo)
|
|
372
|
+
map._stop(true);
|
|
373
|
+
around = around || map.transform.centerPoint;
|
|
374
|
+
const loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);
|
|
375
|
+
if (bearingDelta) tr.bearing += bearingDelta;
|
|
376
|
+
if (pitchDelta) tr.pitch += pitchDelta;
|
|
377
|
+
if (zoomDelta) tr.zoom += zoomDelta;
|
|
378
|
+
tr.setLocationAtPoint(loc, around);
|
|
379
|
+
map._applyUpdatedTransform(tr);
|
|
380
|
+
this._map._update();
|
|
381
|
+
if (!combinedResult.noInertia) this._inertia.record(combinedResult);
|
|
382
|
+
this._fireEvents(combinedEventsInProgress, deactivatedHandlers, true);
|
|
383
|
+
}
|
|
384
|
+
_fireEvents(newEventsInProgress, deactivatedHandlers, allowEndAnimation) {
|
|
385
|
+
const wasMoving = isMoving(this._eventsInProgress);
|
|
386
|
+
const nowMoving = isMoving(newEventsInProgress);
|
|
387
|
+
const startEvents = {};
|
|
388
|
+
for (const eventName in newEventsInProgress) {
|
|
389
|
+
const {
|
|
390
|
+
originalEvent
|
|
391
|
+
} = newEventsInProgress[eventName];
|
|
392
|
+
if (!this._eventsInProgress[eventName]) {
|
|
393
|
+
startEvents[`${eventName}start`] = originalEvent;
|
|
394
|
+
}
|
|
395
|
+
this._eventsInProgress[eventName] = newEventsInProgress[eventName];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// fire start events only after this._eventsInProgress has been updated
|
|
399
|
+
if (!wasMoving && nowMoving) {
|
|
400
|
+
this._fireEvent('movestart', nowMoving.originalEvent);
|
|
401
|
+
}
|
|
402
|
+
for (const name in startEvents) {
|
|
403
|
+
this._fireEvent(name, startEvents[name]);
|
|
404
|
+
}
|
|
405
|
+
if (nowMoving) {
|
|
406
|
+
this._fireEvent('move', nowMoving.originalEvent);
|
|
407
|
+
}
|
|
408
|
+
for (const eventName in newEventsInProgress) {
|
|
409
|
+
const {
|
|
410
|
+
originalEvent
|
|
411
|
+
} = newEventsInProgress[eventName];
|
|
412
|
+
this._fireEvent(eventName, originalEvent);
|
|
413
|
+
}
|
|
414
|
+
const endEvents = {};
|
|
415
|
+
let originalEndEvent;
|
|
416
|
+
for (const eventName in this._eventsInProgress) {
|
|
417
|
+
const {
|
|
418
|
+
handlerName,
|
|
419
|
+
originalEvent
|
|
420
|
+
} = this._eventsInProgress[eventName];
|
|
421
|
+
if (!this._handlersById[handlerName].isActive()) {
|
|
422
|
+
delete this._eventsInProgress[eventName];
|
|
423
|
+
originalEndEvent = deactivatedHandlers[handlerName] || originalEvent;
|
|
424
|
+
endEvents[`${eventName}end`] = originalEndEvent;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
for (const name in endEvents) {
|
|
428
|
+
this._fireEvent(name, endEvents[name]);
|
|
429
|
+
}
|
|
430
|
+
const stillMoving = isMoving(this._eventsInProgress);
|
|
431
|
+
const finishedMoving = (wasMoving || nowMoving) && !stillMoving;
|
|
432
|
+
if (allowEndAnimation && finishedMoving) {
|
|
433
|
+
this._updatingCamera = true;
|
|
434
|
+
const inertialEase = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);
|
|
435
|
+
const shouldSnapToNorth = bearing => bearing !== 0 && -this._bearingSnap < bearing && bearing < this._bearingSnap;
|
|
436
|
+
if (inertialEase && (inertialEase.essential || !_browser.browser.prefersReducedMotion)) {
|
|
437
|
+
if (shouldSnapToNorth(inertialEase.bearing || this._map.getBearing())) {
|
|
438
|
+
inertialEase.bearing = 0;
|
|
439
|
+
}
|
|
440
|
+
inertialEase.freezeElevation = true;
|
|
441
|
+
this._map.easeTo(inertialEase, {
|
|
442
|
+
originalEvent: originalEndEvent
|
|
443
|
+
});
|
|
444
|
+
} else {
|
|
445
|
+
this._map.fire(new _evented.Event('moveend', {
|
|
446
|
+
originalEvent: originalEndEvent
|
|
447
|
+
}));
|
|
448
|
+
if (shouldSnapToNorth(this._map.getBearing())) {
|
|
449
|
+
this._map.resetNorth();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
this._updatingCamera = false;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
_fireEvent(type, e) {
|
|
456
|
+
this._map.fire(new _evented.Event(type, e ? {
|
|
457
|
+
originalEvent: e
|
|
458
|
+
} : {}));
|
|
459
|
+
}
|
|
460
|
+
_requestFrame() {
|
|
461
|
+
this._map.triggerRepaint();
|
|
462
|
+
return this._map._renderTaskQueue.add(timeStamp => {
|
|
463
|
+
delete this._frameId;
|
|
464
|
+
this.handleEvent(new RenderFrameEvent('renderFrame', timeStamp));
|
|
465
|
+
this._applyChanges();
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
_triggerRenderFrame() {
|
|
469
|
+
if (this._frameId === undefined) {
|
|
470
|
+
this._frameId = this._requestFrame();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
exports.HandlerManager = HandlerManager;
|