@antv/l7-map 2.9.21 → 2.9.22-alpha.0
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 +115 -85
- package/es/css/l7.css +98 -0
- package/es/earthmap.js +27 -43
- package/es/geo/edge_insets.js +44 -14
- package/es/geo/lng_lat.js +15 -11
- package/es/geo/lng_lat_bounds.js +6 -10
- package/es/geo/mercator.js +24 -12
- package/es/geo/point.js +2 -8
- package/es/geo/simple.js +24 -12
- package/es/geo/transform.js +421 -120
- package/es/handler/IHandler.js +1 -2
- package/es/handler/blockable_map_event.js +13 -14
- package/es/handler/box_zoom.js +43 -27
- package/es/handler/click_zoom.js +3 -8
- package/es/handler/events/event.js +3 -6
- package/es/handler/events/index.js +4 -5
- package/es/handler/events/map_mouse_event.js +30 -20
- package/es/handler/events/map_touch_event.js +55 -25
- package/es/handler/events/map_wheel_event.js +24 -15
- package/es/handler/events/render_event.js +3 -6
- package/es/handler/handler_inertia.js +10 -12
- package/es/handler/handler_manager.js +75 -72
- package/es/handler/handler_util.js +2 -2
- package/es/handler/keyboard.js +20 -15
- package/es/handler/map_event.js +23 -12
- package/es/handler/mouse/index.js +4 -5
- package/es/handler/mouse/mouse_handler.js +17 -21
- package/es/handler/mouse/mousepan_handler.js +5 -5
- package/es/handler/mouse/mousepitch_hander.js +7 -5
- package/es/handler/mouse/mouserotate_hander.js +7 -5
- package/es/handler/mouse/util.js +3 -3
- package/es/handler/scroll_zoom.js +103 -67
- package/es/handler/shim/dblclick_zoom.js +35 -8
- package/es/handler/shim/drag_pan.js +48 -12
- package/es/handler/shim/drag_rotate.js +39 -10
- package/es/handler/shim/touch_zoom_rotate.js +59 -16
- package/es/handler/tap/single_tap_recognizer.js +7 -17
- package/es/handler/tap/tap_drag_zoom.js +5 -18
- package/es/handler/tap/tap_recognizer.js +4 -15
- package/es/handler/tap/tap_zoom.js +4 -13
- package/es/handler/touch/index.js +5 -6
- package/es/handler/touch/touch_pan.js +9 -20
- package/es/handler/touch/touch_pitch.js +11 -23
- package/es/handler/touch/touch_rotate.js +15 -18
- package/es/handler/touch/touch_zoom.js +5 -19
- package/es/handler/touch/two_touch.js +14 -21
- package/es/hash.js +28 -16
- package/es/index.js +2 -3
- package/es/interface.js +1 -2
- package/es/map.js +26 -47
- package/es/util.js +15 -6
- package/es/utils/Aabb.js +11 -12
- package/es/utils/dom.js +30 -11
- package/es/utils/performance.js +10 -6
- package/es/utils/primitives.js +11 -10
- package/es/utils/task_queue.js +6 -13
- package/lib/camera.js +508 -721
- package/lib/css/l7.css +98 -0
- package/lib/earthmap.js +222 -392
- package/lib/geo/edge_insets.js +64 -83
- package/lib/geo/lng_lat.js +65 -81
- package/lib/geo/lng_lat_bounds.js +124 -165
- package/lib/geo/mercator.js +62 -78
- package/lib/geo/point.js +171 -239
- package/lib/geo/simple.js +61 -80
- package/lib/geo/transform.js +470 -653
- package/lib/handler/IHandler.js +17 -2
- package/lib/handler/blockable_map_event.js +63 -83
- package/lib/handler/box_zoom.js +123 -176
- package/lib/handler/click_zoom.js +56 -68
- package/lib/handler/events/event.js +35 -23
- package/lib/handler/events/index.js +35 -29
- package/lib/handler/events/map_mouse_event.js +42 -72
- package/lib/handler/events/map_touch_event.js +45 -80
- package/lib/handler/events/map_wheel_event.js +34 -58
- package/lib/handler/events/render_event.js +31 -52
- package/lib/handler/handler_inertia.js +113 -160
- package/lib/handler/handler_manager.js +379 -620
- package/lib/handler/handler_util.js +28 -10
- package/lib/handler/keyboard.js +114 -146
- package/lib/handler/map_event.js +84 -120
- package/lib/handler/mouse/index.js +35 -29
- package/lib/handler/mouse/mouse_handler.js +90 -123
- package/lib/handler/mouse/mousepan_handler.js +46 -65
- package/lib/handler/mouse/mousepitch_hander.js +44 -63
- package/lib/handler/mouse/mouserotate_hander.js +44 -63
- package/lib/handler/mouse/util.js +38 -20
- package/lib/handler/scroll_zoom.js +175 -258
- package/lib/handler/shim/dblclick_zoom.js +42 -48
- package/lib/handler/shim/drag_pan.js +48 -59
- package/lib/handler/shim/drag_rotate.js +43 -51
- package/lib/handler/shim/touch_zoom_rotate.js +58 -78
- package/lib/handler/tap/single_tap_recognizer.js +84 -117
- package/lib/handler/tap/tap_drag_zoom.js +92 -115
- package/lib/handler/tap/tap_recognizer.js +60 -78
- package/lib/handler/tap/tap_zoom.js +88 -119
- package/lib/handler/touch/index.js +38 -37
- package/lib/handler/touch/touch_pan.js +98 -132
- package/lib/handler/touch/touch_pitch.js +73 -117
- package/lib/handler/touch/touch_rotate.js +58 -94
- package/lib/handler/touch/touch_zoom.js +49 -84
- package/lib/handler/touch/two_touch.js +88 -128
- package/lib/hash.js +100 -133
- package/lib/index.js +19 -31
- package/lib/interface.js +17 -2
- package/lib/map.js +238 -420
- package/lib/util.js +67 -78
- package/lib/utils/Aabb.js +80 -132
- package/lib/utils/dom.js +84 -141
- package/lib/utils/performance.js +54 -42
- package/lib/utils/primitives.js +59 -51
- package/lib/utils/task_queue.js +61 -108
- package/package.json +11 -8
- package/es/camera.js.map +0 -1
- package/es/earthmap.js.map +0 -1
- package/es/geo/edge_insets.js.map +0 -1
- package/es/geo/lng_lat.js.map +0 -1
- package/es/geo/lng_lat_bounds.js.map +0 -1
- package/es/geo/mercator.js.map +0 -1
- package/es/geo/point.js.map +0 -1
- package/es/geo/simple.js.map +0 -1
- package/es/geo/transform.js.map +0 -1
- package/es/handler/IHandler.js.map +0 -1
- package/es/handler/blockable_map_event.js.map +0 -1
- package/es/handler/box_zoom.js.map +0 -1
- package/es/handler/click_zoom.js.map +0 -1
- package/es/handler/events/event.js.map +0 -1
- package/es/handler/events/index.js.map +0 -1
- package/es/handler/events/map_mouse_event.js.map +0 -1
- package/es/handler/events/map_touch_event.js.map +0 -1
- package/es/handler/events/map_wheel_event.js.map +0 -1
- package/es/handler/events/render_event.js.map +0 -1
- package/es/handler/handler_inertia.js.map +0 -1
- package/es/handler/handler_manager.js.map +0 -1
- package/es/handler/handler_util.js.map +0 -1
- package/es/handler/keyboard.js.map +0 -1
- package/es/handler/map_event.js.map +0 -1
- package/es/handler/mouse/index.js.map +0 -1
- package/es/handler/mouse/mouse_handler.js.map +0 -1
- package/es/handler/mouse/mousepan_handler.js.map +0 -1
- package/es/handler/mouse/mousepitch_hander.js.map +0 -1
- package/es/handler/mouse/mouserotate_hander.js.map +0 -1
- package/es/handler/mouse/util.js.map +0 -1
- package/es/handler/scroll_zoom.js.map +0 -1
- package/es/handler/shim/dblclick_zoom.js.map +0 -1
- package/es/handler/shim/drag_pan.js.map +0 -1
- package/es/handler/shim/drag_rotate.js.map +0 -1
- package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/es/handler/tap/single_tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_drag_zoom.js.map +0 -1
- package/es/handler/tap/tap_recognizer.js.map +0 -1
- package/es/handler/tap/tap_zoom.js.map +0 -1
- package/es/handler/touch/index.js.map +0 -1
- package/es/handler/touch/touch_pan.js.map +0 -1
- package/es/handler/touch/touch_pitch.js.map +0 -1
- package/es/handler/touch/touch_rotate.js.map +0 -1
- package/es/handler/touch/touch_zoom.js.map +0 -1
- package/es/handler/touch/two_touch.js.map +0 -1
- package/es/hash.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/interface.js.map +0 -1
- package/es/map.js.map +0 -1
- package/es/util.js.map +0 -1
- package/es/utils/Aabb.js.map +0 -1
- package/es/utils/dom.js.map +0 -1
- package/es/utils/performance.js.map +0 -1
- package/es/utils/primitives.js.map +0 -1
- package/es/utils/task_queue.js.map +0 -1
- package/lib/camera.js.map +0 -1
- package/lib/earthmap.js.map +0 -1
- package/lib/geo/edge_insets.js.map +0 -1
- package/lib/geo/lng_lat.js.map +0 -1
- package/lib/geo/lng_lat_bounds.js.map +0 -1
- package/lib/geo/mercator.js.map +0 -1
- package/lib/geo/point.js.map +0 -1
- package/lib/geo/simple.js.map +0 -1
- package/lib/geo/transform.js.map +0 -1
- package/lib/handler/IHandler.js.map +0 -1
- package/lib/handler/blockable_map_event.js.map +0 -1
- package/lib/handler/box_zoom.js.map +0 -1
- package/lib/handler/click_zoom.js.map +0 -1
- package/lib/handler/events/event.js.map +0 -1
- package/lib/handler/events/index.js.map +0 -1
- package/lib/handler/events/map_mouse_event.js.map +0 -1
- package/lib/handler/events/map_touch_event.js.map +0 -1
- package/lib/handler/events/map_wheel_event.js.map +0 -1
- package/lib/handler/events/render_event.js.map +0 -1
- package/lib/handler/handler_inertia.js.map +0 -1
- package/lib/handler/handler_manager.js.map +0 -1
- package/lib/handler/handler_util.js.map +0 -1
- package/lib/handler/keyboard.js.map +0 -1
- package/lib/handler/map_event.js.map +0 -1
- package/lib/handler/mouse/index.js.map +0 -1
- package/lib/handler/mouse/mouse_handler.js.map +0 -1
- package/lib/handler/mouse/mousepan_handler.js.map +0 -1
- package/lib/handler/mouse/mousepitch_hander.js.map +0 -1
- package/lib/handler/mouse/mouserotate_hander.js.map +0 -1
- package/lib/handler/mouse/util.js.map +0 -1
- package/lib/handler/scroll_zoom.js.map +0 -1
- package/lib/handler/shim/dblclick_zoom.js.map +0 -1
- package/lib/handler/shim/drag_pan.js.map +0 -1
- package/lib/handler/shim/drag_rotate.js.map +0 -1
- package/lib/handler/shim/touch_zoom_rotate.js.map +0 -1
- package/lib/handler/tap/single_tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_drag_zoom.js.map +0 -1
- package/lib/handler/tap/tap_recognizer.js.map +0 -1
- package/lib/handler/tap/tap_zoom.js.map +0 -1
- package/lib/handler/touch/index.js.map +0 -1
- package/lib/handler/touch/touch_pan.js.map +0 -1
- package/lib/handler/touch/touch_pitch.js.map +0 -1
- package/lib/handler/touch/touch_rotate.js.map +0 -1
- package/lib/handler/touch/touch_zoom.js.map +0 -1
- package/lib/handler/touch/two_touch.js.map +0 -1
- package/lib/hash.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interface.js.map +0 -1
- package/lib/map.js.map +0 -1
- package/lib/util.js.map +0 -1
- package/lib/utils/Aabb.js.map +0 -1
- package/lib/utils/dom.js.map +0 -1
- package/lib/utils/performance.js.map +0 -1
- package/lib/utils/primitives.js.map +0 -1
- package/lib/utils/task_queue.js.map +0 -1
|
@@ -1,144 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/handler/touch/touch_pan.ts
|
|
23
|
+
var touch_pan_exports = {};
|
|
24
|
+
__export(touch_pan_exports, {
|
|
25
|
+
default: () => TouchPanHandler
|
|
7
26
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
17
|
-
|
|
18
|
-
var _handler_util = require("../handler_util");
|
|
19
|
-
|
|
20
|
-
var TouchPanHandler = function () {
|
|
21
|
-
function TouchPanHandler(options) {
|
|
22
|
-
(0, _classCallCheck2.default)(this, TouchPanHandler);
|
|
23
|
-
(0, _defineProperty2.default)(this, "enabled", void 0);
|
|
24
|
-
(0, _defineProperty2.default)(this, "active", void 0);
|
|
25
|
-
(0, _defineProperty2.default)(this, "touches", void 0);
|
|
26
|
-
(0, _defineProperty2.default)(this, "minTouches", void 0);
|
|
27
|
-
(0, _defineProperty2.default)(this, "clickTolerance", void 0);
|
|
28
|
-
(0, _defineProperty2.default)(this, "sum", void 0);
|
|
27
|
+
module.exports = __toCommonJS(touch_pan_exports);
|
|
28
|
+
var import_point = __toESM(require("../../geo/point"));
|
|
29
|
+
var import_handler_util = require("../handler_util");
|
|
30
|
+
var TouchPanHandler = class {
|
|
31
|
+
constructor(options) {
|
|
29
32
|
this.minTouches = 1;
|
|
30
33
|
this.clickTolerance = options.clickTolerance || 1;
|
|
31
34
|
this.reset();
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "touchmove",
|
|
48
|
-
value: function touchmove(e, points, mapTouches) {
|
|
49
|
-
if (!this.active) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
55
|
-
}
|
|
56
|
-
}, {
|
|
57
|
-
key: "touchend",
|
|
58
|
-
value: function touchend(e, points, mapTouches) {
|
|
59
|
-
this.calculateTransform(e, points, mapTouches);
|
|
60
|
-
|
|
61
|
-
if (this.active && mapTouches.length < this.minTouches) {
|
|
62
|
-
this.reset();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "touchcancel",
|
|
67
|
-
value: function touchcancel() {
|
|
68
|
-
this.reset();
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "enable",
|
|
72
|
-
value: function enable() {
|
|
73
|
-
this.enabled = true;
|
|
36
|
+
reset() {
|
|
37
|
+
this.active = false;
|
|
38
|
+
this.touches = {};
|
|
39
|
+
this.sum = new import_point.default(0, 0);
|
|
40
|
+
}
|
|
41
|
+
touchstart(e, points, mapTouches) {
|
|
42
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
43
|
+
}
|
|
44
|
+
touchmove(e, points, mapTouches) {
|
|
45
|
+
if (!this.active) {
|
|
46
|
+
return;
|
|
74
47
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
50
|
+
}
|
|
51
|
+
touchend(e, points, mapTouches) {
|
|
52
|
+
this.calculateTransform(e, points, mapTouches);
|
|
53
|
+
if (this.active && mapTouches.length < this.minTouches) {
|
|
79
54
|
this.reset();
|
|
80
55
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
56
|
+
}
|
|
57
|
+
touchcancel() {
|
|
58
|
+
this.reset();
|
|
59
|
+
}
|
|
60
|
+
enable() {
|
|
61
|
+
this.enabled = true;
|
|
62
|
+
}
|
|
63
|
+
disable() {
|
|
64
|
+
this.enabled = false;
|
|
65
|
+
this.reset();
|
|
66
|
+
}
|
|
67
|
+
isEnabled() {
|
|
68
|
+
return this.enabled;
|
|
69
|
+
}
|
|
70
|
+
isActive() {
|
|
71
|
+
return this.active;
|
|
72
|
+
}
|
|
73
|
+
calculateTransform(e, points, mapTouches) {
|
|
74
|
+
if (mapTouches.length > 0) {
|
|
75
|
+
this.active = true;
|
|
90
76
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (touches[identifier]) {
|
|
105
|
-
var point = touches[identifier];
|
|
106
|
-
var prevPoint = this.touches[identifier];
|
|
107
|
-
|
|
108
|
-
if (prevPoint) {
|
|
109
|
-
touchPointSum._add(point);
|
|
110
|
-
|
|
111
|
-
touchDeltaSum._add(point.sub(prevPoint));
|
|
112
|
-
|
|
113
|
-
touchDeltaCount++;
|
|
114
|
-
touches[identifier] = point;
|
|
115
|
-
}
|
|
77
|
+
const touches = (0, import_handler_util.indexTouches)(mapTouches, points);
|
|
78
|
+
const touchPointSum = new import_point.default(0, 0);
|
|
79
|
+
const touchDeltaSum = new import_point.default(0, 0);
|
|
80
|
+
let touchDeltaCount = 0;
|
|
81
|
+
for (const identifier in touches) {
|
|
82
|
+
if (touches[identifier]) {
|
|
83
|
+
const point = touches[identifier];
|
|
84
|
+
const prevPoint = this.touches[identifier];
|
|
85
|
+
if (prevPoint) {
|
|
86
|
+
touchPointSum._add(point);
|
|
87
|
+
touchDeltaSum._add(point.sub(prevPoint));
|
|
88
|
+
touchDeltaCount++;
|
|
89
|
+
touches[identifier] = point;
|
|
116
90
|
}
|
|
117
91
|
}
|
|
118
|
-
|
|
119
|
-
this.touches = touches;
|
|
120
|
-
|
|
121
|
-
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
126
|
-
|
|
127
|
-
this.sum._add(panDelta);
|
|
128
|
-
|
|
129
|
-
if (this.sum.mag() < this.clickTolerance) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
var around = touchPointSum.div(touchDeltaCount);
|
|
134
|
-
return {
|
|
135
|
-
around: around,
|
|
136
|
-
panDelta: panDelta
|
|
137
|
-
};
|
|
138
92
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
93
|
+
this.touches = touches;
|
|
94
|
+
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
98
|
+
this.sum._add(panDelta);
|
|
99
|
+
if (this.sum.mag() < this.clickTolerance) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const around = touchPointSum.div(touchDeltaCount);
|
|
103
|
+
return {
|
|
104
|
+
around,
|
|
105
|
+
panDelta
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {});
|
|
@@ -1,130 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/handler/touch/touch_pitch.ts
|
|
23
|
+
var touch_pitch_exports = {};
|
|
24
|
+
__export(touch_pitch_exports, {
|
|
25
|
+
default: () => TouchPitchHandler
|
|
7
26
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _two_touch = _interopRequireDefault(require("./two_touch"));
|
|
27
|
-
|
|
28
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
|
-
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
27
|
+
module.exports = __toCommonJS(touch_pitch_exports);
|
|
28
|
+
var import_two_touch = __toESM(require("./two_touch"));
|
|
32
29
|
function isVertical(vector) {
|
|
33
30
|
return Math.abs(vector.y) > Math.abs(vector.x);
|
|
34
31
|
}
|
|
35
|
-
|
|
36
32
|
var ALLOWED_SINGLE_TOUCH_TIME = 100;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(0
|
|
47
|
-
|
|
48
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
-
args[_key] = arguments[_key];
|
|
33
|
+
var TouchPitchHandler = class extends import_two_touch.default {
|
|
34
|
+
reset() {
|
|
35
|
+
super.reset();
|
|
36
|
+
this.valid = void 0;
|
|
37
|
+
delete this.firstMove;
|
|
38
|
+
delete this.lastPoints;
|
|
39
|
+
}
|
|
40
|
+
start(points) {
|
|
41
|
+
this.lastPoints = points;
|
|
42
|
+
if (isVertical(points[0].sub(points[1]))) {
|
|
43
|
+
this.valid = false;
|
|
50
44
|
}
|
|
51
|
-
|
|
52
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
53
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "valid", void 0);
|
|
54
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "firstMove", void 0);
|
|
55
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastPoints", void 0);
|
|
56
|
-
return _this;
|
|
57
45
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
delete this.firstMove;
|
|
65
|
-
delete this.lastPoints;
|
|
46
|
+
move(points, center, e) {
|
|
47
|
+
const vectorA = points[0].sub(this.lastPoints[0]);
|
|
48
|
+
const vectorB = points[1].sub(this.lastPoints[1]);
|
|
49
|
+
this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
|
|
50
|
+
if (!this.valid) {
|
|
51
|
+
return;
|
|
66
52
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
53
|
+
this.lastPoints = points;
|
|
54
|
+
this.active = true;
|
|
55
|
+
const yDeltaAverage = (vectorA.y + vectorB.y) / 2;
|
|
56
|
+
const degreesPerPixelMoved = -0.5;
|
|
57
|
+
return {
|
|
58
|
+
pitchDelta: yDeltaAverage * degreesPerPixelMoved
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
gestureBeginsVertically(vectorA, vectorB, timeStamp) {
|
|
62
|
+
if (this.valid !== void 0) {
|
|
63
|
+
return this.valid;
|
|
75
64
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
|
|
82
|
-
|
|
83
|
-
if (!this.valid) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this.lastPoints = points;
|
|
88
|
-
this.active = true;
|
|
89
|
-
var yDeltaAverage = (vectorA.y + vectorB.y) / 2;
|
|
90
|
-
var degreesPerPixelMoved = -0.5;
|
|
91
|
-
return {
|
|
92
|
-
pitchDelta: yDeltaAverage * degreesPerPixelMoved
|
|
93
|
-
};
|
|
65
|
+
const threshold = 2;
|
|
66
|
+
const movedA = vectorA.mag() >= threshold;
|
|
67
|
+
const movedB = vectorB.mag() >= threshold;
|
|
68
|
+
if (!movedA && !movedB) {
|
|
69
|
+
return;
|
|
94
70
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (this.valid !== undefined) {
|
|
99
|
-
return this.valid;
|
|
71
|
+
if (!movedA || !movedB) {
|
|
72
|
+
if (this.firstMove === void 0) {
|
|
73
|
+
this.firstMove = timeStamp;
|
|
100
74
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!movedA && !movedB) {
|
|
107
|
-
return;
|
|
75
|
+
if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
|
|
76
|
+
return void 0;
|
|
77
|
+
} else {
|
|
78
|
+
return false;
|
|
108
79
|
}
|
|
109
|
-
|
|
110
|
-
if (!movedA || !movedB) {
|
|
111
|
-
if (this.firstMove === undefined) {
|
|
112
|
-
this.firstMove = timeStamp;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
|
|
116
|
-
return undefined;
|
|
117
|
-
} else {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var isSameDirection = vectorA.y > 0 === vectorB.y > 0;
|
|
123
|
-
return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
|
|
124
80
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
81
|
+
const isSameDirection = vectorA.y > 0 === vectorB.y > 0;
|
|
82
|
+
return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {});
|
|
@@ -1,101 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/handler/touch/touch_rotate.ts
|
|
23
|
+
var touch_rotate_exports = {};
|
|
24
|
+
__export(touch_rotate_exports, {
|
|
25
|
+
default: () => TouchRotateHandler
|
|
7
26
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
-
|
|
16
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _two_touch = _interopRequireDefault(require("./two_touch"));
|
|
27
|
-
|
|
28
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
|
-
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
27
|
+
module.exports = __toCommonJS(touch_rotate_exports);
|
|
28
|
+
var import_two_touch = __toESM(require("./two_touch"));
|
|
32
29
|
var ROTATION_THRESHOLD = 25;
|
|
33
|
-
|
|
34
30
|
function getBearingDelta(a, b) {
|
|
35
31
|
return a.angleWith(b) * 180 / Math.PI;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
function TouchRotateHandler() {
|
|
44
|
-
var _this;
|
|
45
|
-
|
|
46
|
-
(0, _classCallCheck2.default)(this, TouchRotateHandler);
|
|
47
|
-
|
|
48
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
|
-
args[_key] = arguments[_key];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
53
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "minDiameter", void 0);
|
|
54
|
-
return _this;
|
|
33
|
+
var TouchRotateHandler = class extends import_two_touch.default {
|
|
34
|
+
reset() {
|
|
35
|
+
super.reset();
|
|
36
|
+
delete this.minDiameter;
|
|
37
|
+
delete this.startVector;
|
|
38
|
+
delete this.vector;
|
|
55
39
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, {
|
|
66
|
-
key: "start",
|
|
67
|
-
value: function start(points) {
|
|
68
|
-
this.startVector = this.vector = points[0].sub(points[1]);
|
|
69
|
-
this.minDiameter = points[0].dist(points[1]);
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "move",
|
|
73
|
-
value: function move(points, pinchAround) {
|
|
74
|
-
var lastVector = this.vector;
|
|
75
|
-
this.vector = points[0].sub(points[1]);
|
|
76
|
-
|
|
77
|
-
if (!this.active && this.isBelowThreshold(this.vector)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this.active = true;
|
|
82
|
-
return {
|
|
83
|
-
bearingDelta: getBearingDelta(this.vector, lastVector),
|
|
84
|
-
pinchAround: pinchAround
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "isBelowThreshold",
|
|
89
|
-
value: function isBelowThreshold(vector) {
|
|
90
|
-
this.minDiameter = Math.min(this.minDiameter, vector.mag());
|
|
91
|
-
var circumference = Math.PI * this.minDiameter;
|
|
92
|
-
var threshold = ROTATION_THRESHOLD / circumference * 360;
|
|
93
|
-
var bearingDeltaSinceStart = getBearingDelta(vector, this.startVector);
|
|
94
|
-
return Math.abs(bearingDeltaSinceStart) < threshold;
|
|
40
|
+
start(points) {
|
|
41
|
+
this.startVector = this.vector = points[0].sub(points[1]);
|
|
42
|
+
this.minDiameter = points[0].dist(points[1]);
|
|
43
|
+
}
|
|
44
|
+
move(points, pinchAround) {
|
|
45
|
+
const lastVector = this.vector;
|
|
46
|
+
this.vector = points[0].sub(points[1]);
|
|
47
|
+
if (!this.active && this.isBelowThreshold(this.vector)) {
|
|
48
|
+
return;
|
|
95
49
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
50
|
+
this.active = true;
|
|
51
|
+
return {
|
|
52
|
+
bearingDelta: getBearingDelta(this.vector, lastVector),
|
|
53
|
+
pinchAround
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
isBelowThreshold(vector) {
|
|
57
|
+
this.minDiameter = Math.min(this.minDiameter, vector.mag());
|
|
58
|
+
const circumference = Math.PI * this.minDiameter;
|
|
59
|
+
const threshold = ROTATION_THRESHOLD / circumference * 360;
|
|
60
|
+
const bearingDeltaSinceStart = getBearingDelta(vector, this.startVector);
|
|
61
|
+
return Math.abs(bearingDeltaSinceStart) < threshold;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {});
|