@antv/l7-map 2.17.12 → 2.18.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.
Files changed (104) hide show
  1. package/es/camera.js +92 -149
  2. package/es/earthmap.js +15 -68
  3. package/es/geo/edge_insets.js +4 -14
  4. package/es/geo/lng_lat.js +5 -13
  5. package/es/geo/lng_lat_bounds.js +4 -17
  6. package/es/geo/mercator.js +2 -10
  7. package/es/geo/point.js +0 -7
  8. package/es/geo/simple.js +6 -11
  9. package/es/geo/transform.js +128 -138
  10. package/es/handler/blockable_map_event.js +7 -12
  11. package/es/handler/box_zoom.js +10 -30
  12. package/es/handler/click_zoom.js +0 -5
  13. package/es/handler/events/event.js +2 -3
  14. package/es/handler/events/map_mouse_event.js +2 -13
  15. package/es/handler/events/map_touch_event.js +2 -12
  16. package/es/handler/events/map_wheel_event.js +1 -12
  17. package/es/handler/events/render_event.js +0 -13
  18. package/es/handler/handler_inertia.js +8 -35
  19. package/es/handler/handler_manager.js +90 -197
  20. package/es/handler/handler_util.js +1 -2
  21. package/es/handler/keyboard.js +1 -20
  22. package/es/handler/map_event.js +3 -9
  23. package/es/handler/mouse/mouse_handler.js +11 -24
  24. package/es/handler/mouse/mousepan_handler.js +1 -11
  25. package/es/handler/mouse/mousepitch_hander.js +1 -11
  26. package/es/handler/mouse/mouserotate_hander.js +1 -11
  27. package/es/handler/mouse/util.js +2 -3
  28. package/es/handler/scroll_zoom.js +43 -71
  29. package/es/handler/shim/dblclick_zoom.js +4 -9
  30. package/es/handler/shim/drag_pan.js +6 -18
  31. package/es/handler/shim/drag_rotate.js +4 -10
  32. package/es/handler/shim/touch_zoom_rotate.js +8 -23
  33. package/es/handler/tap/single_tap_recognizer.js +8 -31
  34. package/es/handler/tap/tap_drag_zoom.js +7 -15
  35. package/es/handler/tap/tap_recognizer.js +3 -11
  36. package/es/handler/tap/tap_zoom.js +1 -7
  37. package/es/handler/touch/touch_pan.js +4 -22
  38. package/es/handler/touch/touch_pitch.js +10 -27
  39. package/es/handler/touch/touch_rotate.js +8 -19
  40. package/es/handler/touch/touch_zoom.js +5 -18
  41. package/es/handler/touch/two_touch.js +19 -32
  42. package/es/hash.js +13 -35
  43. package/es/map.js +30 -107
  44. package/es/util.d.ts +3 -3
  45. package/es/util.js +20 -33
  46. package/es/utils/Aabb.js +10 -31
  47. package/es/utils/dom.js +33 -111
  48. package/es/utils/performance.js +9 -9
  49. package/es/utils/primitives.js +13 -11
  50. package/es/utils/task_queue.js +6 -23
  51. package/lib/camera.js +102 -179
  52. package/lib/earthmap.js +14 -83
  53. package/lib/geo/edge_insets.js +3 -18
  54. package/lib/geo/lng_lat.js +5 -18
  55. package/lib/geo/lng_lat_bounds.js +4 -20
  56. package/lib/geo/mercator.js +1 -22
  57. package/lib/geo/point.js +0 -8
  58. package/lib/geo/simple.js +5 -24
  59. package/lib/geo/transform.js +128 -170
  60. package/lib/handler/blockable_map_event.js +6 -14
  61. package/lib/handler/box_zoom.js +8 -39
  62. package/lib/handler/click_zoom.js +0 -6
  63. package/lib/handler/events/event.js +4 -7
  64. package/lib/handler/events/index.js +0 -4
  65. package/lib/handler/events/map_mouse_event.js +5 -22
  66. package/lib/handler/events/map_touch_event.js +2 -21
  67. package/lib/handler/events/map_wheel_event.js +1 -16
  68. package/lib/handler/events/render_event.js +0 -19
  69. package/lib/handler/handler_inertia.js +13 -44
  70. package/lib/handler/handler_manager.js +92 -222
  71. package/lib/handler/handler_util.js +1 -3
  72. package/lib/handler/keyboard.js +1 -22
  73. package/lib/handler/map_event.js +2 -11
  74. package/lib/handler/mouse/index.js +0 -4
  75. package/lib/handler/mouse/mouse_handler.js +10 -27
  76. package/lib/handler/mouse/mousepan_handler.js +1 -18
  77. package/lib/handler/mouse/mousepitch_hander.js +1 -17
  78. package/lib/handler/mouse/mouserotate_hander.js +1 -17
  79. package/lib/handler/mouse/util.js +2 -6
  80. package/lib/handler/scroll_zoom.js +43 -77
  81. package/lib/handler/shim/dblclick_zoom.js +4 -10
  82. package/lib/handler/shim/drag_pan.js +6 -20
  83. package/lib/handler/shim/drag_rotate.js +4 -11
  84. package/lib/handler/shim/touch_zoom_rotate.js +8 -25
  85. package/lib/handler/tap/single_tap_recognizer.js +8 -33
  86. package/lib/handler/tap/tap_drag_zoom.js +6 -18
  87. package/lib/handler/tap/tap_recognizer.js +2 -17
  88. package/lib/handler/tap/tap_zoom.js +0 -9
  89. package/lib/handler/touch/index.js +0 -5
  90. package/lib/handler/touch/touch_pan.js +4 -25
  91. package/lib/handler/touch/touch_pitch.js +10 -32
  92. package/lib/handler/touch/touch_rotate.js +8 -25
  93. package/lib/handler/touch/touch_zoom.js +5 -24
  94. package/lib/handler/touch/two_touch.js +18 -35
  95. package/lib/hash.js +12 -38
  96. package/lib/index.js +0 -8
  97. package/lib/map.js +30 -125
  98. package/lib/util.js +19 -46
  99. package/lib/utils/Aabb.js +10 -34
  100. package/lib/utils/dom.js +32 -118
  101. package/lib/utils/performance.js +9 -11
  102. package/lib/utils/primitives.js +13 -16
  103. package/lib/utils/task_queue.js +6 -24
  104. package/package.json +4 -4
