@antv/l7-map 2.18.0 → 2.18.2
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/package.json +3 -3
- package/es/camera.d.ts +0 -85
- package/es/camera.js +0 -718
- package/es/css/l7.css +0 -98
- package/es/earthmap.d.ts +0 -66
- package/es/earthmap.js +0 -369
- package/es/geo/edge_insets.d.ts +0 -54
- package/es/geo/edge_insets.js +0 -108
- package/es/geo/lng_lat.d.ts +0 -18
- package/es/geo/lng_lat.js +0 -73
- package/es/geo/lng_lat_bounds.d.ts +0 -24
- package/es/geo/lng_lat_bounds.js +0 -154
- package/es/geo/mercator.d.ts +0 -29
- package/es/geo/mercator.js +0 -84
- package/es/geo/point.d.ts +0 -40
- package/es/geo/point.js +0 -224
- package/es/geo/simple.d.ts +0 -29
- package/es/geo/simple.js +0 -87
- package/es/geo/transform.d.ts +0 -198
- package/es/geo/transform.js +0 -961
- 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 -78
- package/es/handler/box_zoom.d.ts +0 -59
- package/es/handler/box_zoom.js +0 -180
- package/es/handler/click_zoom.d.ts +0 -16
- package/es/handler/click_zoom.js +0 -54
- package/es/handler/events/event.d.ts +0 -4
- package/es/handler/events/event.js +0 -11
- 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 -64
- package/es/handler/events/map_touch_event.d.ts +0 -57
- package/es/handler/events/map_touch_event.js +0 -95
- package/es/handler/events/map_wheel_event.d.ts +0 -33
- package/es/handler/events/map_wheel_event.js +0 -50
- package/es/handler/events/render_event.d.ts +0 -5
- package/es/handler/events/render_event.js +0 -26
- package/es/handler/handler_inertia.d.ts +0 -23
- package/es/handler/handler_inertia.js +0 -157
- package/es/handler/handler_manager.d.ts +0 -61
- package/es/handler/handler_manager.js +0 -577
- package/es/handler/handler_util.d.ts +0 -4
- package/es/handler/handler_util.js +0 -9
- package/es/handler/keyboard.d.ts +0 -36
- package/es/handler/keyboard.js +0 -143
- package/es/handler/map_event.d.ts +0 -29
- package/es/handler/map_event.js +0 -125
- 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 -118
- package/es/handler/mouse/mousepan_handler.d.ts +0 -10
- package/es/handler/mouse/mousepan_handler.js +0 -44
- package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
- package/es/handler/mouse/mousepitch_hander.js +0 -46
- package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
- package/es/handler/mouse/mouserotate_hander.js +0 -46
- package/es/handler/mouse/util.d.ts +0 -6
- package/es/handler/mouse/util.js +0 -11
- package/es/handler/scroll_zoom.d.ts +0 -93
- package/es/handler/scroll_zoom.js +0 -325
- package/es/handler/shim/dblclick_zoom.d.ts +0 -40
- package/es/handler/shim/dblclick_zoom.js +0 -67
- package/es/handler/shim/drag_pan.d.ts +0 -61
- package/es/handler/shim/drag_pan.js +0 -84
- package/es/handler/shim/drag_rotate.d.ts +0 -46
- package/es/handler/shim/drag_rotate.js +0 -74
- package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
- package/es/handler/shim/touch_zoom_rotate.js +0 -115
- package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
- package/es/handler/tap/single_tap_recognizer.js +0 -97
- package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
- package/es/handler/tap/tap_drag_zoom.js +0 -106
- package/es/handler/tap/tap_recognizer.d.ts +0 -17
- package/es/handler/tap/tap_recognizer.js +0 -54
- package/es/handler/tap/tap_zoom.d.ts +0 -22
- package/es/handler/tap/tap_zoom.js +0 -109
- 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 -110
- package/es/handler/touch/touch_pitch.d.ts +0 -13
- package/es/handler/touch/touch_pitch.js +0 -93
- package/es/handler/touch/touch_rotate.d.ts +0 -12
- package/es/handler/touch/touch_rotate.js +0 -77
- package/es/handler/touch/touch_zoom.d.ts +0 -12
- package/es/handler/touch/touch_zoom.js +0 -54
- package/es/handler/touch/two_touch.d.ts +0 -23
- package/es/handler/touch/two_touch.js +0 -125
- package/es/hash.d.ts +0 -14
- package/es/hash.js +0 -134
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -4
- 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 -387
- package/es/util.d.ts +0 -25
- package/es/util.js +0 -88
- package/es/utils/Aabb.d.ts +0 -12
- package/es/utils/Aabb.js +0 -112
- package/es/utils/dom.d.ts +0 -4
- package/es/utils/dom.js +0 -140
- package/es/utils/performance.d.ts +0 -17
- package/es/utils/performance.js +0 -62
- package/es/utils/primitives.d.ts +0 -6
- package/es/utils/primitives.js +0 -47
- package/es/utils/task_queue.d.ts +0 -13
- package/es/utils/task_queue.js +0 -89
- package/lib/camera.js +0 -724
- package/lib/css/l7.css +0 -98
- package/lib/earthmap.js +0 -376
- package/lib/geo/edge_insets.js +0 -114
- package/lib/geo/lng_lat.js +0 -81
- package/lib/geo/lng_lat_bounds.js +0 -161
- package/lib/geo/mercator.js +0 -100
- package/lib/geo/point.js +0 -231
- package/lib/geo/simple.js +0 -104
- package/lib/geo/transform.js +0 -971
- package/lib/handler/IHandler.js +0 -5
- package/lib/handler/blockable_map_event.js +0 -84
- package/lib/handler/box_zoom.js +0 -186
- package/lib/handler/click_zoom.js +0 -61
- package/lib/handler/events/event.js +0 -20
- package/lib/handler/events/index.js +0 -27
- package/lib/handler/events/map_mouse_event.js +0 -70
- package/lib/handler/events/map_touch_event.js +0 -100
- package/lib/handler/events/map_wheel_event.js +0 -57
- package/lib/handler/events/render_event.js +0 -33
- package/lib/handler/handler_inertia.js +0 -162
- package/lib/handler/handler_manager.js +0 -584
- package/lib/handler/handler_util.js +0 -15
- package/lib/handler/keyboard.js +0 -151
- package/lib/handler/map_event.js +0 -131
- package/lib/handler/mouse/index.js +0 -27
- package/lib/handler/mouse/mouse_handler.js +0 -124
- package/lib/handler/mouse/mousepan_handler.js +0 -49
- package/lib/handler/mouse/mousepitch_hander.js +0 -51
- package/lib/handler/mouse/mouserotate_hander.js +0 -51
- package/lib/handler/mouse/util.js +0 -22
- package/lib/handler/scroll_zoom.js +0 -333
- package/lib/handler/shim/dblclick_zoom.js +0 -74
- package/lib/handler/shim/drag_pan.js +0 -91
- package/lib/handler/shim/drag_rotate.js +0 -81
- package/lib/handler/shim/touch_zoom_rotate.js +0 -122
- package/lib/handler/tap/single_tap_recognizer.js +0 -106
- package/lib/handler/tap/tap_drag_zoom.js +0 -112
- package/lib/handler/tap/tap_recognizer.js +0 -63
- package/lib/handler/tap/tap_zoom.js +0 -115
- package/lib/handler/touch/index.js +0 -34
- package/lib/handler/touch/touch_pan.js +0 -117
- package/lib/handler/touch/touch_pitch.js +0 -98
- package/lib/handler/touch/touch_rotate.js +0 -82
- package/lib/handler/touch/touch_zoom.js +0 -59
- package/lib/handler/touch/two_touch.js +0 -131
- package/lib/hash.js +0 -143
- package/lib/index.js +0 -49
- package/lib/interface.js +0 -5
- package/lib/map.js +0 -394
- package/lib/util.js +0 -108
- package/lib/utils/Aabb.js +0 -119
- package/lib/utils/dom.js +0 -147
- package/lib/utils/performance.js +0 -70
- package/lib/utils/primitives.js +0 -54
- package/lib/utils/task_queue.js +0 -97
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.MAX_TOUCH_TIME = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
11
|
-
var _handler_util = require("../handler_util");
|
|
12
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } // @ts-ignore
|
|
15
|
-
function getCentroid(points) {
|
|
16
|
-
var sum = new _point.default(0, 0);
|
|
17
|
-
var _iterator = _createForOfIteratorHelper(points),
|
|
18
|
-
_step;
|
|
19
|
-
try {
|
|
20
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
21
|
-
var point = _step.value;
|
|
22
|
-
sum._add(point);
|
|
23
|
-
}
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
} catch (err) {
|
|
26
|
-
_iterator.e(err);
|
|
27
|
-
} finally {
|
|
28
|
-
_iterator.f();
|
|
29
|
-
}
|
|
30
|
-
return sum.div(points.length);
|
|
31
|
-
}
|
|
32
|
-
var MAX_TAP_INTERVAL = 500;
|
|
33
|
-
exports.MAX_TAP_INTERVAL = MAX_TAP_INTERVAL;
|
|
34
|
-
var MAX_TOUCH_TIME = 500;
|
|
35
|
-
exports.MAX_TOUCH_TIME = MAX_TOUCH_TIME;
|
|
36
|
-
var MAX_DIST = 30;
|
|
37
|
-
exports.MAX_DIST = MAX_DIST;
|
|
38
|
-
var SingleTapRecognizer = /*#__PURE__*/function () {
|
|
39
|
-
function SingleTapRecognizer(options) {
|
|
40
|
-
(0, _classCallCheck2.default)(this, SingleTapRecognizer);
|
|
41
|
-
this.reset();
|
|
42
|
-
this.numTouches = options.numTouches;
|
|
43
|
-
}
|
|
44
|
-
(0, _createClass2.default)(SingleTapRecognizer, [{
|
|
45
|
-
key: "reset",
|
|
46
|
-
value: function reset() {
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
delete this.centroid;
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
delete this.startTime;
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
delete this.touches;
|
|
53
|
-
this.aborted = false;
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: "touchstart",
|
|
57
|
-
value: function touchstart(e, points, mapTouches) {
|
|
58
|
-
if (this.centroid || mapTouches.length > this.numTouches) {
|
|
59
|
-
this.aborted = true;
|
|
60
|
-
}
|
|
61
|
-
if (this.aborted) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (this.startTime === undefined) {
|
|
65
|
-
this.startTime = e.timeStamp;
|
|
66
|
-
}
|
|
67
|
-
if (mapTouches.length === this.numTouches) {
|
|
68
|
-
this.centroid = getCentroid(points);
|
|
69
|
-
this.touches = (0, _handler_util.indexTouches)(mapTouches, points);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, {
|
|
73
|
-
key: "touchmove",
|
|
74
|
-
value: function touchmove(e, points, mapTouches) {
|
|
75
|
-
if (this.aborted || !this.centroid) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
var newTouches = (0, _handler_util.indexTouches)(mapTouches, points);
|
|
79
|
-
for (var id in this.touches) {
|
|
80
|
-
if (this.touches[id]) {
|
|
81
|
-
var prevPos = this.touches[id];
|
|
82
|
-
var pos = newTouches[id];
|
|
83
|
-
if (!pos || pos.dist(prevPos) > MAX_DIST) {
|
|
84
|
-
this.aborted = true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "touchend",
|
|
91
|
-
value: function touchend(e, points, mapTouches) {
|
|
92
|
-
if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
|
|
93
|
-
this.aborted = true;
|
|
94
|
-
}
|
|
95
|
-
if (mapTouches.length === 0) {
|
|
96
|
-
var centroid = !this.aborted && this.centroid;
|
|
97
|
-
this.reset();
|
|
98
|
-
if (centroid) {
|
|
99
|
-
return centroid;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}]);
|
|
104
|
-
return SingleTapRecognizer;
|
|
105
|
-
}();
|
|
106
|
-
exports.default = SingleTapRecognizer;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _single_tap_recognizer = require("./single_tap_recognizer");
|
|
11
|
-
var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
var TapDragZoomHandler = /*#__PURE__*/function () {
|
|
14
|
-
function TapDragZoomHandler() {
|
|
15
|
-
(0, _classCallCheck2.default)(this, TapDragZoomHandler);
|
|
16
|
-
this.tap = new _tap_recognizer.default({
|
|
17
|
-
numTouches: 1,
|
|
18
|
-
numTaps: 1
|
|
19
|
-
});
|
|
20
|
-
this.reset();
|
|
21
|
-
}
|
|
22
|
-
(0, _createClass2.default)(TapDragZoomHandler, [{
|
|
23
|
-
key: "reset",
|
|
24
|
-
value: function reset() {
|
|
25
|
-
this.active = false;
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
delete this.swipePoint;
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
delete this.swipeTouch;
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
delete this.tapTime;
|
|
32
|
-
this.tap.reset();
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "touchstart",
|
|
36
|
-
value: function touchstart(e, points, mapTouches) {
|
|
37
|
-
if (this.swipePoint) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (this.tapTime && e.timeStamp - this.tapTime > _single_tap_recognizer.MAX_TAP_INTERVAL) {
|
|
41
|
-
this.reset();
|
|
42
|
-
}
|
|
43
|
-
if (!this.tapTime) {
|
|
44
|
-
this.tap.touchstart(e, points, mapTouches);
|
|
45
|
-
} else if (mapTouches.length > 0) {
|
|
46
|
-
this.swipePoint = points[0];
|
|
47
|
-
this.swipeTouch = mapTouches[0].identifier;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "touchmove",
|
|
52
|
-
value: function touchmove(e, points, mapTouches) {
|
|
53
|
-
if (!this.tapTime) {
|
|
54
|
-
this.tap.touchmove(e, points, mapTouches);
|
|
55
|
-
} else if (this.swipePoint) {
|
|
56
|
-
if (mapTouches[0].identifier !== this.swipeTouch) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
var newSwipePoint = points[0];
|
|
60
|
-
var dist = newSwipePoint.y - this.swipePoint.y;
|
|
61
|
-
this.swipePoint = newSwipePoint;
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
this.active = true;
|
|
64
|
-
return {
|
|
65
|
-
zoomDelta: dist / 128
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "touchend",
|
|
71
|
-
value: function touchend(e, points, mapTouches) {
|
|
72
|
-
if (!this.tapTime) {
|
|
73
|
-
var point = this.tap.touchend(e, points, mapTouches);
|
|
74
|
-
if (point) {
|
|
75
|
-
this.tapTime = e.timeStamp;
|
|
76
|
-
}
|
|
77
|
-
} else if (this.swipePoint) {
|
|
78
|
-
if (mapTouches.length === 0) {
|
|
79
|
-
this.reset();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, {
|
|
84
|
-
key: "touchcancel",
|
|
85
|
-
value: function touchcancel() {
|
|
86
|
-
this.reset();
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "enable",
|
|
90
|
-
value: function enable() {
|
|
91
|
-
this.enabled = true;
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
key: "disable",
|
|
95
|
-
value: function disable() {
|
|
96
|
-
this.enabled = false;
|
|
97
|
-
this.reset();
|
|
98
|
-
}
|
|
99
|
-
}, {
|
|
100
|
-
key: "isEnabled",
|
|
101
|
-
value: function isEnabled() {
|
|
102
|
-
return this.enabled;
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "isActive",
|
|
106
|
-
value: function isActive() {
|
|
107
|
-
return this.active;
|
|
108
|
-
}
|
|
109
|
-
}]);
|
|
110
|
-
return TapDragZoomHandler;
|
|
111
|
-
}();
|
|
112
|
-
exports.default = TapDragZoomHandler;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
var TapRecognizer = /*#__PURE__*/function () {
|
|
16
|
-
function TapRecognizer(options) {
|
|
17
|
-
(0, _classCallCheck2.default)(this, TapRecognizer);
|
|
18
|
-
this.singleTap = new _single_tap_recognizer.default(options);
|
|
19
|
-
this.numTaps = options.numTaps;
|
|
20
|
-
this.reset();
|
|
21
|
-
}
|
|
22
|
-
(0, _createClass2.default)(TapRecognizer, [{
|
|
23
|
-
key: "reset",
|
|
24
|
-
value: function reset() {
|
|
25
|
-
this.lastTime = Infinity;
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
delete this.lastTap;
|
|
28
|
-
this.count = 0;
|
|
29
|
-
this.singleTap.reset();
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "touchstart",
|
|
33
|
-
value: function touchstart(e, points, mapTouches) {
|
|
34
|
-
this.singleTap.touchstart(e, points, mapTouches);
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "touchmove",
|
|
38
|
-
value: function touchmove(e, points, mapTouches) {
|
|
39
|
-
this.singleTap.touchmove(e, points, mapTouches);
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "touchend",
|
|
43
|
-
value: function touchend(e, points, mapTouches) {
|
|
44
|
-
var tap = this.singleTap.touchend(e, points, mapTouches);
|
|
45
|
-
if (tap) {
|
|
46
|
-
var soonEnough = e.timeStamp - this.lastTime < _single_tap_recognizer.MAX_TAP_INTERVAL;
|
|
47
|
-
var closeEnough = !this.lastTap || this.lastTap.dist(tap) < _single_tap_recognizer.MAX_DIST;
|
|
48
|
-
if (!soonEnough || !closeEnough) {
|
|
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
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}]);
|
|
61
|
-
return TapRecognizer;
|
|
62
|
-
}();
|
|
63
|
-
exports.default = TapRecognizer;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
var TapZoomHandler = /*#__PURE__*/function () {
|
|
13
|
-
function TapZoomHandler() {
|
|
14
|
-
(0, _classCallCheck2.default)(this, TapZoomHandler);
|
|
15
|
-
this.zoomIn = new _tap_recognizer.default({
|
|
16
|
-
numTouches: 1,
|
|
17
|
-
numTaps: 2
|
|
18
|
-
});
|
|
19
|
-
this.zoomOut = new _tap_recognizer.default({
|
|
20
|
-
numTouches: 2,
|
|
21
|
-
numTaps: 1
|
|
22
|
-
});
|
|
23
|
-
this.reset();
|
|
24
|
-
}
|
|
25
|
-
(0, _createClass2.default)(TapZoomHandler, [{
|
|
26
|
-
key: "reset",
|
|
27
|
-
value: function reset() {
|
|
28
|
-
this.active = false;
|
|
29
|
-
this.zoomIn.reset();
|
|
30
|
-
this.zoomOut.reset();
|
|
31
|
-
}
|
|
32
|
-
}, {
|
|
33
|
-
key: "touchstart",
|
|
34
|
-
value: function touchstart(e, points, mapTouches) {
|
|
35
|
-
this.zoomIn.touchstart(e, points, mapTouches);
|
|
36
|
-
this.zoomOut.touchstart(e, points, mapTouches);
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "touchmove",
|
|
40
|
-
value: function touchmove(e, points, mapTouches) {
|
|
41
|
-
this.zoomIn.touchmove(e, points, mapTouches);
|
|
42
|
-
this.zoomOut.touchmove(e, points, mapTouches);
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "touchend",
|
|
46
|
-
value: function touchend(e, points, mapTouches) {
|
|
47
|
-
var _this = this;
|
|
48
|
-
var zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
|
|
49
|
-
var zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
|
|
50
|
-
if (zoomInPoint) {
|
|
51
|
-
this.active = true;
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
setTimeout(function () {
|
|
54
|
-
return _this.reset();
|
|
55
|
-
}, 0);
|
|
56
|
-
return {
|
|
57
|
-
cameraAnimation: function cameraAnimation(map) {
|
|
58
|
-
return map.easeTo({
|
|
59
|
-
duration: 300,
|
|
60
|
-
zoom: map.getZoom() + 1,
|
|
61
|
-
around: map.unproject(zoomInPoint)
|
|
62
|
-
}, {
|
|
63
|
-
originalEvent: e
|
|
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;
|
|
111
|
-
}
|
|
112
|
-
}]);
|
|
113
|
-
return TapZoomHandler;
|
|
114
|
-
}();
|
|
115
|
-
exports.default = TapZoomHandler;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "TouchPanHandler", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _touch_pan.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "TouchPitchHandler", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _touch_pitch.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "TouchRotateHandler", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _touch_rotate.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "TouchZoomHandler", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function get() {
|
|
28
|
-
return _touch_zoom.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
var _touch_pan = _interopRequireDefault(require("./touch_pan"));
|
|
32
|
-
var _touch_pitch = _interopRequireDefault(require("./touch_pitch"));
|
|
33
|
-
var _touch_rotate = _interopRequireDefault(require("./touch_rotate"));
|
|
34
|
-
var _touch_zoom = _interopRequireDefault(require("./touch_zoom"));
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
11
|
-
var _handler_util = require("../handler_util");
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
var TouchPanHandler = /*#__PURE__*/function () {
|
|
14
|
-
function TouchPanHandler(options) {
|
|
15
|
-
(0, _classCallCheck2.default)(this, TouchPanHandler);
|
|
16
|
-
this.minTouches = 1;
|
|
17
|
-
this.clickTolerance = options.clickTolerance || 1;
|
|
18
|
-
this.reset();
|
|
19
|
-
}
|
|
20
|
-
(0, _createClass2.default)(TouchPanHandler, [{
|
|
21
|
-
key: "reset",
|
|
22
|
-
value: function reset() {
|
|
23
|
-
this.active = false;
|
|
24
|
-
this.touches = {};
|
|
25
|
-
this.sum = new _point.default(0, 0);
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
key: "touchstart",
|
|
29
|
-
value: function touchstart(e, points, mapTouches) {
|
|
30
|
-
return this.calculateTransform(e, points, mapTouches);
|
|
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;
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "disable",
|
|
61
|
-
value: function disable() {
|
|
62
|
-
this.enabled = false;
|
|
63
|
-
this.reset();
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "isEnabled",
|
|
67
|
-
value: function isEnabled() {
|
|
68
|
-
return this.enabled;
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "isActive",
|
|
72
|
-
value: function isActive() {
|
|
73
|
-
return this.active;
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "calculateTransform",
|
|
77
|
-
value: function calculateTransform(e, points, mapTouches) {
|
|
78
|
-
if (mapTouches.length > 0) {
|
|
79
|
-
this.active = true;
|
|
80
|
-
}
|
|
81
|
-
var touches = (0, _handler_util.indexTouches)(mapTouches, points);
|
|
82
|
-
var touchPointSum = new _point.default(0, 0);
|
|
83
|
-
var touchDeltaSum = new _point.default(0, 0);
|
|
84
|
-
var touchDeltaCount = 0;
|
|
85
|
-
for (var identifier in touches) {
|
|
86
|
-
if (touches[identifier]) {
|
|
87
|
-
var point = touches[identifier];
|
|
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
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
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
|
-
}
|
|
114
|
-
}]);
|
|
115
|
-
return TouchPanHandler;
|
|
116
|
-
}();
|
|
117
|
-
exports.default = TouchPanHandler;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _two_touch = _interopRequireDefault(require("./two_touch"));
|
|
15
|
-
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); }; }
|
|
16
|
-
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; } } // @ts-ignore
|
|
17
|
-
function isVertical(vector) {
|
|
18
|
-
return Math.abs(vector.y) > Math.abs(vector.x);
|
|
19
|
-
}
|
|
20
|
-
var ALLOWED_SINGLE_TOUCH_TIME = 100;
|
|
21
|
-
var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
|
|
22
|
-
(0, _inherits2.default)(TouchPitchHandler, _TwoTouchHandler);
|
|
23
|
-
var _super = _createSuper(TouchPitchHandler);
|
|
24
|
-
function TouchPitchHandler() {
|
|
25
|
-
(0, _classCallCheck2.default)(this, TouchPitchHandler);
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
(0, _createClass2.default)(TouchPitchHandler, [{
|
|
29
|
-
key: "reset",
|
|
30
|
-
value: function reset() {
|
|
31
|
-
(0, _get2.default)((0, _getPrototypeOf2.default)(TouchPitchHandler.prototype), "reset", this).call(this);
|
|
32
|
-
this.valid = undefined;
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
delete this.firstMove;
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
delete this.lastPoints;
|
|
37
|
-
}
|
|
38
|
-
}, {
|
|
39
|
-
key: "start",
|
|
40
|
-
value: function start(points) {
|
|
41
|
-
this.lastPoints = points;
|
|
42
|
-
if (isVertical(points[0].sub(points[1]))) {
|
|
43
|
-
// fingers are more horizontal than vertical
|
|
44
|
-
this.valid = false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "move",
|
|
49
|
-
value: function move(points, center, e) {
|
|
50
|
-
var vectorA = points[0].sub(this.lastPoints[0]);
|
|
51
|
-
var vectorB = points[1].sub(this.lastPoints[1]);
|
|
52
|
-
this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
|
|
53
|
-
if (!this.valid) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.lastPoints = points;
|
|
57
|
-
this.active = true;
|
|
58
|
-
var yDeltaAverage = (vectorA.y + vectorB.y) / 2;
|
|
59
|
-
var degreesPerPixelMoved = -0.5;
|
|
60
|
-
return {
|
|
61
|
-
pitchDelta: yDeltaAverage * degreesPerPixelMoved
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
key: "gestureBeginsVertically",
|
|
66
|
-
value: function gestureBeginsVertically(vectorA, vectorB, timeStamp) {
|
|
67
|
-
if (this.valid !== undefined) {
|
|
68
|
-
return this.valid;
|
|
69
|
-
}
|
|
70
|
-
var threshold = 2;
|
|
71
|
-
var movedA = vectorA.mag() >= threshold;
|
|
72
|
-
var movedB = vectorB.mag() >= threshold;
|
|
73
|
-
|
|
74
|
-
// neither finger has moved a meaningful amount, wait
|
|
75
|
-
if (!movedA && !movedB) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// One finger has moved and the other has not.
|
|
80
|
-
// If enough time has passed, decide it is not a pitch.
|
|
81
|
-
if (!movedA || !movedB) {
|
|
82
|
-
if (this.firstMove === undefined) {
|
|
83
|
-
this.firstMove = timeStamp;
|
|
84
|
-
}
|
|
85
|
-
if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
|
|
86
|
-
// still waiting for a movement from the second finger
|
|
87
|
-
return undefined;
|
|
88
|
-
} else {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
var isSameDirection = vectorA.y > 0 === vectorB.y > 0;
|
|
93
|
-
return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
|
|
94
|
-
}
|
|
95
|
-
}]);
|
|
96
|
-
return TouchPitchHandler;
|
|
97
|
-
}(_two_touch.default);
|
|
98
|
-
exports.default = TouchPitchHandler;
|