@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.
Files changed (56) hide show
  1. package/lib/camera.js +766 -508
  2. package/lib/earthmap.js +389 -223
  3. package/lib/geo/edge_insets.js +117 -64
  4. package/lib/geo/lng_lat.js +86 -65
  5. package/lib/geo/lng_lat_bounds.js +162 -123
  6. package/lib/geo/mercator.js +91 -62
  7. package/lib/geo/point.js +234 -171
  8. package/lib/geo/simple.js +93 -61
  9. package/lib/geo/transform.js +982 -472
  10. package/lib/handler/IHandler.js +4 -16
  11. package/lib/handler/blockable_map_event.js +84 -63
  12. package/lib/handler/box_zoom.js +201 -123
  13. package/lib/handler/click_zoom.js +63 -55
  14. package/lib/handler/events/event.js +20 -35
  15. package/lib/handler/events/index.js +28 -35
  16. package/lib/handler/events/map_mouse_event.js +85 -42
  17. package/lib/handler/events/map_touch_event.js +116 -45
  18. package/lib/handler/events/map_wheel_event.js +70 -34
  19. package/lib/handler/events/render_event.js +50 -31
  20. package/lib/handler/handler_inertia.js +158 -114
  21. package/lib/handler/handler_manager.js +640 -381
  22. package/lib/handler/handler_util.js +11 -29
  23. package/lib/handler/keyboard.js +155 -114
  24. package/lib/handler/map_event.js +133 -84
  25. package/lib/handler/mouse/index.js +28 -35
  26. package/lib/handler/mouse/mouse_handler.js +126 -90
  27. package/lib/handler/mouse/mousepan_handler.js +64 -46
  28. package/lib/handler/mouse/mousepitch_hander.js +64 -44
  29. package/lib/handler/mouse/mouserotate_hander.js +64 -44
  30. package/lib/handler/mouse/util.js +22 -40
  31. package/lib/handler/scroll_zoom.js +318 -176
  32. package/lib/handler/shim/dblclick_zoom.js +76 -42
  33. package/lib/handler/shim/drag_pan.js +98 -48
  34. package/lib/handler/shim/drag_rotate.js +82 -43
  35. package/lib/handler/shim/touch_zoom_rotate.js +127 -59
  36. package/lib/handler/tap/single_tap_recognizer.js +113 -84
  37. package/lib/handler/tap/tap_drag_zoom.js +111 -93
  38. package/lib/handler/tap/tap_recognizer.js +72 -60
  39. package/lib/handler/tap/tap_zoom.js +113 -88
  40. package/lib/handler/touch/index.js +36 -38
  41. package/lib/handler/touch/touch_pan.js +126 -98
  42. package/lib/handler/touch/touch_pitch.js +108 -74
  43. package/lib/handler/touch/touch_rotate.js +93 -59
  44. package/lib/handler/touch/touch_zoom.js +71 -49
  45. package/lib/handler/touch/two_touch.js +129 -90
  46. package/lib/hash.js +149 -100
  47. package/lib/index.js +43 -20
  48. package/lib/interface.js +4 -16
  49. package/lib/map.js +420 -240
  50. package/lib/util.js +88 -69
  51. package/lib/utils/Aabb.js +134 -81
  52. package/lib/utils/dom.js +162 -88
  53. package/lib/utils/performance.js +46 -54
  54. package/lib/utils/primitives.js +53 -59
  55. package/lib/utils/task_queue.js +104 -61
  56. package/package.json +3 -3
@@ -1,102 +1,131 @@
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/tap/single_tap_recognizer.ts
23
- var single_tap_recognizer_exports = {};
24
- __export(single_tap_recognizer_exports, {
25
- MAX_DIST: () => MAX_DIST,
26
- MAX_TAP_INTERVAL: () => MAX_TAP_INTERVAL,
27
- MAX_TOUCH_TIME: () => MAX_TOUCH_TIME,
28
- default: () => SingleTapRecognizer
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
29
7
  });
30
- module.exports = __toCommonJS(single_tap_recognizer_exports);
31
- var import_point = __toESM(require("../../geo/point"));
32
- var import_handler_util = require("../handler_util");
8
+ exports.default = exports.MAX_TOUCH_TIME = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = 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
+ 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; } } }; }
19
+
20
+ 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); }
21
+
22
+ 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; }
23
+
33
24
  function getCentroid(points) {
34
- const sum = new import_point.default(0, 0);
35
- for (const point of points) {
36
- sum._add(point);
25
+ var sum = new _point.default(0, 0);
26
+
27
+ var _iterator = _createForOfIteratorHelper(points),
28
+ _step;
29
+
30
+ try {
31
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
32
+ var point = _step.value;
33
+
34
+ sum._add(point);
35
+ } // @ts-ignore
36
+
37
+ } catch (err) {
38
+ _iterator.e(err);
39
+ } finally {
40
+ _iterator.f();
37
41
  }
42
+
38
43
  return sum.div(points.length);
39
44
  }