@@ -1,18 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _l7Utils = require("@antv/l7-utils");
15
-
16
10
  /**
17
11
  * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
18
12
  * pinching on a touchscreen.
@@ -33,6 +27,7 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
33
27
  this.rotationDisabled = false;
34
28
  this.enabled = true;
35
29
  }
30
+
36
31
  /**
37
32
  * Enables the "pinch to rotate and zoom" interaction.
38
33
  *
@@ -44,63 +39,54 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
44
39
  * @example
45
40
  * map.touchZoomRotate.enable({ around: 'center' });
46
41
  */
47
-
48
-
49
42
  (0, _createClass2.default)(TouchZoomRotateHandler, [{
50
43
  key: "enable",
51
44
  value: function enable(options) {
52
45
  this.touchZoom.enable(options);
53
-
54
46
  if (!this.rotationDisabled) {
55
47
  this.touchRotate.enable(options);
56
48
  }
57
-
58
49
  this.tapDragZoom.enable();
59
-
60
- if (!_l7Utils.isMini) {
61
- this.el.classList.add('l7-touch-zoom-rotate');
62
- }
50
+ this.el.classList.add('l7-touch-zoom-rotate');
63
51
  }
52
+
64
53
  /**
65
54
  * Disables the "pinch to rotate and zoom" interaction.
66
55
  *
67
56
  * @example
68
57
  * map.touchZoomRotate.disable();
69
58
  */
70
-
71
59
  }, {
72
60
  key: "disable",
73
61
  value: function disable() {
74
62
  this.touchZoom.disable();
75
63
  this.touchRotate.disable();
76
64
  this.tapDragZoom.disable();
77
-
78
- if (!_l7Utils.isMini) {
79
- this.el.classList.remove('l7-touch-zoom-rotate');
80
- }
65
+ this.el.classList.remove('l7-touch-zoom-rotate');
81
66
  }
67
+
82
68
  /**
83
69
  * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
84
70
  *
85
71
  * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
86
72
  */
87
-
88
73
  }, {
89
74
  key: "isEnabled",
90
75
  value: function isEnabled() {
91
76
  return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
92
77
  }
78
+
93
79
  /**
94
80
  * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
95
81
  *
96
82
  * @returns {boolean} //eslint-disable-line
97
83
  */
98
-
99
84
  }, {
100
85
  key: "isActive",
101
86
  value: function isActive() {
102
87
  return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
103
88
  }
89
+
104
90
  /**
105
91
  * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
106
92
  * interaction enabled.
@@ -108,13 +94,13 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
108
94
  * @example
109
95
  * map.touchZoomRotate.disableRotation();
110
96
  */
111
-
112
97
  }, {
113
98
  key: "disableRotation",
114
99
  value: function disableRotation() {
115
100
  this.rotationDisabled = true;
116
101
  this.touchRotate.disable();
117
102
  }
103
+
118
104
  /**
119
105
  * Enables the "pinch to rotate" interaction.
120
106
  *
@@ -122,12 +108,10 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
122
108
  * map.touchZoomRotate.enable();
123
109
  * map.touchZoomRotate.enableRotation();
124
110
  */
125
-
126
111
  }, {
127
112
  key: "enableRotation",
128
113
  value: function enableRotation() {
129
114
  this.rotationDisabled = false;
130
-
131
115
  if (this.touchZoom.isEnabled()) {
132
116
  this.touchRotate.enable();
133
117
  }
@@ -135,5 +119,4 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
135
119
  }]);
136
120
  return TouchZoomRotateHandler;
137
121
  }();
