@antv/l7-map 2.17.12 → 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.
Files changed (168) hide show
  1. package/package.json +4 -4
  2. package/es/camera.d.ts +0 -85
  3. package/es/camera.js +0 -775
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -422
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -29
  14. package/es/geo/mercator.js +0 -92
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -29
  18. package/es/geo/simple.js +0 -92
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -131
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -138
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -4
  96. package/es/index.js +0 -4
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -464
  101. package/es/util.d.ts +0 -25
  102. package/es/util.js +0 -101
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -801
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -445
  116. package/lib/geo/edge_insets.js +0 -129
  117. package/lib/geo/lng_lat.js +0 -94
  118. package/lib/geo/lng_lat_bounds.js +0 -177
  119. package/lib/geo/mercator.js +0 -121
  120. package/lib/geo/point.js +0 -239
  121. package/lib/geo/simple.js +0 -123
  122. package/lib/geo/transform.js +0 -1013
  123. package/lib/handler/IHandler.js +0 -5
  124. package/lib/handler/blockable_map_event.js +0 -92
  125. package/lib/handler/box_zoom.js +0 -217
  126. package/lib/handler/click_zoom.js +0 -67
  127. package/lib/handler/events/event.js +0 -23
  128. package/lib/handler/events/index.js +0 -31
  129. package/lib/handler/events/map_mouse_event.js +0 -87
  130. package/lib/handler/events/map_touch_event.js +0 -119
  131. package/lib/handler/events/map_wheel_event.js +0 -72
  132. package/lib/handler/events/render_event.js +0 -52
  133. package/lib/handler/handler_inertia.js +0 -193
  134. package/lib/handler/handler_manager.js +0 -714
  135. package/lib/handler/handler_util.js +0 -17
  136. package/lib/handler/keyboard.js +0 -172
  137. package/lib/handler/map_event.js +0 -140
  138. package/lib/handler/mouse/index.js +0 -31
  139. package/lib/handler/mouse/mouse_handler.js +0 -141
  140. package/lib/handler/mouse/mousepan_handler.js +0 -66
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -67
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -67
  143. package/lib/handler/mouse/util.js +0 -26
  144. package/lib/handler/scroll_zoom.js +0 -367
  145. package/lib/handler/shim/dblclick_zoom.js +0 -80
  146. package/lib/handler/shim/drag_pan.js +0 -105
  147. package/lib/handler/shim/drag_rotate.js +0 -88
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -139
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -131
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -124
  151. package/lib/handler/tap/tap_recognizer.js +0 -78
  152. package/lib/handler/tap/tap_zoom.js +0 -124
  153. package/lib/handler/touch/index.js +0 -39
  154. package/lib/handler/touch/touch_pan.js +0 -138
  155. package/lib/handler/touch/touch_pitch.js +0 -120
  156. package/lib/handler/touch/touch_rotate.js +0 -99
  157. package/lib/handler/touch/touch_zoom.js +0 -78
  158. package/lib/handler/touch/two_touch.js +0 -148
  159. package/lib/hash.js +0 -169
  160. package/lib/index.js +0 -57
  161. package/lib/interface.js +0 -5
  162. package/lib/map.js +0 -489
  163. package/lib/util.js +0 -135
  164. package/lib/utils/Aabb.js +0 -143
  165. package/lib/utils/dom.js +0 -233
  166. package/lib/utils/performance.js +0 -72
  167. package/lib/utils/primitives.js +0 -57
  168. package/lib/utils/task_queue.js +0 -115