45
+
40
46
  var MAX_TAP_INTERVAL = 500;
47
+ exports.MAX_TAP_INTERVAL = MAX_TAP_INTERVAL;
41
48
  var MAX_TOUCH_TIME = 500;
49
+ exports.MAX_TOUCH_TIME = MAX_TOUCH_TIME;
42
50
  var MAX_DIST = 30;
43
- var SingleTapRecognizer = class {
44
- constructor(options) {
51
+ exports.MAX_DIST = MAX_DIST;
52
+
53
+ var SingleTapRecognizer = /*#__PURE__*/function () {
54
+ function SingleTapRecognizer(options) {
55
+ (0, _classCallCheck2.default)(this, SingleTapRecognizer);
45
56
  this.reset();
46
57
  this.numTouches = options.numTouches;
47
58
  }
48
- reset() {
49
- delete this.centroid;
50
- delete this.startTime;
51
- delete this.touches;
52
- this.aborted = false;
53
- }
54
- touchstart(e, points, mapTouches) {
55
- if (this.centroid || mapTouches.length > this.numTouches) {
56
- this.aborted = true;
57
- }
58
- if (this.aborted) {
59
- return;
60
- }
61
- if (this.startTime === void 0) {
62
- this.startTime = e.timeStamp;
63
- }
64
- if (mapTouches.length === this.numTouches) {
65
- this.centroid = getCentroid(points);
66
- this.touches = (0, import_handler_util.indexTouches)(mapTouches, points);
59
+
60
+ (0, _createClass2.default)(SingleTapRecognizer, [{
61
+ key: "reset",
62
+ value: function reset() {
63
+ //@ts-ignore
64
+ delete this.centroid; //@ts-ignore
65
+
66
+ delete this.startTime; //@ts-ignore
67
+
68
+ delete this.touches;
69
+ this.aborted = false;
67
70
  }
68
- }
69
- touchmove(e, points, mapTouches) {
70
- if (this.aborted || !this.centroid) {
71
- return;
71
+ }, {
72
+ key: "touchstart",
73
+ value: function touchstart(e, points, mapTouches) {
74
+ if (this.centroid || mapTouches.length > this.numTouches) {
75
+ this.aborted = true;
76
+ }
77
+
78
+ if (this.aborted) {
79
+ return;
80
+ }
81
+
82
+ if (this.startTime === undefined) {
83
+ this.startTime = e.timeStamp;
84
+ }
85
+
86
+ if (mapTouches.length === this.numTouches) {
87
+ this.centroid = getCentroid(points);
88
+ this.touches = (0, _handler_util.indexTouches)(mapTouches, points);
89
+ }
72
90
  }
73
- const newTouches = (0, import_handler_util.indexTouches)(mapTouches, points);
74
- for (const id in this.touches) {
75
- if (this.touches[id]) {
76
- const prevPos = this.touches[id];
77
- const pos = newTouches[id];
78
- if (!pos || pos.dist(prevPos) > MAX_DIST) {
79
- this.aborted = true;
91
+ }, {
92
+ key: "touchmove",
93
+ value: function touchmove(e, points, mapTouches) {
94
+ if (this.aborted || !this.centroid) {
95
+ return;
96
+ }
97
+
98
+ var newTouches = (0, _handler_util.indexTouches)(mapTouches, points);
99
+
100
+ for (var id in this.touches) {
101
+ if (this.touches[id]) {
102
+ var prevPos = this.touches[id];
103
+ var pos = newTouches[id];
104
+
105
+ if (!pos || pos.dist(prevPos) > MAX_DIST) {
106
+ this.aborted = true;
107
+ }
80
108
  }
81
109
  }
82
110
  }
83
- }
84
- touchend(e, points, mapTouches) {
85
- if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
86
- this.aborted = true;
87
- }
88
- if (mapTouches.length === 0) {
89
- const centroid = !this.aborted && this.centroid;
90
- this.reset();
91
- if (centroid) {
92
- return centroid;
111
+ }, {
112
+ key: "touchend",
113
+ value: function touchend(e, points, mapTouches) {
114
+ if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
115
+ this.aborted = true;
116
+ }
117
+
118
+ if (mapTouches.length === 0) {
119
+ var centroid = !this.aborted && this.centroid;
120
+ this.reset();
121
+
122
+ if (centroid) {
123
+ return centroid;
124
+ }
93
125
  }
94
126
  }
95
- }
96
- };
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- MAX_DIST,
100
- MAX_TAP_INTERVAL,
101
- MAX_TOUCH_TIME
102
- });
127
+ }]);
128
+ return SingleTapRecognizer;
129
+ }();
130
+
131
+ exports.default = SingleTapRecognizer;
@@ -1,106 +1,124 @@
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/tap/tap_drag_zoom.ts
23
- var tap_drag_zoom_exports = {};
24
- __export(tap_drag_zoom_exports, {
25
- default: () => TapDragZoomHandler
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
26
7
  });
27
- module.exports = __toCommonJS(tap_drag_zoom_exports);
28
- var import_single_tap_recognizer = require("./single_tap_recognizer");
29
- var import_tap_recognizer = __toESM(require("./tap_recognizer"));
30
- var TapDragZoomHandler = class {
31
- constructor() {
32
- this.tap = new import_tap_recognizer.default({
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 _single_tap_recognizer = require("./single_tap_recognizer");
15
+
16
+ var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
17
+
18
+ // @ts-ignore
19
+ var TapDragZoomHandler = /*#__PURE__*/function () {
20
+ function TapDragZoomHandler() {
21
+ (0, _classCallCheck2.default)(this, TapDragZoomHandler);
22
+ this.tap = new _tap_recognizer.default({
33
23
  numTouches: 1,
34
24
  numTaps: 1
35
25
  });
36
26
  this.reset();
37
27
  }
38
- reset() {
39
- this.active = false;
40
- delete this.swipePoint;
41
- delete this.swipeTouch;
42
- delete this.tapTime;
43
- this.tap.reset();
44
- }
45
- touchstart(e, points, mapTouches) {
46
- if (this.swipePoint) {
47
- return;
48
- }
49
- if (this.tapTime && e.timeStamp - this.tapTime > import_single_tap_recognizer.MAX_TAP_INTERVAL) {
50
- this.reset();
51
- }
52
- if (!this.tapTime) {
53
- this.tap.touchstart(e, points, mapTouches);
54
- } else if (mapTouches.length > 0) {
55
- this.swipePoint = points[0];
56
- this.swipeTouch = mapTouches[0].identifier;
28
+
29
+ (0, _createClass2.default)(TapDragZoomHandler, [{
30
+ key: "reset",
31
+ value: function reset() {
32
+ this.active = false; //@ts-ignore
33
+
34
+ delete this.swipePoint; //@ts-ignore
35
+
36
+ delete this.swipeTouch; //@ts-ignore
37
+
38
+ delete this.tapTime;
39
+ this.tap.reset();
57
40
  }
58
- }
59
- touchmove(e, points, mapTouches) {
60
- if (!this.tapTime) {
61
- this.tap.touchmove(e, points, mapTouches);
62
- } else if (this.swipePoint) {
63
- if (mapTouches[0].identifier !== this.swipeTouch) {
41
+ }, {
42
+ key: "touchstart",
43
+ value: function touchstart(e, points, mapTouches) {
44
+ if (this.swipePoint) {
64
45
  return;
65
46
  }
66
- const newSwipePoint = points[0];
67
- const dist = newSwipePoint.y - this.swipePoint.y;
68
- this.swipePoint = newSwipePoint;
69
- e.preventDefault();
70
- this.active = true;
71
- return {
72
- zoomDelta: dist / 128
73
- };
47
+
48
+ if (this.tapTime && e.timeStamp - this.tapTime > _single_tap_recognizer.MAX_TAP_INTERVAL) {
49
+ this.reset();
50
+ }
51
+
52
+ if (!this.tapTime) {
53
+ this.tap.touchstart(e, points, mapTouches);
54
+ } else if (mapTouches.length > 0) {
55
+ this.swipePoint = points[0];
56
+ this.swipeTouch = mapTouches[0].identifier;
57
+ }
74
58
  }
75
- }
76
- touchend(e, points, mapTouches) {
77
- if (!this.tapTime) {
78
- const point = this.tap.touchend(e, points, mapTouches);
79
- if (point) {
80
- this.tapTime = e.timeStamp;
59
+ }, {
60
+ key: "touchmove",
61
+ value: function touchmove(e, points, mapTouches) {
62
+ if (!this.tapTime) {
63
+ this.tap.touchmove(e, points, mapTouches);
64
+ } else if (this.swipePoint) {
65
+ if (mapTouches[0].identifier !== this.swipeTouch) {
66
+ return;
67
+ }
68
+
69
+ var newSwipePoint = points[0];
70
+ var dist = newSwipePoint.y - this.swipePoint.y;
71
+ this.swipePoint = newSwipePoint;
72
+ e.preventDefault();
73
+ this.active = true;
74
+ return {
75
+ zoomDelta: dist / 128
76
+ };
81
77
  }
82
- } else if (this.swipePoint) {
83
- if (mapTouches.length === 0) {
84
- this.reset();
78
+ }
79
+ }, {
80
+ key: "touchend",
81
+ value: function touchend(e, points, mapTouches) {
82
+ if (!this.tapTime) {
83
+ var point = this.tap.touchend(e, points, mapTouches);
84
+
85
+ if (point) {
86
+ this.tapTime = e.timeStamp;
87
+ }
88
+ } else if (this.swipePoint) {
89
+ if (mapTouches.length === 0) {
90
+ this.reset();
91
+ }
85
92
  }
86
93
  }
87
- }
88
- touchcancel() {
89
- this.reset();
90
- }
91
- enable() {
92
- this.enabled = true;
93
- }
94
- disable() {
95
- this.enabled = false;
96
- this.reset();
97
- }
98
- isEnabled() {
99
- return this.enabled;
100
- }
101
- isActive() {
102
- return this.active;
103
- }
104
- };
105
- // Annotate the CommonJS export names for ESM import in node:
106
- 0 && (module.exports = {});
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 TapDragZoomHandler;
122
+ }();
123
+
124
+ exports.default = TapDragZoomHandler;
@@ -1,66 +1,78 @@
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/tap/tap_recognizer.ts
23
- var tap_recognizer_exports = {};
24
- __export(tap_recognizer_exports, {
25
- default: () => TapRecognizer
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
26
9
  });
27
- module.exports = __toCommonJS(tap_recognizer_exports);
28
- var import_single_tap_recognizer = __toESM(require("./single_tap_recognizer"));
29
- var TapRecognizer = class {
30
- constructor(options) {
31
- this.singleTap = new import_single_tap_recognizer.default(options);
10
+ exports.default = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
22
+ // @ts-ignore
23
+ var TapRecognizer = /*#__PURE__*/function () {
24
+ function TapRecognizer(options) {
25
+ (0, _classCallCheck2.default)(this, TapRecognizer);
26
+ this.singleTap = new _single_tap_recognizer.default(options);
32
27
  this.numTaps = options.numTaps;
33
28
  this.reset();
34
29
  }
35
- reset() {
36
- this.lastTime = Infinity;
37
- delete this.lastTap;
38
- this.count = 0;
39
- this.singleTap.reset();
40
- }
41
- touchstart(e, points, mapTouches) {
42
- this.singleTap.touchstart(e, points, mapTouches);
43
- }
44
- touchmove(e, points, mapTouches) {
45
- this.singleTap.touchmove(e, points, mapTouches);
46
- }
47
- touchend(e, points, mapTouches) {
48
- const tap = this.singleTap.touchend(e, points, mapTouches);
49
- if (tap) {
50
- const soonEnough = e.timeStamp - this.lastTime < import_single_tap_recognizer.MAX_TAP_INTERVAL;
51
- const closeEnough = !this.lastTap || this.lastTap.dist(tap) < import_single_tap_recognizer.MAX_DIST;
52
- if (!soonEnough || !closeEnough) {
53
- this.reset();
54
- }
55
- this.count++;
56
- this.lastTime = e.timeStamp;
57
- this.lastTap = tap;
58
- if (this.count === this.numTaps) {
59
- this.reset();
60
- return tap;
30
+
31
+ (0, _createClass2.default)(TapRecognizer, [{
32
+ key: "reset",
33
+ value: function reset() {
34
+ this.lastTime = Infinity; //@ts-ignore
35
+
36
+ delete this.lastTap;
37
+ this.count = 0;
38
+ this.singleTap.reset();
39
+ }
40
+ }, {
41
+ key: "touchstart",
42
+ value: function touchstart(e, points, mapTouches) {
43
+ this.singleTap.touchstart(e, points, mapTouches);
44
+ }
45
+ }, {
46
+ key: "touchmove",
47
+ value: function touchmove(e, points, mapTouches) {
48
+ this.singleTap.touchmove(e, points, mapTouches);
49
+ }
50
+ }, {
51
+ key: "touchend",
52
+ value: function touchend(e, points, mapTouches) {
53
+ var tap = this.singleTap.touchend(e, points, mapTouches);
54
+
55
+ if (tap) {
56
+ var soonEnough = e.timeStamp - this.lastTime < _single_tap_recognizer.MAX_TAP_INTERVAL;
57
+
58
+ var closeEnough = !this.lastTap || this.lastTap.dist(tap) < _single_tap_recognizer.MAX_DIST;
59
+
60
+ if (!soonEnough || !closeEnough) {
61
+ this.reset();
62
+ }
63
+
64
+ this.count++;
65
+ this.lastTime = e.timeStamp;
66
+ this.lastTap = tap;
67
+
68
+ if (this.count === this.numTaps) {
69
+ this.reset();
70
+ return tap;
71
+ }
61
72
  }
62
73
  }
63
- }
64
- };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {});
74
+ }]);
75
+ return TapRecognizer;
76
+ }();
77
+
78
+ exports.default = TapRecognizer;