138
-
139
122
  exports.default = TouchZoomRotateHandler;
@@ -1,70 +1,54 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.MAX_TOUCH_TIME = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _point = _interopRequireDefault(require("../../geo/point"));
15
-
16
11
  var _handler_util = require("../handler_util");
17
-
18
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; } } }; }
19
-
20
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); }
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
-
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
24
15
  function getCentroid(points) {
25
16
  var sum = new _point.default(0, 0);
26
-
27
17
  var _iterator = _createForOfIteratorHelper(points),
28
- _step;
29
-
18
+ _step;
30
19
  try {
31
20
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
32
21
  var point = _step.value;
33
-
34
22
  sum._add(point);
35
- } // @ts-ignore
36
-
23
+ }
24
+ // @ts-ignore
37
25
  } catch (err) {
38
26
  _iterator.e(err);
39
27
  } finally {
40
28
  _iterator.f();
41
29
  }
42
-
43
30
  return sum.div(points.length);
44
31
  }
45
-
46
32
  var MAX_TAP_INTERVAL = 500;
47
33
  exports.MAX_TAP_INTERVAL = MAX_TAP_INTERVAL;
48
34
  var MAX_TOUCH_TIME = 500;
49
35
  exports.MAX_TOUCH_TIME = MAX_TOUCH_TIME;
50
36
  var MAX_DIST = 30;
51
37
  exports.MAX_DIST = MAX_DIST;
