@antv/l7-map 2.21.1 → 2.21.3
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/es/camera.js +595 -674
- package/es/earthmap.js +313 -276
- package/es/geo/edge_insets.js +57 -72
- package/es/geo/lng_lat.js +50 -64
- package/es/geo/lng_lat_bounds.js +101 -137
- package/es/geo/mercator.js +23 -35
- package/es/geo/point.js +150 -221
- package/es/geo/simple.js +22 -34
- package/es/geo/transform.js +839 -905
- package/es/handler/blockable_map_event.js +46 -66
- package/es/handler/box_zoom.js +125 -143
- package/es/handler/click_zoom.js +37 -51
- package/es/handler/events/event.js +11 -9
- package/es/handler/events/map_mouse_event.js +39 -54
- package/es/handler/events/map_touch_event.js +54 -73
- package/es/handler/events/map_wheel_event.js +22 -38
- package/es/handler/events/render_event.js +6 -23
- package/es/handler/handler_inertia.js +98 -113
- package/es/handler/handler_manager.js +349 -437
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +98 -110
- package/es/handler/map_event.js +81 -117
- package/es/handler/mouse/mouse_handler.js +81 -100
- package/es/handler/mouse/mousepan_handler.js +16 -39
- package/es/handler/mouse/mousepitch_hander.js +18 -40
- package/es/handler/mouse/mouserotate_hander.js +18 -40
- package/es/handler/mouse/util.js +7 -5
- package/es/handler/scroll_zoom.js +221 -231
- package/es/handler/shim/dblclick_zoom.js +36 -47
- package/es/handler/shim/drag_pan.js +41 -50
- package/es/handler/shim/drag_rotate.js +38 -48
- package/es/handler/shim/touch_zoom_rotate.js +68 -79
- package/es/handler/tap/single_tap_recognizer.js +60 -80
- package/es/handler/tap/tap_drag_zoom.js +72 -89
- package/es/handler/tap/tap_recognizer.js +37 -45
- package/es/handler/tap/tap_zoom.js +67 -95
- package/es/handler/touch/touch_pan.js +77 -96
- package/es/handler/touch/touch_pitch.js +61 -79
- package/es/handler/touch/touch_rotate.js +47 -67
- package/es/handler/touch/touch_zoom.js +29 -46
- package/es/handler/touch/two_touch.js +79 -104
- package/es/hash.js +75 -88
- package/es/map.js +318 -284
- package/es/util.js +18 -37
- package/es/utils/Aabb.js +60 -100
- package/es/utils/dom.js +32 -55
- package/es/utils/performance.js +25 -29
- package/es/utils/primitives.js +33 -42
- package/es/utils/task_queue.js +47 -76
- package/lib/camera.d.ts +86 -0
- package/lib/camera.js +597 -672
- package/lib/earthmap.d.ts +69 -0
- package/lib/earthmap.js +314 -276
- package/lib/geo/edge_insets.d.ts +54 -0
- package/lib/geo/edge_insets.js +58 -70
- package/lib/geo/lng_lat.d.ts +18 -0
- package/lib/geo/lng_lat.js +50 -62
- package/lib/geo/lng_lat_bounds.d.ts +25 -0
- package/lib/geo/lng_lat_bounds.js +102 -136
- package/lib/geo/mercator.d.ts +30 -0
- package/lib/geo/mercator.js +26 -37
- package/lib/geo/point.d.ts +40 -0
- package/lib/geo/point.js +151 -220
- package/lib/geo/simple.d.ts +30 -0
- package/lib/geo/simple.js +25 -36
- package/lib/geo/transform.d.ts +198 -0
- package/lib/geo/transform.js +844 -907
- package/lib/handler/IHandler.d.ts +34 -0
- package/lib/handler/blockable_map_event.d.ts +17 -0
- package/lib/handler/blockable_map_event.js +48 -65
- package/lib/handler/box_zoom.d.ts +59 -0
- package/lib/handler/box_zoom.js +126 -143
- package/lib/handler/click_zoom.d.ts +16 -0
- package/lib/handler/click_zoom.js +38 -50
- package/lib/handler/events/event.d.ts +4 -0
- package/lib/handler/events/event.js +12 -9
- package/lib/handler/events/index.d.ts +4 -0
- package/lib/handler/events/index.js +3 -3
- package/lib/handler/events/map_mouse_event.d.ts +34 -0
- package/lib/handler/events/map_mouse_event.js +41 -52
- package/lib/handler/events/map_touch_event.d.ts +57 -0
- package/lib/handler/events/map_touch_event.js +56 -71
- package/lib/handler/events/map_wheel_event.d.ts +33 -0
- package/lib/handler/events/map_wheel_event.js +23 -37
- package/lib/handler/events/render_event.d.ts +5 -0
- package/lib/handler/events/render_event.js +7 -22
- package/lib/handler/handler_inertia.d.ts +23 -0
- package/lib/handler/handler_inertia.js +102 -112
- package/lib/handler/handler_manager.d.ts +61 -0
- package/lib/handler/handler_manager.js +351 -437
- package/lib/handler/handler_util.d.ts +4 -0
- package/lib/handler/handler_util.js +2 -2
- package/lib/handler/keyboard.d.ts +36 -0
- package/lib/handler/keyboard.js +98 -110
- package/lib/handler/map_event.d.ts +29 -0
- package/lib/handler/map_event.js +83 -116
- package/lib/handler/mouse/index.d.ts +4 -0
- package/lib/handler/mouse/index.js +3 -3
- package/lib/handler/mouse/mouse_handler.d.ts +22 -0
- package/lib/handler/mouse/mouse_handler.js +83 -99
- package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
- package/lib/handler/mouse/mousepan_handler.js +19 -38
- package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
- package/lib/handler/mouse/mousepitch_hander.js +21 -39
- package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
- package/lib/handler/mouse/mouserotate_hander.js +21 -39
- package/lib/handler/mouse/util.d.ts +6 -0
- package/lib/handler/mouse/util.js +7 -6
- package/lib/handler/scroll_zoom.d.ts +93 -0
- package/lib/handler/scroll_zoom.js +221 -231
- package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
- package/lib/handler/shim/dblclick_zoom.js +37 -46
- package/lib/handler/shim/drag_pan.d.ts +61 -0
- package/lib/handler/shim/drag_pan.js +42 -49
- package/lib/handler/shim/drag_rotate.d.ts +46 -0
- package/lib/handler/shim/drag_rotate.js +39 -47
- package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
- package/lib/handler/shim/touch_zoom_rotate.js +69 -78
- package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
- package/lib/handler/tap/single_tap_recognizer.js +63 -79
- package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_drag_zoom.js +74 -88
- package/lib/handler/tap/tap_recognizer.d.ts +17 -0
- package/lib/handler/tap/tap_recognizer.js +41 -47
- package/lib/handler/tap/tap_zoom.d.ts +22 -0
- package/lib/handler/tap/tap_zoom.js +69 -94
- package/lib/handler/touch/index.d.ts +5 -0
- package/lib/handler/touch/index.js +4 -4
- package/lib/handler/touch/touch_pan.d.ts +30 -0
- package/lib/handler/touch/touch_pan.js +79 -95
- package/lib/handler/touch/touch_pitch.d.ts +13 -0
- package/lib/handler/touch/touch_pitch.js +64 -78
- package/lib/handler/touch/touch_rotate.d.ts +12 -0
- package/lib/handler/touch/touch_rotate.js +50 -66
- package/lib/handler/touch/touch_zoom.d.ts +12 -0
- package/lib/handler/touch/touch_zoom.js +32 -45
- package/lib/handler/touch/two_touch.d.ts +23 -0
- package/lib/handler/touch/two_touch.js +81 -103
- package/lib/hash.d.ts +14 -0
- package/lib/hash.js +75 -88
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -4
- package/lib/interface.d.ts +34 -0
- package/lib/map.d.ts +70 -0
- package/lib/map.js +319 -284
- package/lib/util.d.ts +25 -0
- package/lib/util.js +20 -36
- package/lib/utils/Aabb.d.ts +12 -0
- package/lib/utils/Aabb.js +61 -99
- package/lib/utils/dom.d.ts +4 -0
- package/lib/utils/dom.js +34 -55
- package/lib/utils/performance.d.ts +17 -0
- package/lib/utils/performance.js +25 -29
- package/lib/utils/primitives.d.ts +6 -0
- package/lib/utils/primitives.js +34 -41
- package/lib/utils/task_queue.d.ts +13 -0
- package/lib/utils/task_queue.js +47 -76
- package/package.json +25 -32
|
@@ -1,62 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
9
|
var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
12
|
// @ts-ignore
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
|
|
14
|
+
class TapRecognizer {
|
|
15
|
+
constructor(options) {
|
|
16
|
+
(0, _defineProperty2.default)(this, "singleTap", void 0);
|
|
17
|
+
(0, _defineProperty2.default)(this, "numTaps", void 0);
|
|
18
|
+
(0, _defineProperty2.default)(this, "lastTime", void 0);
|
|
19
|
+
(0, _defineProperty2.default)(this, "lastTap", void 0);
|
|
20
|
+
(0, _defineProperty2.default)(this, "count", void 0);
|
|
18
21
|
this.singleTap = new _single_tap_recognizer.default(options);
|
|
19
22
|
this.numTaps = options.numTaps;
|
|
20
23
|
this.reset();
|
|
21
24
|
}
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.reset();
|
|
50
|
-
}
|
|
51
|
-
this.count++;
|
|
52
|
-
this.lastTime = e.timeStamp;
|
|
53
|
-
this.lastTap = tap;
|
|
54
|
-
if (this.count === this.numTaps) {
|
|
55
|
-
this.reset();
|
|
56
|
-
return tap;
|
|
57
|
-
}
|
|
25
|
+
reset() {
|
|
26
|
+
this.lastTime = Infinity;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
delete this.lastTap;
|
|
29
|
+
this.count = 0;
|
|
30
|
+
this.singleTap.reset();
|
|
31
|
+
}
|
|
32
|
+
touchstart(e, points, mapTouches) {
|
|
33
|
+
this.singleTap.touchstart(e, points, mapTouches);
|
|
34
|
+
}
|
|
35
|
+
touchmove(e, points, mapTouches) {
|
|
36
|
+
this.singleTap.touchmove(e, points, mapTouches);
|
|
37
|
+
}
|
|
38
|
+
touchend(e, points, mapTouches) {
|
|
39
|
+
const tap = this.singleTap.touchend(e, points, mapTouches);
|
|
40
|
+
if (tap) {
|
|
41
|
+
const soonEnough = e.timeStamp - this.lastTime < _single_tap_recognizer.MAX_TAP_INTERVAL;
|
|
42
|
+
const closeEnough = !this.lastTap || this.lastTap.dist(tap) < _single_tap_recognizer.MAX_DIST;
|
|
43
|
+
if (!soonEnough || !closeEnough) {
|
|
44
|
+
this.reset();
|
|
45
|
+
}
|
|
46
|
+
this.count++;
|
|
47
|
+
this.lastTime = e.timeStamp;
|
|
48
|
+
this.lastTap = tap;
|
|
49
|
+
if (this.count === this.numTaps) {
|
|
50
|
+
this.reset();
|
|
51
|
+
return tap;
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = TapRecognizer;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -5,13 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
|
|
11
10
|
// @ts-ignore
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
|
|
12
|
+
class TapZoomHandler {
|
|
13
|
+
constructor() {
|
|
14
|
+
(0, _defineProperty2.default)(this, "enabled", void 0);
|
|
15
|
+
(0, _defineProperty2.default)(this, "active", void 0);
|
|
16
|
+
(0, _defineProperty2.default)(this, "zoomIn", void 0);
|
|
17
|
+
(0, _defineProperty2.default)(this, "zoomOut", void 0);
|
|
15
18
|
this.zoomIn = new _tap_recognizer.default({
|
|
16
19
|
numTouches: 1,
|
|
17
20
|
numTaps: 2
|
|
@@ -22,93 +25,65 @@ var TapZoomHandler = exports.default = /*#__PURE__*/function () {
|
|
|
22
25
|
});
|
|
23
26
|
this.reset();
|
|
24
27
|
}
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} else if (zoomOutPoint) {
|
|
68
|
-
this.active = true;
|
|
69
|
-
e.preventDefault();
|
|
70
|
-
setTimeout(function () {
|
|
71
|
-
return _this.reset();
|
|
72
|
-
}, 0);
|
|
73
|
-
return {
|
|
74
|
-
cameraAnimation: function cameraAnimation(map) {
|
|
75
|
-
return map.easeTo({
|
|
76
|
-
duration: 300,
|
|
77
|
-
zoom: map.getZoom() - 1,
|
|
78
|
-
around: map.unproject(zoomOutPoint)
|
|
79
|
-
}, {
|
|
80
|
-
originalEvent: e
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "touchcancel",
|
|
88
|
-
value: function touchcancel() {
|
|
89
|
-
this.reset();
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "enable",
|
|
93
|
-
value: function enable() {
|
|
94
|
-
this.enabled = true;
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "disable",
|
|
98
|
-
value: function disable() {
|
|
99
|
-
this.enabled = false;
|
|
100
|
-
this.reset();
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
key: "isEnabled",
|
|
104
|
-
value: function isEnabled() {
|
|
105
|
-
return this.enabled;
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
key: "isActive",
|
|
109
|
-
value: function isActive() {
|
|
110
|
-
return this.active;
|
|
28
|
+
reset() {
|
|
29
|
+
this.active = false;
|
|
30
|
+
this.zoomIn.reset();
|
|
31
|
+
this.zoomOut.reset();
|
|
32
|
+
}
|
|
33
|
+
touchstart(e, points, mapTouches) {
|
|
34
|
+
this.zoomIn.touchstart(e, points, mapTouches);
|
|
35
|
+
this.zoomOut.touchstart(e, points, mapTouches);
|
|
36
|
+
}
|
|
37
|
+
touchmove(e, points, mapTouches) {
|
|
38
|
+
this.zoomIn.touchmove(e, points, mapTouches);
|
|
39
|
+
this.zoomOut.touchmove(e, points, mapTouches);
|
|
40
|
+
}
|
|
41
|
+
touchend(e, points, mapTouches) {
|
|
42
|
+
const zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
|
|
43
|
+
const zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
|
|
44
|
+
if (zoomInPoint) {
|
|
45
|
+
this.active = true;
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
setTimeout(() => this.reset(), 0);
|
|
48
|
+
return {
|
|
49
|
+
cameraAnimation: map => map.easeTo({
|
|
50
|
+
duration: 300,
|
|
51
|
+
zoom: map.getZoom() + 1,
|
|
52
|
+
around: map.unproject(zoomInPoint)
|
|
53
|
+
}, {
|
|
54
|
+
originalEvent: e
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
} else if (zoomOutPoint) {
|
|
58
|
+
this.active = true;
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
setTimeout(() => this.reset(), 0);
|
|
61
|
+
return {
|
|
62
|
+
cameraAnimation: map => map.easeTo({
|
|
63
|
+
duration: 300,
|
|
64
|
+
zoom: map.getZoom() - 1,
|
|
65
|
+
around: map.unproject(zoomOutPoint)
|
|
66
|
+
}, {
|
|
67
|
+
originalEvent: e
|
|
68
|
+
})
|
|
69
|
+
};
|
|
111
70
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
71
|
+
}
|
|
72
|
+
touchcancel() {
|
|
73
|
+
this.reset();
|
|
74
|
+
}
|
|
75
|
+
enable() {
|
|
76
|
+
this.enabled = true;
|
|
77
|
+
}
|
|
78
|
+
disable() {
|
|
79
|
+
this.enabled = false;
|
|
80
|
+
this.reset();
|
|
81
|
+
}
|
|
82
|
+
isEnabled() {
|
|
83
|
+
return this.enabled;
|
|
84
|
+
}
|
|
85
|
+
isActive() {
|
|
86
|
+
return this.active;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.default = TapZoomHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
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, };
|
|
@@ -6,25 +6,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "TouchPanHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _touch_pan.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "TouchPitchHandler", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _touch_pitch.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "TouchRotateHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function
|
|
21
|
+
get: function () {
|
|
22
22
|
return _touch_rotate.default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "TouchZoomHandler", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function
|
|
27
|
+
get: function () {
|
|
28
28
|
return _touch_zoom.default;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -5,112 +5,96 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
11
10
|
var _handler_util = require("../handler_util");
|
|
12
11
|
// @ts-ignore
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
class TouchPanHandler {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
(0, _defineProperty2.default)(this, "enabled", void 0);
|
|
16
|
+
(0, _defineProperty2.default)(this, "active", void 0);
|
|
17
|
+
(0, _defineProperty2.default)(this, "touches", void 0);
|
|
18
|
+
(0, _defineProperty2.default)(this, "minTouches", void 0);
|
|
19
|
+
(0, _defineProperty2.default)(this, "clickTolerance", void 0);
|
|
20
|
+
(0, _defineProperty2.default)(this, "sum", void 0);
|
|
16
21
|
this.minTouches = 1;
|
|
17
22
|
this.clickTolerance = options.clickTolerance || 1;
|
|
18
23
|
this.reset();
|
|
19
24
|
}
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "touchmove",
|
|
34
|
-
value: function touchmove(e, points, mapTouches) {
|
|
35
|
-
if (!this.active) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "touchend",
|
|
43
|
-
value: function touchend(e, points, mapTouches) {
|
|
44
|
-
this.calculateTransform(e, points, mapTouches);
|
|
45
|
-
if (this.active && mapTouches.length < this.minTouches) {
|
|
46
|
-
this.reset();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "touchcancel",
|
|
51
|
-
value: function touchcancel() {
|
|
52
|
-
this.reset();
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "enable",
|
|
56
|
-
value: function enable() {
|
|
57
|
-
this.enabled = true;
|
|
25
|
+
reset() {
|
|
26
|
+
this.active = false;
|
|
27
|
+
this.touches = {};
|
|
28
|
+
this.sum = new _point.default(0, 0);
|
|
29
|
+
}
|
|
30
|
+
touchstart(e, points, mapTouches) {
|
|
31
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
32
|
+
}
|
|
33
|
+
touchmove(e, points, mapTouches) {
|
|
34
|
+
if (!this.active) {
|
|
35
|
+
return;
|
|
58
36
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
39
|
+
}
|
|
40
|
+
touchend(e, points, mapTouches) {
|
|
41
|
+
this.calculateTransform(e, points, mapTouches);
|
|
42
|
+
if (this.active && mapTouches.length < this.minTouches) {
|
|
63
43
|
this.reset();
|
|
64
44
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
45
|
+
}
|
|
46
|
+
touchcancel() {
|
|
47
|
+
this.reset();
|
|
48
|
+
}
|
|
49
|
+
enable() {
|
|
50
|
+
this.enabled = true;
|
|
51
|
+
}
|
|
52
|
+
disable() {
|
|
53
|
+
this.enabled = false;
|
|
54
|
+
this.reset();
|
|
55
|
+
}
|
|
56
|
+
isEnabled() {
|
|
57
|
+
return this.enabled;
|
|
58
|
+
}
|
|
59
|
+
isActive() {
|
|
60
|
+
return this.active;
|
|
61
|
+
}
|
|
62
|
+
calculateTransform(e, points, mapTouches) {
|
|
63
|
+
if (mapTouches.length > 0) {
|
|
64
|
+
this.active = true;
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var prevPoint = this.touches[identifier];
|
|
89
|
-
if (prevPoint) {
|
|
90
|
-
touchPointSum._add(point);
|
|
91
|
-
touchDeltaSum._add(point.sub(prevPoint));
|
|
92
|
-
touchDeltaCount++;
|
|
93
|
-
touches[identifier] = point;
|
|
94
|
-
}
|
|
66
|
+
const touches = (0, _handler_util.indexTouches)(mapTouches, points);
|
|
67
|
+
const touchPointSum = new _point.default(0, 0);
|
|
68
|
+
const touchDeltaSum = new _point.default(0, 0);
|
|
69
|
+
let touchDeltaCount = 0;
|
|
70
|
+
for (const identifier in touches) {
|
|
71
|
+
if (touches[identifier]) {
|
|
72
|
+
const point = touches[identifier];
|
|
73
|
+
const prevPoint = this.touches[identifier];
|
|
74
|
+
if (prevPoint) {
|
|
75
|
+
touchPointSum._add(point);
|
|
76
|
+
touchDeltaSum._add(point.sub(prevPoint));
|
|
77
|
+
touchDeltaCount++;
|
|
78
|
+
touches[identifier] = point;
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
|
-
this.touches = touches;
|
|
98
|
-
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
var panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
103
|
-
this.sum._add(panDelta);
|
|
104
|
-
if (this.sum.mag() < this.clickTolerance) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
var around = touchPointSum.div(touchDeltaCount);
|
|
109
|
-
return {
|
|
110
|
-
around: around,
|
|
111
|
-
panDelta: panDelta
|
|
112
|
-
};
|
|
113
81
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
82
|
+
this.touches = touches;
|
|
83
|
+
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
const panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
88
|
+
this.sum._add(panDelta);
|
|
89
|
+
if (this.sum.mag() < this.clickTolerance) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
const around = touchPointSum.div(touchDeltaCount);
|
|
94
|
+
return {
|
|
95
|
+
around,
|
|
96
|
+
panDelta
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.default = TouchPanHandler;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|