@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,20 +0,0 @@
|
|
|
1
|
-
import Point from '../../geo/point';
|
|
2
|
-
export declare const MAX_TAP_INTERVAL = 500;
|
|
3
|
-
export declare const MAX_TOUCH_TIME = 500;
|
|
4
|
-
export declare const MAX_DIST = 30;
|
|
5
|
-
export default class SingleTapRecognizer {
|
|
6
|
-
numTouches: number;
|
|
7
|
-
centroid: Point;
|
|
8
|
-
startTime: number;
|
|
9
|
-
aborted: boolean;
|
|
10
|
-
touches: {
|
|
11
|
-
[key: string]: Point;
|
|
12
|
-
};
|
|
13
|
-
constructor(options: {
|
|
14
|
-
numTouches: number;
|
|
15
|
-
});
|
|
16
|
-
reset(): void;
|
|
17
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
18
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
19
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | undefined;
|
|
20
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import Point from "../../geo/point";
|
|
4
|
-
import { indexTouches } from "../handler_util";
|
|
5
|
-
function getCentroid(points) {
|
|
6
|
-
const sum = new Point(0, 0);
|
|
7
|
-
for (const point of points) {
|
|
8
|
-
sum._add(point);
|
|
9
|
-
}
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
return sum.div(points.length);
|
|
12
|
-
}
|
|
13
|
-
export const MAX_TAP_INTERVAL = 500;
|
|
14
|
-
export const MAX_TOUCH_TIME = 500;
|
|
15
|
-
export const MAX_DIST = 30;
|
|
16
|
-
export default class SingleTapRecognizer {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
_defineProperty(this, "numTouches", void 0);
|
|
19
|
-
_defineProperty(this, "centroid", void 0);
|
|
20
|
-
_defineProperty(this, "startTime", void 0);
|
|
21
|
-
_defineProperty(this, "aborted", void 0);
|
|
22
|
-
_defineProperty(this, "touches", void 0);
|
|
23
|
-
this.reset();
|
|
24
|
-
this.numTouches = options.numTouches;
|
|
25
|
-
}
|
|
26
|
-
reset() {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
delete this.centroid;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
delete this.startTime;
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
delete this.touches;
|
|
33
|
-
this.aborted = false;
|
|
34
|
-
}
|
|
35
|
-
touchstart(e, points, mapTouches) {
|
|
36
|
-
if (this.centroid || mapTouches.length > this.numTouches) {
|
|
37
|
-
this.aborted = true;
|
|
38
|
-
}
|
|
39
|
-
if (this.aborted) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (this.startTime === undefined) {
|
|
43
|
-
this.startTime = e.timeStamp;
|
|
44
|
-
}
|
|
45
|
-
if (mapTouches.length === this.numTouches) {
|
|
46
|
-
this.centroid = getCentroid(points);
|
|
47
|
-
this.touches = indexTouches(mapTouches, points);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
touchmove(e, points, mapTouches) {
|
|
51
|
-
if (this.aborted || !this.centroid) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const newTouches = indexTouches(mapTouches, points);
|
|
55
|
-
for (const id in this.touches) {
|
|
56
|
-
if (this.touches[id]) {
|
|
57
|
-
const prevPos = this.touches[id];
|
|
58
|
-
const pos = newTouches[id];
|
|
59
|
-
if (!pos || pos.dist(prevPos) > MAX_DIST) {
|
|
60
|
-
this.aborted = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
touchend(e, points, mapTouches) {
|
|
66
|
-
if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
|
|
67
|
-
this.aborted = true;
|
|
68
|
-
}
|
|
69
|
-
if (mapTouches.length === 0) {
|
|
70
|
-
const centroid = !this.aborted && this.centroid;
|
|
71
|
-
this.reset();
|
|
72
|
-
if (centroid) {
|
|
73
|
-
return centroid;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type Point from '../../geo/point';
|
|
2
|
-
import TapRecognizer from './tap_recognizer';
|
|
3
|
-
export default class TapDragZoomHandler {
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
active: boolean;
|
|
6
|
-
swipePoint: Point;
|
|
7
|
-
swipeTouch: number;
|
|
8
|
-
tapTime: number;
|
|
9
|
-
tap: TapRecognizer;
|
|
10
|
-
constructor();
|
|
11
|
-
reset(): void;
|
|
12
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
13
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
|
|
14
|
-
zoomDelta: number;
|
|
15
|
-
} | undefined;
|
|
16
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
17
|
-
touchcancel(): void;
|
|
18
|
-
enable(): void;
|
|
19
|
-
disable(): void;
|
|
20
|
-
isEnabled(): boolean;
|
|
21
|
-
isActive(): boolean;
|
|
22
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
|
|
4
|
-
import { MAX_TAP_INTERVAL } from "./single_tap_recognizer";
|
|
5
|
-
import TapRecognizer from "./tap_recognizer";
|
|
6
|
-
export default class TapDragZoomHandler {
|
|
7
|
-
constructor() {
|
|
8
|
-
_defineProperty(this, "enabled", void 0);
|
|
9
|
-
_defineProperty(this, "active", void 0);
|
|
10
|
-
_defineProperty(this, "swipePoint", void 0);
|
|
11
|
-
_defineProperty(this, "swipeTouch", void 0);
|
|
12
|
-
_defineProperty(this, "tapTime", void 0);
|
|
13
|
-
_defineProperty(this, "tap", void 0);
|
|
14
|
-
this.tap = new TapRecognizer({
|
|
15
|
-
numTouches: 1,
|
|
16
|
-
numTaps: 1
|
|
17
|
-
});
|
|
18
|
-
this.reset();
|
|
19
|
-
}
|
|
20
|
-
reset() {
|
|
21
|
-
this.active = false;
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
delete this.swipePoint;
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
delete this.swipeTouch;
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
delete this.tapTime;
|
|
28
|
-
this.tap.reset();
|
|
29
|
-
}
|
|
30
|
-
touchstart(e, points, mapTouches) {
|
|
31
|
-
if (this.swipePoint) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (this.tapTime && e.timeStamp - this.tapTime > MAX_TAP_INTERVAL) {
|
|
35
|
-
this.reset();
|
|
36
|
-
}
|
|
37
|
-
if (!this.tapTime) {
|
|
38
|
-
this.tap.touchstart(e, points, mapTouches);
|
|
39
|
-
} else if (mapTouches.length > 0) {
|
|
40
|
-
this.swipePoint = points[0];
|
|
41
|
-
this.swipeTouch = mapTouches[0].identifier;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
touchmove(e, points, mapTouches) {
|
|
45
|
-
if (!this.tapTime) {
|
|
46
|
-
this.tap.touchmove(e, points, mapTouches);
|
|
47
|
-
} else if (this.swipePoint) {
|
|
48
|
-
if (mapTouches[0].identifier !== this.swipeTouch) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const newSwipePoint = points[0];
|
|
52
|
-
const dist = newSwipePoint.y - this.swipePoint.y;
|
|
53
|
-
this.swipePoint = newSwipePoint;
|
|
54
|
-
e.preventDefault();
|
|
55
|
-
this.active = true;
|
|
56
|
-
return {
|
|
57
|
-
zoomDelta: dist / 128
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
touchend(e, points, mapTouches) {
|
|
62
|
-
if (!this.tapTime) {
|
|
63
|
-
const point = this.tap.touchend(e, points, mapTouches);
|
|
64
|
-
if (point) {
|
|
65
|
-
this.tapTime = e.timeStamp;
|
|
66
|
-
}
|
|
67
|
-
} else if (this.swipePoint) {
|
|
68
|
-
if (mapTouches.length === 0) {
|
|
69
|
-
this.reset();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
touchcancel() {
|
|
74
|
-
this.reset();
|
|
75
|
-
}
|
|
76
|
-
enable() {
|
|
77
|
-
this.enabled = true;
|
|
78
|
-
}
|
|
79
|
-
disable() {
|
|
80
|
-
this.enabled = false;
|
|
81
|
-
this.reset();
|
|
82
|
-
}
|
|
83
|
-
isEnabled() {
|
|
84
|
-
return this.enabled;
|
|
85
|
-
}
|
|
86
|
-
isActive() {
|
|
87
|
-
return this.active;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type Point from '../../geo/point';
|
|
2
|
-
import SingleTapRecognizer from './single_tap_recognizer';
|
|
3
|
-
export default class TapRecognizer {
|
|
4
|
-
singleTap: SingleTapRecognizer;
|
|
5
|
-
numTaps: number;
|
|
6
|
-
lastTime: number;
|
|
7
|
-
lastTap: Point;
|
|
8
|
-
count: number;
|
|
9
|
-
constructor(options: {
|
|
10
|
-
numTaps: number;
|
|
11
|
-
numTouches: number;
|
|
12
|
-
});
|
|
13
|
-
reset(): void;
|
|
14
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
15
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
16
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | undefined;
|
|
17
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
|
|
4
|
-
import SingleTapRecognizer, { MAX_DIST, MAX_TAP_INTERVAL } from "./single_tap_recognizer";
|
|
5
|
-
export default class TapRecognizer {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
_defineProperty(this, "singleTap", void 0);
|
|
8
|
-
_defineProperty(this, "numTaps", void 0);
|
|
9
|
-
_defineProperty(this, "lastTime", void 0);
|
|
10
|
-
_defineProperty(this, "lastTap", void 0);
|
|
11
|
-
_defineProperty(this, "count", void 0);
|
|
12
|
-
this.singleTap = new SingleTapRecognizer(options);
|
|
13
|
-
this.numTaps = options.numTaps;
|
|
14
|
-
this.reset();
|
|
15
|
-
}
|
|
16
|
-
reset() {
|
|
17
|
-
this.lastTime = Infinity;
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
delete this.lastTap;
|
|
20
|
-
this.count = 0;
|
|
21
|
-
this.singleTap.reset();
|
|
22
|
-
}
|
|
23
|
-
touchstart(e, points, mapTouches) {
|
|
24
|
-
this.singleTap.touchstart(e, points, mapTouches);
|
|
25
|
-
}
|
|
26
|
-
touchmove(e, points, mapTouches) {
|
|
27
|
-
this.singleTap.touchmove(e, points, mapTouches);
|
|
28
|
-
}
|
|
29
|
-
touchend(e, points, mapTouches) {
|
|
30
|
-
const tap = this.singleTap.touchend(e, points, mapTouches);
|
|
31
|
-
if (tap) {
|
|
32
|
-
const soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;
|
|
33
|
-
const closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;
|
|
34
|
-
if (!soonEnough || !closeEnough) {
|
|
35
|
-
this.reset();
|
|
36
|
-
}
|
|
37
|
-
this.count++;
|
|
38
|
-
this.lastTime = e.timeStamp;
|
|
39
|
-
this.lastTap = tap;
|
|
40
|
-
if (this.count === this.numTaps) {
|
|
41
|
-
this.reset();
|
|
42
|
-
return tap;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { EarthMap } from '../../earthmap';
|
|
2
|
-
import type Point from '../../geo/point';
|
|
3
|
-
import type { Map } from '../../map';
|
|
4
|
-
import TapRecognizer from './tap_recognizer';
|
|
5
|
-
export default class TapZoomHandler {
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
active: boolean;
|
|
8
|
-
zoomIn: TapRecognizer;
|
|
9
|
-
zoomOut: TapRecognizer;
|
|
10
|
-
constructor();
|
|
11
|
-
reset(): void;
|
|
12
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
13
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
14
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
|
|
15
|
-
cameraAnimation: (map: Map | EarthMap) => Map | EarthMap;
|
|
16
|
-
} | undefined;
|
|
17
|
-
touchcancel(): void;
|
|
18
|
-
enable(): void;
|
|
19
|
-
disable(): void;
|
|
20
|
-
isEnabled(): boolean;
|
|
21
|
-
isActive(): boolean;
|
|
22
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
|
|
4
|
-
import TapRecognizer from "./tap_recognizer";
|
|
5
|
-
export default class TapZoomHandler {
|
|
6
|
-
constructor() {
|
|
7
|
-
_defineProperty(this, "enabled", void 0);
|
|
8
|
-
_defineProperty(this, "active", void 0);
|
|
9
|
-
_defineProperty(this, "zoomIn", void 0);
|
|
10
|
-
_defineProperty(this, "zoomOut", void 0);
|
|
11
|
-
this.zoomIn = new TapRecognizer({
|
|
12
|
-
numTouches: 1,
|
|
13
|
-
numTaps: 2
|
|
14
|
-
});
|
|
15
|
-
this.zoomOut = new TapRecognizer({
|
|
16
|
-
numTouches: 2,
|
|
17
|
-
numTaps: 1
|
|
18
|
-
});
|
|
19
|
-
this.reset();
|
|
20
|
-
}
|
|
21
|
-
reset() {
|
|
22
|
-
this.active = false;
|
|
23
|
-
this.zoomIn.reset();
|
|
24
|
-
this.zoomOut.reset();
|
|
25
|
-
}
|
|
26
|
-
touchstart(e, points, mapTouches) {
|
|
27
|
-
this.zoomIn.touchstart(e, points, mapTouches);
|
|
28
|
-
this.zoomOut.touchstart(e, points, mapTouches);
|
|
29
|
-
}
|
|
30
|
-
touchmove(e, points, mapTouches) {
|
|
31
|
-
this.zoomIn.touchmove(e, points, mapTouches);
|
|
32
|
-
this.zoomOut.touchmove(e, points, mapTouches);
|
|
33
|
-
}
|
|
34
|
-
touchend(e, points, mapTouches) {
|
|
35
|
-
const zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
|
|
36
|
-
const zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
|
|
37
|
-
if (zoomInPoint) {
|
|
38
|
-
this.active = true;
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
setTimeout(() => this.reset(), 0);
|
|
41
|
-
return {
|
|
42
|
-
cameraAnimation: map => map.easeTo({
|
|
43
|
-
duration: 300,
|
|
44
|
-
zoom: map.getZoom() + 1,
|
|
45
|
-
around: map.unproject(zoomInPoint)
|
|
46
|
-
}, {
|
|
47
|
-
originalEvent: e
|
|
48
|
-
})
|
|
49
|
-
};
|
|
50
|
-
} else if (zoomOutPoint) {
|
|
51
|
-
this.active = true;
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
setTimeout(() => this.reset(), 0);
|
|
54
|
-
return {
|
|
55
|
-
cameraAnimation: map => map.easeTo({
|
|
56
|
-
duration: 300,
|
|
57
|
-
zoom: map.getZoom() - 1,
|
|
58
|
-
around: map.unproject(zoomOutPoint)
|
|
59
|
-
}, {
|
|
60
|
-
originalEvent: e
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
touchcancel() {
|
|
66
|
-
this.reset();
|
|
67
|
-
}
|
|
68
|
-
enable() {
|
|
69
|
-
this.enabled = true;
|
|
70
|
-
}
|
|
71
|
-
disable() {
|
|
72
|
-
this.enabled = false;
|
|
73
|
-
this.reset();
|
|
74
|
-
}
|
|
75
|
-
isEnabled() {
|
|
76
|
-
return this.enabled;
|
|
77
|
-
}
|
|
78
|
-
isActive() {
|
|
79
|
-
return this.active;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import TouchPanHandler from './touch_pan';
|
|
2
|
-
import TouchPitchHandler from './touch_pitch';
|
|
3
|
-
import TouchRotateHandler from './touch_rotate';
|
|
4
|
-
import TouchZoomHandler from './touch_zoom';
|
|
5
|
-
export { TouchPanHandler, TouchPitchHandler, TouchRotateHandler, TouchZoomHandler };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import TouchPanHandler from "./touch_pan";
|
|
2
|
-
import TouchPitchHandler from "./touch_pitch";
|
|
3
|
-
import TouchRotateHandler from "./touch_rotate";
|
|
4
|
-
import TouchZoomHandler from "./touch_zoom";
|
|
5
|
-
export { TouchPanHandler, TouchPitchHandler, TouchRotateHandler, TouchZoomHandler };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Point from '../../geo/point';
|
|
2
|
-
export default class TouchPanHandler {
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
active: boolean;
|
|
5
|
-
touches: {
|
|
6
|
-
[key: string]: Point;
|
|
7
|
-
};
|
|
8
|
-
minTouches: number;
|
|
9
|
-
clickTolerance: number;
|
|
10
|
-
sum: Point;
|
|
11
|
-
constructor(options: {
|
|
12
|
-
clickTolerance: number;
|
|
13
|
-
});
|
|
14
|
-
reset(): void;
|
|
15
|
-
touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
|
|
16
|
-
around: Point;
|
|
17
|
-
panDelta: Point;
|
|
18
|
-
} | undefined;
|
|
19
|
-
touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
|
|
20
|
-
around: Point;
|
|
21
|
-
panDelta: Point;
|
|
22
|
-
} | undefined;
|
|
23
|
-
touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
|
|
24
|
-
touchcancel(): void;
|
|
25
|
-
enable(): void;
|
|
26
|
-
disable(): void;
|
|
27
|
-
isEnabled(): boolean;
|
|
28
|
-
isActive(): boolean;
|
|
29
|
-
private calculateTransform;
|
|
30
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import Point from "../../geo/point";
|
|
4
|
-
import { indexTouches } from "../handler_util";
|
|
5
|
-
export default class TouchPanHandler {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
_defineProperty(this, "enabled", void 0);
|
|
8
|
-
_defineProperty(this, "active", void 0);
|
|
9
|
-
_defineProperty(this, "touches", void 0);
|
|
10
|
-
_defineProperty(this, "minTouches", void 0);
|
|
11
|
-
_defineProperty(this, "clickTolerance", void 0);
|
|
12
|
-
_defineProperty(this, "sum", void 0);
|
|
13
|
-
this.minTouches = 1;
|
|
14
|
-
this.clickTolerance = options.clickTolerance || 1;
|
|
15
|
-
this.reset();
|
|
16
|
-
}
|
|
17
|
-
reset() {
|
|
18
|
-
this.active = false;
|
|
19
|
-
this.touches = {};
|
|
20
|
-
this.sum = new Point(0, 0);
|
|
21
|
-
}
|
|
22
|
-
touchstart(e, points, mapTouches) {
|
|
23
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
24
|
-
}
|
|
25
|
-
touchmove(e, points, mapTouches) {
|
|
26
|
-
if (!this.active) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
31
|
-
}
|
|
32
|
-
touchend(e, points, mapTouches) {
|
|
33
|
-
this.calculateTransform(e, points, mapTouches);
|
|
34
|
-
if (this.active && mapTouches.length < this.minTouches) {
|
|
35
|
-
this.reset();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
touchcancel() {
|
|
39
|
-
this.reset();
|
|
40
|
-
}
|
|
41
|
-
enable() {
|
|
42
|
-
this.enabled = true;
|
|
43
|
-
}
|
|
44
|
-
disable() {
|
|
45
|
-
this.enabled = false;
|
|
46
|
-
this.reset();
|
|
47
|
-
}
|
|
48
|
-
isEnabled() {
|
|
49
|
-
return this.enabled;
|
|
50
|
-
}
|
|
51
|
-
isActive() {
|
|
52
|
-
return this.active;
|
|
53
|
-
}
|
|
54
|
-
calculateTransform(e, points, mapTouches) {
|
|
55
|
-
if (mapTouches.length > 0) {
|
|
56
|
-
this.active = true;
|
|
57
|
-
}
|
|
58
|
-
const touches = indexTouches(mapTouches, points);
|
|
59
|
-
const touchPointSum = new Point(0, 0);
|
|
60
|
-
const touchDeltaSum = new Point(0, 0);
|
|
61
|
-
let touchDeltaCount = 0;
|
|
62
|
-
for (const identifier in touches) {
|
|
63
|
-
if (touches[identifier]) {
|
|
64
|
-
const point = touches[identifier];
|
|
65
|
-
const prevPoint = this.touches[identifier];
|
|
66
|
-
if (prevPoint) {
|
|
67
|
-
touchPointSum._add(point);
|
|
68
|
-
touchDeltaSum._add(point.sub(prevPoint));
|
|
69
|
-
touchDeltaCount++;
|
|
70
|
-
touches[identifier] = point;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
this.touches = touches;
|
|
75
|
-
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
const panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
80
|
-
this.sum._add(panDelta);
|
|
81
|
-
if (this.sum.mag() < this.clickTolerance) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
const around = touchPointSum.div(touchDeltaCount);
|
|
86
|
-
return {
|
|
87
|
-
around,
|
|
88
|
-
panDelta
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type Point from '../../geo/point';
|
|
2
|
-
import TwoTouchHandler from './two_touch';
|
|
3
|
-
export default class TouchPitchHandler extends TwoTouchHandler {
|
|
4
|
-
valid: boolean | void;
|
|
5
|
-
firstMove: number;
|
|
6
|
-
lastPoints: [Point, Point];
|
|
7
|
-
reset(): void;
|
|
8
|
-
start(points: [Point, Point]): void;
|
|
9
|
-
move(points: [Point, Point], center: Point, e: TouchEvent): {
|
|
10
|
-
pitchDelta: number;
|
|
11
|
-
} | undefined;
|
|
12
|
-
gestureBeginsVertically(vectorA: Point, vectorB: Point, timeStamp: number): boolean | undefined;
|
|
13
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
|
|
4
|
-
import TwoTouchHandler from "./two_touch";
|
|
5
|
-
function isVertical(vector) {
|
|
6
|
-
return Math.abs(vector.y) > Math.abs(vector.x);
|
|
7
|
-
}
|
|
8
|
-
const ALLOWED_SINGLE_TOUCH_TIME = 100;
|
|
9
|
-
export default class TouchPitchHandler extends TwoTouchHandler {
|
|
10
|
-
constructor(...args) {
|
|
11
|
-
super(...args);
|
|
12
|
-
_defineProperty(this, "valid", void 0);
|
|
13
|
-
_defineProperty(this, "firstMove", void 0);
|
|
14
|
-
_defineProperty(this, "lastPoints", void 0);
|
|
15
|
-
}
|
|
16
|
-
reset() {
|
|
17
|
-
super.reset();
|
|
18
|
-
this.valid = undefined;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
delete this.firstMove;
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
delete this.lastPoints;
|
|
23
|
-
}
|
|
24
|
-
start(points) {
|
|
25
|
-
this.lastPoints = points;
|
|
26
|
-
if (isVertical(points[0].sub(points[1]))) {
|
|
27
|
-
// fingers are more horizontal than vertical
|
|
28
|
-
this.valid = false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
move(points, center, e) {
|
|
32
|
-
const vectorA = points[0].sub(this.lastPoints[0]);
|
|
33
|
-
const vectorB = points[1].sub(this.lastPoints[1]);
|
|
34
|
-
this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
|
|
35
|
-
if (!this.valid) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
this.lastPoints = points;
|
|
39
|
-
this.active = true;
|
|
40
|
-
const yDeltaAverage = (vectorA.y + vectorB.y) / 2;
|
|
41
|
-
const degreesPerPixelMoved = -0.5;
|
|
42
|
-
return {
|
|
43
|
-
pitchDelta: yDeltaAverage * degreesPerPixelMoved
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
gestureBeginsVertically(vectorA, vectorB, timeStamp) {
|
|
47
|
-
if (this.valid !== undefined) {
|
|
48
|
-
return this.valid;
|
|
49
|
-
}
|
|
50
|
-
const threshold = 2;
|
|
51
|
-
const movedA = vectorA.mag() >= threshold;
|
|
52
|
-
const movedB = vectorB.mag() >= threshold;
|
|
53
|
-
|
|
54
|
-
// neither finger has moved a meaningful amount, wait
|
|
55
|
-
if (!movedA && !movedB) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// One finger has moved and the other has not.
|
|
60
|
-
// If enough time has passed, decide it is not a pitch.
|
|
61
|
-
if (!movedA || !movedB) {
|
|
62
|
-
if (this.firstMove === undefined) {
|
|
63
|
-
this.firstMove = timeStamp;
|
|
64
|
-
}
|
|
65
|
-
if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
|
|
66
|
-
// still waiting for a movement from the second finger
|
|
67
|
-
return undefined;
|
|
68
|
-
} else {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const isSameDirection = vectorA.y > 0 === vectorB.y > 0;
|
|
73
|
-
return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type Point from '../../geo/point';
|
|
2
|
-
import TwoTouchHandler from './two_touch';
|
|
3
|
-
export default class TouchRotateHandler extends TwoTouchHandler {
|
|
4
|
-
private minDiameter;
|
|
5
|
-
reset(): void;
|
|
6
|
-
start(points: [Point, Point]): void;
|
|
7
|
-
move(points: [Point, Point], pinchAround: Point): {
|
|
8
|
-
bearingDelta: number;
|
|
9
|
-
pinchAround: Point;
|
|
10
|
-
} | undefined;
|
|
11
|
-
private isBelowThreshold;
|
|
12
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
|
|
4
|
-
import TwoTouchHandler from "./two_touch";
|
|
5
|
-
const ROTATION_THRESHOLD = 25; // pixels along circumference of touch circle
|
|
6
|
-
|
|
7
|
-
function getBearingDelta(a, b) {
|
|
8
|
-
return a.angleWith(b) * 180 / Math.PI;
|
|
9
|
-
}
|
|
10
|
-
export default class TouchRotateHandler extends TwoTouchHandler {
|
|
11
|
-
constructor(...args) {
|
|
12
|
-
super(...args);
|
|
13
|
-
_defineProperty(this, "minDiameter", void 0);
|
|
14
|
-
}
|
|
15
|
-
reset() {
|
|
16
|
-
super.reset();
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
delete this.minDiameter;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
delete this.startVector;
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
delete this.vector;
|
|
23
|
-
}
|
|
24
|
-
start(points) {
|
|
25
|
-
this.startVector = this.vector = points[0].sub(points[1]);
|
|
26
|
-
this.minDiameter = points[0].dist(points[1]);
|
|
27
|
-
}
|
|
28
|
-
move(points, pinchAround) {
|
|
29
|
-
const lastVector = this.vector;
|
|
30
|
-
this.vector = points[0].sub(points[1]);
|
|
31
|
-
if (!this.active && this.isBelowThreshold(this.vector)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
this.active = true;
|
|
35
|
-
return {
|
|
36
|
-
bearingDelta: getBearingDelta(this.vector, lastVector),
|
|
37
|
-
pinchAround
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
isBelowThreshold(vector) {
|
|
41
|
-
/*
|
|
42
|
-
* The threshold before a rotation actually happens is configured in
|
|
43
|
-
* pixels alongth circumference of the circle formed by the two fingers.
|
|
44
|
-
* This makes the threshold in degrees larger when the fingers are close
|
|
45
|
-
* together and smaller when the fingers are far apart.
|
|
46
|
-
*
|
|
47
|
-
* Use the smallest diameter from the whole gesture to reduce sensitivity
|
|
48
|
-
* when pinching in and out.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
this.minDiameter = Math.min(this.minDiameter, vector.mag());
|
|
52
|
-
const circumference = Math.PI * this.minDiameter;
|
|
53
|
-
const threshold = ROTATION_THRESHOLD / circumference * 360;
|
|
54
|
-
const bearingDeltaSinceStart = getBearingDelta(vector, this.startVector);
|
|
55
|
-
return Math.abs(bearingDeltaSinceStart) < threshold;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type Point from '../../geo/point';
|
|
2
|
-
import TwoTouchHandler from './two_touch';
|
|
3
|
-
export default class TouchZoomHandler extends TwoTouchHandler {
|
|
4
|
-
private distance;
|
|
5
|
-
private startDistance;
|
|
6
|
-
reset(): void;
|
|
7
|
-
start(points: [Point, Point]): void;
|
|
8
|
-
move(points: [Point, Point], pinchAround: Point): {
|
|
9
|
-
zoomDelta: number;
|
|
10
|
-
pinchAround: Point;
|
|
11
|
-
} | undefined;
|
|
12
|
-
}
|