52
-
53
38
  var SingleTapRecognizer = /*#__PURE__*/function () {
54
39
  function SingleTapRecognizer(options) {
55
40
  (0, _classCallCheck2.default)(this, SingleTapRecognizer);
56
41
  this.reset();
57
42
  this.numTouches = options.numTouches;
58
43
  }
59
-
60
44
  (0, _createClass2.default)(SingleTapRecognizer, [{
61
45
  key: "reset",
62
46
  value: function reset() {
63
47
  // @ts-ignore
64
- delete this.centroid; // @ts-ignore
65
-
66
- delete this.startTime; // @ts-ignore
67
-
48
+ delete this.centroid;
49
+ // @ts-ignore
50
+ delete this.startTime;
51
+ // @ts-ignore
68
52
  delete this.touches;
69
53
  this.aborted = false;
70
54
  }
@@ -74,15 +58,12 @@ var SingleTapRecognizer = /*#__PURE__*/function () {
74
58
  if (this.centroid || mapTouches.length > this.numTouches) {
75
59
  this.aborted = true;
76
60
  }
77
-
78
61
  if (this.aborted) {
79
62
  return;
80
63
  }
81
-
82
64
  if (this.startTime === undefined) {
83
65
  this.startTime = e.timeStamp;
84
66
  }
85
-
86
67
  if (mapTouches.length === this.numTouches) {
87
68
  this.centroid = getCentroid(points);
88
69
  this.touches = (0, _handler_util.indexTouches)(mapTouches, points);
@@ -94,14 +75,11 @@ var SingleTapRecognizer = /*#__PURE__*/function () {
94
75
  if (this.aborted || !this.centroid) {
95
76
  return;
96
77
  }
97
-
98
78
  var newTouches = (0, _handler_util.indexTouches)(mapTouches, points);
99
-
100
79
  for (var id in this.touches) {
101
80
  if (this.touches[id]) {
102
81
  var prevPos = this.touches[id];
103
82
  var pos = newTouches[id];
104
-
105
83
  if (!pos || pos.dist(prevPos) > MAX_DIST) {
106
84
  this.aborted = true;
107
85
  }
@@ -114,11 +92,9 @@ var SingleTapRecognizer = /*#__PURE__*/function () {
114
92
  if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
115
93
  this.aborted = true;
116
94
  }
117
-
118
95
  if (mapTouches.length === 0) {
119
96
  var centroid = !this.aborted && this.centroid;
120
97
  this.reset();
121
-
122
98
  if (centroid) {
123
99
  return centroid;
124
100
  }
@@ -127,5 +103,4 @@ var SingleTapRecognizer = /*#__PURE__*/function () {
127
103
  }]);
128
104
  return SingleTapRecognizer;
129
105
  }();
130
-
131
106
  exports.default = SingleTapRecognizer;
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _single_tap_recognizer = require("./single_tap_recognizer");
15
-
16
11
  var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
17
-
18
12
  // @ts-ignore
19
13
  var TapDragZoomHandler = /*#__PURE__*/function () {
20
14
  function TapDragZoomHandler() {
@@ -25,16 +19,15 @@ var TapDragZoomHandler = /*#__PURE__*/function () {
25
19
  });
26
20
  this.reset();
27
21
  }
28
-
29
22
  (0, _createClass2.default)(TapDragZoomHandler, [{
30
23
  key: "reset",
31
24
  value: function reset() {
32
- this.active = false; // @ts-ignore
33
-
34
- delete this.swipePoint; // @ts-ignore
35
-
36
- delete this.swipeTouch; // @ts-ignore
37
-
25
+ this.active = false;
26
+ // @ts-ignore
27
+ delete this.swipePoint;
28
+ // @ts-ignore
29
+ delete this.swipeTouch;
30
+ // @ts-ignore
38
31
  delete this.tapTime;
39
32
  this.tap.reset();
40
33
  }
@@ -44,11 +37,9 @@ var TapDragZoomHandler = /*#__PURE__*/function () {
44
37
  if (this.swipePoint) {
45
38
  return;
46
39
  }
47
-
48
40
  if (this.tapTime && e.timeStamp - this.tapTime > _single_tap_recognizer.MAX_TAP_INTERVAL) {
49
41
  this.reset();
50
42
  }
51
-
52
43
  if (!this.tapTime) {
53
44
  this.tap.touchstart(e, points, mapTouches);
54
45
  } else if (mapTouches.length > 0) {
@@ -65,7 +56,6 @@ var TapDragZoomHandler = /*#__PURE__*/function () {
65
56
  if (mapTouches[0].identifier !== this.swipeTouch) {
66
57
  return;
67
58
  }
68
-
69
59
  var newSwipePoint = points[0];
70
60
  var dist = newSwipePoint.y - this.swipePoint.y;
71
61
  this.swipePoint = newSwipePoint;
@@ -81,7 +71,6 @@ var TapDragZoomHandler = /*#__PURE__*/function () {
81
71
  value: function touchend(e, points, mapTouches) {
82
72
  if (!this.tapTime) {
83
73
  var point = this.tap.touchend(e, points, mapTouches);
84
-
85
74
  if (point) {
86
75
  this.tapTime = e.timeStamp;
87
76
  }
@@ -120,5 +109,4 @@ var TapDragZoomHandler = /*#__PURE__*/function () {
120
109
  }]);
121
110
  return TapDragZoomHandler;
122
111
  }();
123
-
124
112
  exports.default = TapDragZoomHandler;
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = void 0;
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
11
  var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
17
-
18
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); }
19
-
20
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; }
21
-
22
14
  // @ts-ignore
23
15
  var TapRecognizer = /*#__PURE__*/function () {
24
16
  function TapRecognizer(options) {
@@ -27,12 +19,11 @@ var TapRecognizer = /*#__PURE__*/function () {
27
19
  this.numTaps = options.numTaps;
28
20
  this.reset();
29
21
  }
30
-
31
22
  (0, _createClass2.default)(TapRecognizer, [{
32
23
  key: "reset",
33
24
  value: function reset() {
34
- this.lastTime = Infinity; // @ts-ignore
35
-
25
+ this.lastTime = Infinity;
26
+ // @ts-ignore
36
27
  delete this.lastTap;
37
28
  this.count = 0;
38
29
  this.singleTap.reset();
@@ -51,20 +42,15 @@ var TapRecognizer = /*#__PURE__*/function () {
51
42
  key: "touchend",
52
43
  value: function touchend(e, points, mapTouches) {
53
44
  var tap = this.singleTap.touchend(e, points, mapTouches);
54
-
55
45
  if (tap) {
56
46
  var soonEnough = e.timeStamp - this.lastTime < _single_tap_recognizer.MAX_TAP_INTERVAL;
57
-
58
47
  var closeEnough = !this.lastTap || this.lastTap.dist(tap) < _single_tap_recognizer.MAX_DIST;
59
-
60
48
  if (!soonEnough || !closeEnough) {
61
49
  this.reset();
62
50
  }
63
-
64
51
  this.count++;
65
52
  this.lastTime = e.timeStamp;
66
53
  this.lastTap = tap;
67
-
68
54
  if (this.count === this.numTaps) {
69
55
  this.reset();
70
56
  return tap;
@@ -74,5 +60,4 @@ var TapRecognizer = /*#__PURE__*/function () {
74
60
  }]);
75
61
  return TapRecognizer;
76
62
  }();
77
-
78
63
  exports.default = TapRecognizer;
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
15
-
16
11
  // @ts-ignore
17
12
  var TapZoomHandler = /*#__PURE__*/function () {
18
13
  function TapZoomHandler() {
@@ -27,7 +22,6 @@ var TapZoomHandler = /*#__PURE__*/function () {
27
22
  });
28
23
  this.reset();
29
24
  }
30
-
31
25
  (0, _createClass2.default)(TapZoomHandler, [{
32
26
  key: "reset",
33
27
  value: function reset() {
@@ -51,10 +45,8 @@ var TapZoomHandler = /*#__PURE__*/function () {
51
45
  key: "touchend",
52
46
  value: function touchend(e, points, mapTouches) {
53
47
  var _this = this;
54
-
55
48
  var zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
56
49
  var zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
57
-
58
50
  if (zoomInPoint) {
59
51
  this.active = true;
60
52
  e.preventDefault();
@@ -120,5 +112,4 @@ var TapZoomHandler = /*#__PURE__*/function () {
120
112
  }]);
121
113
  return TapZoomHandler;
122
114
  }();
123
-
124
115
  exports.default = TapZoomHandler;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -29,11 +28,7 @@ Object.defineProperty(exports, "TouchZoomHandler", {
29
28
  return _touch_zoom.default;
30
29
  }
31
30
  });
32
-
33
31
  var _touch_pan = _interopRequireDefault(require("./touch_pan"));
34
-
35
32
  var _touch_pitch = _interopRequireDefault(require("./touch_pitch"));
36
-
37
33
  var _touch_rotate = _interopRequireDefault(require("./touch_rotate"));
38
-
39
34
  var _touch_zoom = _interopRequireDefault(require("./touch_zoom"));
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _point = _interopRequireDefault(require("../../geo/point"));
15
-
16
11
  var _handler_util = require("../handler_util");
17
-
18
12
  // @ts-ignore
19
13
  var TouchPanHandler = /*#__PURE__*/function () {
20
14
  function TouchPanHandler(options) {
@@ -23,7 +17,6 @@ var TouchPanHandler = /*#__PURE__*/function () {
23
17
  this.clickTolerance = options.clickTolerance || 1;
24
18
  this.reset();
25
19
  }
26
-
27
20
  (0, _createClass2.default)(TouchPanHandler, [{
28
21
  key: "reset",
29
22
  value: function reset() {
@@ -42,7 +35,6 @@ var TouchPanHandler = /*#__PURE__*/function () {
42
35
  if (!this.active) {
43
36
  return;
44
37
  }
45
-
46
38
  e.preventDefault();
47
39
  return this.calculateTransform(e, points, mapTouches);
48
40
  }
@@ -50,7 +42,6 @@ var TouchPanHandler = /*#__PURE__*/function () {
50
42
  key: "touchend",
51
43
  value: function touchend(e, points, mapTouches) {
52
44
  this.calculateTransform(e, points, mapTouches);
53
-
54
45
  if (this.active && mapTouches.length < this.minTouches) {
55
46
  this.reset();
56
47
  }
@@ -87,44 +78,33 @@ var TouchPanHandler = /*#__PURE__*/function () {
87
78
  if (mapTouches.length > 0) {
88
79
  this.active = true;
89
80
  }
90
-
91
81
  var touches = (0, _handler_util.indexTouches)(mapTouches, points);
92
82
  var touchPointSum = new _point.default(0, 0);
93
83
  var touchDeltaSum = new _point.default(0, 0);
94
84
  var touchDeltaCount = 0;
95
-
96
85
  for (var identifier in touches) {
97
86
  if (touches[identifier]) {
98
87
  var point = touches[identifier];
99
88
  var prevPoint = this.touches[identifier];
100
-
101
89
  if (prevPoint) {
102
90
  touchPointSum._add(point);
103
-
104
91
  touchDeltaSum._add(point.sub(prevPoint));
105
-
106
92
  touchDeltaCount++;
107
93
  touches[identifier] = point;
108
94
  }
109
95
  }
110
96
  }
111
-
112
97
  this.touches = touches;
113
-
114
98
  if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
115
99
  return;
116
- } // @ts-ignore
117
-
118
-
100
+ }
101
+ // @ts-ignore
119
102
  var panDelta = touchDeltaSum.div(touchDeltaCount);
120
-
121
103
  this.sum._add(panDelta);
122
-
123
104
  if (this.sum.mag() < this.clickTolerance) {
124
105
  return;
125
- } // @ts-ignore
126
-
127
-
106
+ }
107
+ // @ts-ignore
128
108
  var around = touchPointSum.div(touchDeltaCount);
129
109
  return {
130
110
  around: around,
@@ -134,5 +114,4 @@ var TouchPanHandler = /*#__PURE__*/function () {
134
114
  }]);
135
115
  return TouchPanHandler;
136
116
  }();
137
-
138
117
  exports.default = TouchPanHandler;
@@ -1,61 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _two_touch = _interopRequireDefault(require("./two_touch"));
23
-
24
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); }; }
25
-
26
- 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; } }
27
-
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
28
17
  function isVertical(vector) {
29
18
  return Math.abs(vector.y) > Math.abs(vector.x);
30
19
  }
31
-
32
20
  var ALLOWED_SINGLE_TOUCH_TIME = 100;
33
-
34
21
  var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
35
22
  (0, _inherits2.default)(TouchPitchHandler, _TwoTouchHandler);
36
-
37
23
  var _super = _createSuper(TouchPitchHandler);
38
-
39
24
  function TouchPitchHandler() {
40
25
  (0, _classCallCheck2.default)(this, TouchPitchHandler);
41
26
  return _super.apply(this, arguments);
42
27
  }
43
-
44
28
  (0, _createClass2.default)(TouchPitchHandler, [{
45
29
  key: "reset",
46
30
  value: function reset() {
47
31
  (0, _get2.default)((0, _getPrototypeOf2.default)(TouchPitchHandler.prototype), "reset", this).call(this);
48
- this.valid = undefined; // @ts-ignore
49
-
50
- delete this.firstMove; // @ts-ignore
51
-
32
+ this.valid = undefined;
33
+ // @ts-ignore
34
+ delete this.firstMove;
35
+ // @ts-ignore
52
36
  delete this.lastPoints;
53
37
  }
54
38
  }, {
55
39
  key: "start",
56
40
  value: function start(points) {
57
41
  this.lastPoints = points;
58
-
59
42
  if (isVertical(points[0].sub(points[1]))) {
60
43
  // fingers are more horizontal than vertical
61
44
  this.valid = false;
@@ -67,11 +50,9 @@ var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
67
50
  var vectorA = points[0].sub(this.lastPoints[0]);
68
51
  var vectorB = points[1].sub(this.lastPoints[1]);
69
52
  this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
70
-
71
53
  if (!this.valid) {
72
54
  return;
73
55
  }
74
-
75
56
  this.lastPoints = points;
76
57
  this.active = true;
77
58
  var yDeltaAverage = (vectorA.y + vectorB.y) / 2;
@@ -86,22 +67,21 @@ var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
86
67
  if (this.valid !== undefined) {
87
68
  return this.valid;
88
69
  }
89
-
90
70
  var threshold = 2;
91
71
  var movedA = vectorA.mag() >= threshold;
92
- var movedB = vectorB.mag() >= threshold; // neither finger has moved a meaningful amount, wait
72
+ var movedB = vectorB.mag() >= threshold;
93
73
 
74
+ // neither finger has moved a meaningful amount, wait
94
75
  if (!movedA && !movedB) {
95
76
  return;
96
- } // One finger has moved and the other has not.
97
- // If enough time has passed, decide it is not a pitch.
98
-
77
+ }
99
78
 
79
+ // One finger has moved and the other has not.
80
+ // If enough time has passed, decide it is not a pitch.
100
81
  if (!movedA || !movedB) {
101
82
  if (this.firstMove === undefined) {
102
83
  this.firstMove = timeStamp;
103
84
  }
104
-
105
85
  if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
106
86
  // still waiting for a movement from the second finger
107
87
  return undefined;
@@ -109,12 +89,10 @@ var TouchPitchHandler = /*#__PURE__*/function (_TwoTouchHandler) {
109
89
  return false;
110
90
  }
111
91
  }
112
-
113
92
  var isSameDirection = vectorA.y > 0 === vectorB.y > 0;
114
93
  return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
115
94
  }
116
95
  }]);
117
96
  return TouchPitchHandler;
118
97
  }(_two_touch.default);
119
-
120
98
  exports.default = TouchPitchHandler;