@antv/l7-map 2.9.33 → 2.9.34
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/lib/camera.js +766 -508
- package/lib/earthmap.js +389 -223
- package/lib/geo/edge_insets.js +117 -64
- package/lib/geo/lng_lat.js +86 -65
- package/lib/geo/lng_lat_bounds.js +162 -123
- package/lib/geo/mercator.js +91 -62
- package/lib/geo/point.js +234 -171
- package/lib/geo/simple.js +93 -61
- package/lib/geo/transform.js +982 -472
- package/lib/handler/IHandler.js +4 -16
- package/lib/handler/blockable_map_event.js +84 -63
- package/lib/handler/box_zoom.js +201 -123
- package/lib/handler/click_zoom.js +63 -55
- package/lib/handler/events/event.js +20 -35
- package/lib/handler/events/index.js +28 -35
- package/lib/handler/events/map_mouse_event.js +85 -42
- package/lib/handler/events/map_touch_event.js +116 -45
- package/lib/handler/events/map_wheel_event.js +70 -34
- package/lib/handler/events/render_event.js +50 -31
- package/lib/handler/handler_inertia.js +158 -114
- package/lib/handler/handler_manager.js +640 -381
- package/lib/handler/handler_util.js +11 -29
- package/lib/handler/keyboard.js +155 -114
- package/lib/handler/map_event.js +133 -84
- package/lib/handler/mouse/index.js +28 -35
- package/lib/handler/mouse/mouse_handler.js +126 -90
- package/lib/handler/mouse/mousepan_handler.js +64 -46
- package/lib/handler/mouse/mousepitch_hander.js +64 -44
- package/lib/handler/mouse/mouserotate_hander.js +64 -44
- package/lib/handler/mouse/util.js +22 -40
- package/lib/handler/scroll_zoom.js +318 -176
- package/lib/handler/shim/dblclick_zoom.js +76 -42
- package/lib/handler/shim/drag_pan.js +98 -48
- package/lib/handler/shim/drag_rotate.js +82 -43
- package/lib/handler/shim/touch_zoom_rotate.js +127 -59
- package/lib/handler/tap/single_tap_recognizer.js +113 -84
- package/lib/handler/tap/tap_drag_zoom.js +111 -93
- package/lib/handler/tap/tap_recognizer.js +72 -60
- package/lib/handler/tap/tap_zoom.js +113 -88
- package/lib/handler/touch/index.js +36 -38
- package/lib/handler/touch/touch_pan.js +126 -98
- package/lib/handler/touch/touch_pitch.js +108 -74
- package/lib/handler/touch/touch_rotate.js +93 -59
- package/lib/handler/touch/touch_zoom.js +71 -49
- package/lib/handler/touch/two_touch.js +129 -90
- package/lib/hash.js +149 -100
- package/lib/index.js +43 -20
- package/lib/interface.js +4 -16
- package/lib/map.js +420 -240
- package/lib/util.js +88 -69
- package/lib/utils/Aabb.js +134 -81
- package/lib/utils/dom.js +162 -88
- package/lib/utils/performance.js +46 -54
- package/lib/utils/primitives.js +53 -59
- package/lib/utils/task_queue.js +104 -61
- package/package.json +3 -3
|
@@ -1,99 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
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);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
4
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
__export(tap_zoom_exports, {
|
|
25
|
-
default: () => TapZoomHandler
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
26
7
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
|
|
15
|
+
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
var TapZoomHandler = /*#__PURE__*/function () {
|
|
18
|
+
function TapZoomHandler() {
|
|
19
|
+
(0, _classCallCheck2.default)(this, TapZoomHandler);
|
|
20
|
+
this.zoomIn = new _tap_recognizer.default({
|
|
32
21
|
numTouches: 1,
|
|
33
22
|
numTaps: 2
|
|
34
23
|
});
|
|
35
|
-
this.zoomOut = new
|
|
24
|
+
this.zoomOut = new _tap_recognizer.default({
|
|
36
25
|
numTouches: 2,
|
|
37
26
|
numTaps: 1
|
|
38
27
|
});
|
|
39
28
|
this.reset();
|
|
40
29
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.zoomOut.touchstart(e, points, mapTouches);
|
|
49
|
-
}
|
|
50
|
-
touchmove(e, points, mapTouches) {
|
|
51
|
-
this.zoomIn.touchmove(e, points, mapTouches);
|
|
52
|
-
this.zoomOut.touchmove(e, points, mapTouches);
|
|
53
|
-
}
|
|
54
|
-
touchend(e, points, mapTouches) {
|
|
55
|
-
const zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
|
|
56
|
-
const zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
|
|
57
|
-
if (zoomInPoint) {
|
|
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(zoomInPoint)
|
|
66
|
-
}, { originalEvent: e })
|
|
67
|
-
};
|
|
68
|
-
} else if (zoomOutPoint) {
|
|
69
|
-
this.active = true;
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
setTimeout(() => this.reset(), 0);
|
|
72
|
-
return {
|
|
73
|
-
cameraAnimation: (map) => map.easeTo({
|
|
74
|
-
duration: 300,
|
|
75
|
-
zoom: map.getZoom() - 1,
|
|
76
|
-
around: map.unproject(zoomOutPoint)
|
|
77
|
-
}, { originalEvent: e })
|
|
78
|
-
};
|
|
30
|
+
|
|
31
|
+
(0, _createClass2.default)(TapZoomHandler, [{
|
|
32
|
+
key: "reset",
|
|
33
|
+
value: function reset() {
|
|
34
|
+
this.active = false;
|
|
35
|
+
this.zoomIn.reset();
|
|
36
|
+
this.zoomOut.reset();
|
|
79
37
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
38
|
+
}, {
|
|
39
|
+
key: "touchstart",
|
|
40
|
+
value: function touchstart(e, points, mapTouches) {
|
|
41
|
+
this.zoomIn.touchstart(e, points, mapTouches);
|
|
42
|
+
this.zoomOut.touchstart(e, points, mapTouches);
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "touchmove",
|
|
46
|
+
value: function touchmove(e, points, mapTouches) {
|
|
47
|
+
this.zoomIn.touchmove(e, points, mapTouches);
|
|
48
|
+
this.zoomOut.touchmove(e, points, mapTouches);
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "touchend",
|
|
52
|
+
value: function touchend(e, points, mapTouches) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
|
|
55
|
+
var zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
|
|
56
|
+
var zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
|
|
57
|
+
|
|
58
|
+
if (zoomInPoint) {
|
|
59
|
+
this.active = true;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
setTimeout(function () {
|
|
62
|
+
return _this.reset();
|
|
63
|
+
}, 0);
|
|
64
|
+
return {
|
|
65
|
+
cameraAnimation: function cameraAnimation(map) {
|
|
66
|
+
return map.easeTo({
|
|
67
|
+
duration: 300,
|
|
68
|
+
zoom: map.getZoom() + 1,
|
|
69
|
+
around: map.unproject(zoomInPoint)
|
|
70
|
+
}, {
|
|
71
|
+
originalEvent: e
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
} else if (zoomOutPoint) {
|
|
76
|
+
this.active = true;
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
setTimeout(function () {
|
|
79
|
+
return _this.reset();
|
|
80
|
+
}, 0);
|
|
81
|
+
return {
|
|
82
|
+
cameraAnimation: function cameraAnimation(map) {
|
|
83
|
+
return map.easeTo({
|
|
84
|
+
duration: 300,
|
|
85
|
+
zoom: map.getZoom() - 1,
|
|
86
|
+
around: map.unproject(zoomOutPoint)
|
|
87
|
+
}, {
|
|
88
|
+
originalEvent: e
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "touchcancel",
|
|
96
|
+
value: function touchcancel() {
|
|
97
|
+
this.reset();
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "enable",
|
|
101
|
+
value: function enable() {
|
|
102
|
+
this.enabled = true;
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "disable",
|
|
106
|
+
value: function disable() {
|
|
107
|
+
this.enabled = false;
|
|
108
|
+
this.reset();
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "isEnabled",
|
|
112
|
+
value: function isEnabled() {
|
|
113
|
+
return this.enabled;
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "isActive",
|
|
117
|
+
value: function isActive() {
|
|
118
|
+
return this.active;
|
|
119
|
+
}
|
|
120
|
+
}]);
|
|
121
|
+
return TapZoomHandler;
|
|
122
|
+
}();
|
|
123
|
+
|
|
124
|
+
exports.default = TapZoomHandler;
|
|
@@ -1,41 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
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);
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
21
4
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "TouchPanHandler", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _touch_pan.default;
|
|
12
|
+
}
|
|
29
13
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
Object.defineProperty(exports, "TouchPitchHandler", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _touch_pitch.default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "TouchRotateHandler", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _touch_rotate.default;
|
|
24
|
+
}
|
|
41
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "TouchZoomHandler", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _touch_zoom.default;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _touch_pan = _interopRequireDefault(require("./touch_pan"));
|
|
34
|
+
|
|
35
|
+
var _touch_pitch = _interopRequireDefault(require("./touch_pitch"));
|
|
36
|
+
|
|
37
|
+
var _touch_rotate = _interopRequireDefault(require("./touch_rotate"));
|
|
38
|
+
|
|
39
|
+
var _touch_zoom = _interopRequireDefault(require("./touch_zoom"));
|
|
@@ -1,110 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
26
7
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _point = _interopRequireDefault(require("../../geo/point"));
|
|
15
|
+
|
|
16
|
+
var _handler_util = require("../handler_util");
|
|
17
|
+
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
var TouchPanHandler = /*#__PURE__*/function () {
|
|
20
|
+
function TouchPanHandler(options) {
|
|
21
|
+
(0, _classCallCheck2.default)(this, TouchPanHandler);
|
|
32
22
|
this.minTouches = 1;
|
|
33
23
|
this.clickTolerance = options.clickTolerance || 1;
|
|
34
24
|
this.reset();
|
|
35
25
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
touchmove(e, points, mapTouches) {
|
|
45
|
-
if (!this.active) {
|
|
46
|
-
return;
|
|
26
|
+
|
|
27
|
+
(0, _createClass2.default)(TouchPanHandler, [{
|
|
28
|
+
key: "reset",
|
|
29
|
+
value: function reset() {
|
|
30
|
+
this.active = false;
|
|
31
|
+
this.touches = {};
|
|
32
|
+
this.sum = new _point.default(0, 0);
|
|
47
33
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.calculateTransform(e, points, mapTouches);
|
|
53
|
-
if (this.active && mapTouches.length < this.minTouches) {
|
|
54
|
-
this.reset();
|
|
34
|
+
}, {
|
|
35
|
+
key: "touchstart",
|
|
36
|
+
value: function touchstart(e, points, mapTouches) {
|
|
37
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
55
38
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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;
|
|
39
|
+
}, {
|
|
40
|
+
key: "touchmove",
|
|
41
|
+
value: function touchmove(e, points, mapTouches) {
|
|
42
|
+
if (!this.active) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
return this.calculateTransform(e, points, mapTouches);
|
|
76
48
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
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;
|
|
90
|
-
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "touchend",
|
|
51
|
+
value: function touchend(e, points, mapTouches) {
|
|
52
|
+
this.calculateTransform(e, points, mapTouches);
|
|
53
|
+
|
|
54
|
+
if (this.active && mapTouches.length < this.minTouches) {
|
|
55
|
+
this.reset();
|
|
91
56
|
}
|
|
92
57
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
58
|
+
}, {
|
|
59
|
+
key: "touchcancel",
|
|
60
|
+
value: function touchcancel() {
|
|
61
|
+
this.reset();
|
|
96
62
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
63
|
+
}, {
|
|
64
|
+
key: "enable",
|
|
65
|
+
value: function enable() {
|
|
66
|
+
this.enabled = true;
|
|
101
67
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
68
|
+
}, {
|
|
69
|
+
key: "disable",
|
|
70
|
+
value: function disable() {
|
|
71
|
+
this.enabled = false;
|
|
72
|
+
this.reset();
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "isEnabled",
|
|
76
|
+
value: function isEnabled() {
|
|
77
|
+
return this.enabled;
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "isActive",
|
|
81
|
+
value: function isActive() {
|
|
82
|
+
return this.active;
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "calculateTransform",
|
|
86
|
+
value: function calculateTransform(e, points, mapTouches) {
|
|
87
|
+
if (mapTouches.length > 0) {
|
|
88
|
+
this.active = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var touches = (0, _handler_util.indexTouches)(mapTouches, points);
|
|
92
|
+
var touchPointSum = new _point.default(0, 0);
|
|
93
|
+
var touchDeltaSum = new _point.default(0, 0);
|
|
94
|
+
var touchDeltaCount = 0;
|
|
95
|
+
|
|
96
|
+
for (var identifier in touches) {
|
|
97
|
+
if (touches[identifier]) {
|
|
98
|
+
var point = touches[identifier];
|
|
99
|
+
var prevPoint = this.touches[identifier];
|
|
100
|
+
|
|
101
|
+
if (prevPoint) {
|
|
102
|
+
touchPointSum._add(point);
|
|
103
|
+
|
|
104
|
+
touchDeltaSum._add(point.sub(prevPoint));
|
|
105
|
+
|
|
106
|
+
touchDeltaCount++;
|
|
107
|
+
touches[identifier] = point;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.touches = touches;
|
|
113
|
+
|
|
114
|
+
if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
|
|
115
|
+
return;
|
|
116
|
+
} // @ts-ignore
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
var panDelta = touchDeltaSum.div(touchDeltaCount);
|
|
120
|
+
|
|
121
|
+
this.sum._add(panDelta);
|
|
122
|
+
|
|
123
|
+
if (this.sum.mag() < this.clickTolerance) {
|
|
124
|
+
return;
|
|
125
|
+
} // @ts-ignore
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
var around = touchPointSum.div(touchDeltaCount);
|
|
129
|
+
return {
|
|
130
|
+
around: around,
|
|
131
|
+
panDelta: panDelta
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}]);
|
|
135
|
+
return TouchPanHandler;
|
|
136
|
+
}();
|
|
137
|
+
|
|
138
|
+
exports.default = TouchPanHandler;
|