@@ -1,139 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
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 _l7Utils = require("@antv/l7-utils");
15
-
16
- /**
17
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
18
- * pinching on a touchscreen.
19
- *
20
- * They can zoom with one finger by double tapping and dragging. On the second tap,
21
- * hold the finger down and drag up or down to zoom in or out.
22
- */
23
- var TouchZoomRotateHandler = /*#__PURE__*/function () {
24
- /**
25
- * @private
26
- */
27
- function TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom) {
28
- (0, _classCallCheck2.default)(this, TouchZoomRotateHandler);
29
- this.el = el;
30
- this.touchZoom = touchZoom;
31
- this.touchRotate = touchRotate;
32
- this.tapDragZoom = tapDragZoom;
33
- this.rotationDisabled = false;
34
- this.enabled = true;
35
- }
36
- /**
37
- * Enables the "pinch to rotate and zoom" interaction.
38
- *
39
- * @param {Object} [options] Options object.
40
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
41
- *
42
- * @example
43
- * map.touchZoomRotate.enable();
44
- * @example
45
- * map.touchZoomRotate.enable({ around: 'center' });
46
- */
47
-
48
-
49
- (0, _createClass2.default)(TouchZoomRotateHandler, [{
50
- key: "enable",
51
- value: function enable(options) {
52
- this.touchZoom.enable(options);
53
-
54
- if (!this.rotationDisabled) {
55
- this.touchRotate.enable(options);
56
- }
57
-
58
- this.tapDragZoom.enable();
59
-
60
- if (!_l7Utils.isMini) {
61
- this.el.classList.add('l7-touch-zoom-rotate');
62
- }
63
- }
64
- /**
65
- * Disables the "pinch to rotate and zoom" interaction.
66
- *
67
- * @example
68
- * map.touchZoomRotate.disable();
69
- */
70
-
71
- }, {
72
- key: "disable",
73
- value: function disable() {
74
- this.touchZoom.disable();
75
- this.touchRotate.disable();
76
- this.tapDragZoom.disable();
77
-
78
- if (!_l7Utils.isMini) {
79
- this.el.classList.remove('l7-touch-zoom-rotate');
80
- }
81
- }
82
- /**
83
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
84
- *
85
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
86
- */
87
-
88
- }, {
89
- key: "isEnabled",
90
- value: function isEnabled() {
91
- return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
92
- }
93
- /**
94
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
95
- *
96
- * @returns {boolean} //eslint-disable-line
97
- */
98
-
99
- }, {
100
- key: "isActive",
101
- value: function isActive() {
102
- return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
103
- }
104
- /**
105
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
106
- * interaction enabled.
107
- *
108
- * @example
109
- * map.touchZoomRotate.disableRotation();
110
- */
111
-
112
- }, {
113
- key: "disableRotation",
114
- value: function disableRotation() {
115
- this.rotationDisabled = true;
116
- this.touchRotate.disable();
117
- }
118
- /**
119
- * Enables the "pinch to rotate" interaction.
120
- *
121
- * @example
122
- * map.touchZoomRotate.enable();
123
- * map.touchZoomRotate.enableRotation();
124
- */
125
-
126
- }, {
127
- key: "enableRotation",
128
- value: function enableRotation() {
129
- this.rotationDisabled = false;
130
-
131
- if (this.touchZoom.isEnabled()) {
132
- this.touchRotate.enable();
133
- }
134
- }
135
- }]);
136
- return TouchZoomRotateHandler;
137
- }();
138
-
139
- exports.default = TouchZoomRotateHandler;
@@ -1,131 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
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
-
24
- function getCentroid(points) {
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();
41
- }
42
-
43
- return sum.div(points.length);
44
- }
45
-
46
- var MAX_TAP_INTERVAL = 500;
47
- exports.MAX_TAP_INTERVAL = MAX_TAP_INTERVAL;
48
- var MAX_TOUCH_TIME = 500;
49
- exports.MAX_TOUCH_TIME = MAX_TOUCH_TIME;
50
- var MAX_DIST = 30;
51
- exports.MAX_DIST = MAX_DIST;
52
-
53
- var SingleTapRecognizer = /*#__PURE__*/function () {
54
- function SingleTapRecognizer(options) {
55
- (0, _classCallCheck2.default)(this, SingleTapRecognizer);
56
- this.reset();
57
- this.numTouches = options.numTouches;
58
- }
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;
70
- }
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
- }
90
- }
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
- }
108
- }
109
- }
110
- }
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
- }
125
- }
126
- }
127
- }]);
128
- return SingleTapRecognizer;
129
- }();
130
-
131
- exports.default = SingleTapRecognizer;
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
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({
23
- numTouches: 1,
24
- numTaps: 1
25
- });
26
- this.reset();
27
- }
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();
40
- }
41
- }, {
42
- key: "touchstart",
43
- value: function touchstart(e, points, mapTouches) {
44
- if (this.swipePoint) {
45
- return;
46
- }
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
- }
58
- }
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
- };
77
- }
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
- }
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 TapDragZoomHandler;
122
- }();
123
-
124
- exports.default = TapDragZoomHandler;
@@ -1,78 +0,0 @@
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
9
- });
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);
27
- this.numTaps = options.numTaps;
28
- this.reset();
29
- }
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
- }
72
- }
73
- }
74
- }]);
75
- return TapRecognizer;
76
- }();
77
-
78
- exports.default = TapRecognizer;
@@ -1,124 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
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({
21
- numTouches: 1,
22
- numTaps: 2
23
- });
24
- this.zoomOut = new _tap_recognizer.default({
25
- numTouches: 2,
26
- numTaps: 1
27
- });
28
- this.reset();
29
- }
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();
37
- }
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,39 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
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
- }
13
- });
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
- }
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"));