@antv/l7-map 2.21.0 → 2.21.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 (158) hide show
  1. package/es/camera.js +595 -674
  2. package/es/earthmap.js +313 -276
  3. package/es/geo/edge_insets.js +57 -72
  4. package/es/geo/lng_lat.js +50 -64
  5. package/es/geo/lng_lat_bounds.js +101 -137
  6. package/es/geo/mercator.js +23 -35
  7. package/es/geo/point.js +150 -221
  8. package/es/geo/simple.js +22 -34
  9. package/es/geo/transform.js +839 -905
  10. package/es/handler/blockable_map_event.js +46 -66
  11. package/es/handler/box_zoom.js +125 -143
  12. package/es/handler/click_zoom.js +37 -51
  13. package/es/handler/events/event.js +11 -9
  14. package/es/handler/events/map_mouse_event.js +39 -54
  15. package/es/handler/events/map_touch_event.js +54 -73
  16. package/es/handler/events/map_wheel_event.js +22 -38
  17. package/es/handler/events/render_event.js +6 -23
  18. package/es/handler/handler_inertia.js +98 -113
  19. package/es/handler/handler_manager.js +349 -437
  20. package/es/handler/handler_util.js +2 -2
  21. package/es/handler/keyboard.js +98 -110
  22. package/es/handler/map_event.js +81 -117
  23. package/es/handler/mouse/mouse_handler.js +81 -100
  24. package/es/handler/mouse/mousepan_handler.js +16 -39
  25. package/es/handler/mouse/mousepitch_hander.js +18 -40
  26. package/es/handler/mouse/mouserotate_hander.js +18 -40
  27. package/es/handler/mouse/util.js +7 -6
  28. package/es/handler/scroll_zoom.js +221 -231
  29. package/es/handler/shim/dblclick_zoom.js +36 -47
  30. package/es/handler/shim/drag_pan.js +41 -50
  31. package/es/handler/shim/drag_rotate.js +38 -48
  32. package/es/handler/shim/touch_zoom_rotate.js +68 -79
  33. package/es/handler/tap/single_tap_recognizer.js +60 -80
  34. package/es/handler/tap/tap_drag_zoom.js +72 -89
  35. package/es/handler/tap/tap_recognizer.js +37 -45
  36. package/es/handler/tap/tap_zoom.js +67 -95
  37. package/es/handler/touch/touch_pan.js +77 -96
  38. package/es/handler/touch/touch_pitch.js +61 -79
  39. package/es/handler/touch/touch_rotate.js +47 -67
  40. package/es/handler/touch/touch_zoom.js +29 -46
  41. package/es/handler/touch/two_touch.js +79 -104
  42. package/es/hash.js +75 -88
  43. package/es/map.js +318 -284
  44. package/es/util.js +18 -37
  45. package/es/utils/Aabb.js +60 -100
  46. package/es/utils/dom.js +32 -55
  47. package/es/utils/performance.js +25 -29
  48. package/es/utils/primitives.js +33 -43
  49. package/es/utils/task_queue.js +47 -76
  50. package/lib/camera.d.ts +86 -0
  51. package/lib/camera.js +597 -672
  52. package/lib/earthmap.d.ts +69 -0
  53. package/lib/earthmap.js +314 -276
  54. package/lib/geo/edge_insets.d.ts +54 -0
  55. package/lib/geo/edge_insets.js +58 -70
  56. package/lib/geo/lng_lat.d.ts +18 -0
  57. package/lib/geo/lng_lat.js +50 -62
  58. package/lib/geo/lng_lat_bounds.d.ts +25 -0
  59. package/lib/geo/lng_lat_bounds.js +102 -136
  60. package/lib/geo/mercator.d.ts +30 -0
  61. package/lib/geo/mercator.js +26 -37
  62. package/lib/geo/point.d.ts +40 -0
  63. package/lib/geo/point.js +151 -220
  64. package/lib/geo/simple.d.ts +30 -0
  65. package/lib/geo/simple.js +25 -36
  66. package/lib/geo/transform.d.ts +198 -0
  67. package/lib/geo/transform.js +844 -907
  68. package/lib/handler/IHandler.d.ts +34 -0
  69. package/lib/handler/blockable_map_event.d.ts +17 -0
  70. package/lib/handler/blockable_map_event.js +48 -65
  71. package/lib/handler/box_zoom.d.ts +59 -0
  72. package/lib/handler/box_zoom.js +126 -143
  73. package/lib/handler/click_zoom.d.ts +16 -0
  74. package/lib/handler/click_zoom.js +38 -50
  75. package/lib/handler/events/event.d.ts +4 -0
  76. package/lib/handler/events/event.js +12 -9
  77. package/lib/handler/events/index.d.ts +4 -0
  78. package/lib/handler/events/index.js +3 -3
  79. package/lib/handler/events/map_mouse_event.d.ts +34 -0
  80. package/lib/handler/events/map_mouse_event.js +41 -52
  81. package/lib/handler/events/map_touch_event.d.ts +57 -0
  82. package/lib/handler/events/map_touch_event.js +56 -71
  83. package/lib/handler/events/map_wheel_event.d.ts +33 -0
  84. package/lib/handler/events/map_wheel_event.js +23 -37
  85. package/lib/handler/events/render_event.d.ts +5 -0
  86. package/lib/handler/events/render_event.js +7 -22
  87. package/lib/handler/handler_inertia.d.ts +23 -0
  88. package/lib/handler/handler_inertia.js +102 -112
  89. package/lib/handler/handler_manager.d.ts +61 -0
  90. package/lib/handler/handler_manager.js +351 -437
  91. package/lib/handler/handler_util.d.ts +4 -0
  92. package/lib/handler/handler_util.js +2 -2
  93. package/lib/handler/keyboard.d.ts +36 -0
  94. package/lib/handler/keyboard.js +98 -110
  95. package/lib/handler/map_event.d.ts +29 -0
  96. package/lib/handler/map_event.js +83 -116
  97. package/lib/handler/mouse/index.d.ts +4 -0
  98. package/lib/handler/mouse/index.js +3 -3
  99. package/lib/handler/mouse/mouse_handler.d.ts +22 -0
  100. package/lib/handler/mouse/mouse_handler.js +83 -99
  101. package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
  102. package/lib/handler/mouse/mousepan_handler.js +19 -38
  103. package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
  104. package/lib/handler/mouse/mousepitch_hander.js +21 -39
  105. package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
  106. package/lib/handler/mouse/mouserotate_hander.js +21 -39
  107. package/lib/handler/mouse/util.d.ts +6 -0
  108. package/lib/handler/mouse/util.js +7 -7
  109. package/lib/handler/scroll_zoom.d.ts +93 -0
  110. package/lib/handler/scroll_zoom.js +221 -231
  111. package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
  112. package/lib/handler/shim/dblclick_zoom.js +37 -46
  113. package/lib/handler/shim/drag_pan.d.ts +61 -0
  114. package/lib/handler/shim/drag_pan.js +42 -49
  115. package/lib/handler/shim/drag_rotate.d.ts +46 -0
  116. package/lib/handler/shim/drag_rotate.js +39 -47
  117. package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
  118. package/lib/handler/shim/touch_zoom_rotate.js +69 -78
  119. package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
  120. package/lib/handler/tap/single_tap_recognizer.js +63 -79
  121. package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
  122. package/lib/handler/tap/tap_drag_zoom.js +74 -88
  123. package/lib/handler/tap/tap_recognizer.d.ts +17 -0
  124. package/lib/handler/tap/tap_recognizer.js +41 -47
  125. package/lib/handler/tap/tap_zoom.d.ts +22 -0
  126. package/lib/handler/tap/tap_zoom.js +69 -94
  127. package/lib/handler/touch/index.d.ts +5 -0
  128. package/lib/handler/touch/index.js +4 -4
  129. package/lib/handler/touch/touch_pan.d.ts +30 -0
  130. package/lib/handler/touch/touch_pan.js +79 -95
  131. package/lib/handler/touch/touch_pitch.d.ts +13 -0
  132. package/lib/handler/touch/touch_pitch.js +64 -78
  133. package/lib/handler/touch/touch_rotate.d.ts +12 -0
  134. package/lib/handler/touch/touch_rotate.js +50 -66
  135. package/lib/handler/touch/touch_zoom.d.ts +12 -0
  136. package/lib/handler/touch/touch_zoom.js +32 -45
  137. package/lib/handler/touch/two_touch.d.ts +23 -0
  138. package/lib/handler/touch/two_touch.js +81 -103
  139. package/lib/hash.d.ts +14 -0
  140. package/lib/hash.js +75 -88
  141. package/lib/index.d.ts +4 -0
  142. package/lib/index.js +4 -4
  143. package/lib/interface.d.ts +34 -0
  144. package/lib/map.d.ts +70 -0
  145. package/lib/map.js +319 -284
  146. package/lib/util.d.ts +25 -0
  147. package/lib/util.js +20 -36
  148. package/lib/utils/Aabb.d.ts +12 -0
  149. package/lib/utils/Aabb.js +61 -99
  150. package/lib/utils/dom.d.ts +4 -0
  151. package/lib/utils/dom.js +34 -55
  152. package/lib/utils/performance.d.ts +17 -0
  153. package/lib/utils/performance.js +25 -29
  154. package/lib/utils/primitives.d.ts +6 -0
  155. package/lib/utils/primitives.js +34 -42
  156. package/lib/utils/task_queue.d.ts +13 -0
  157. package/lib/utils/task_queue.js +47 -76
  158. package/package.json +25 -32
@@ -1,15 +1,17 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  /**
4
3
  * The `DragPanHandler` allows the user to pan the map by clicking and dragging
5
4
  * the cursor.
6
5
  */
7
- var DragPanHandler = /*#__PURE__*/function () {
6
+ export default class DragPanHandler {
8
7
  /**
9
8
  * @private
10
9
  */
11
- function DragPanHandler(el, mousePan, touchPan) {
12
- _classCallCheck(this, DragPanHandler);
10
+ constructor(el, mousePan, touchPan) {
11
+ _defineProperty(this, "inertiaOptions", void 0);
12
+ _defineProperty(this, "el", void 0);
13
+ _defineProperty(this, "mousePan", void 0);
14
+ _defineProperty(this, "touchPan", void 0);
13
15
  this.el = el;
14
16
  this.mousePan = mousePan;
15
17
  this.touchPan = touchPan;
@@ -34,51 +36,40 @@ var DragPanHandler = /*#__PURE__*/function () {
34
36
  * deceleration: 2500,
35
37
  * });
36
38
  */
37
- _createClass(DragPanHandler, [{
38
- key: "enable",
39
- value: function enable(options) {
40
- this.inertiaOptions = options || {};
41
- this.mousePan.enable();
42
- this.touchPan.enable();
43
- this.el.classList.add('l7-touch-drag-pan');
44
- }
39
+ enable(options) {
40
+ this.inertiaOptions = options || {};
41
+ this.mousePan.enable();
42
+ this.touchPan.enable();
43
+ this.el.classList.add('l7-touch-drag-pan');
44
+ }
45
45
 
46
- /**
47
- * Disables the "drag to pan" interaction.
48
- *
49
- * @example
50
- * map.dragPan.disable();
51
- */
52
- }, {
53
- key: "disable",
54
- value: function disable() {
55
- this.mousePan.disable();
56
- this.touchPan.disable();
57
- this.el.classList.remove('l7-touch-drag-pan');
58
- }
46
+ /**
47
+ * Disables the "drag to pan" interaction.
48
+ *
49
+ * @example
50
+ * map.dragPan.disable();
51
+ */
52
+ disable() {
53
+ this.mousePan.disable();
54
+ this.touchPan.disable();
55
+ this.el.classList.remove('l7-touch-drag-pan');
56
+ }
59
57
 
60
- /**
61
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
62
- *
63
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
64
- */
65
- }, {
66
- key: "isEnabled",
67
- value: function isEnabled() {
68
- return this.mousePan.isEnabled() && this.touchPan.isEnabled();
69
- }
58
+ /**
59
+ * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
60
+ *
61
+ * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
62
+ */
63
+ isEnabled() {
64
+ return this.mousePan.isEnabled() && this.touchPan.isEnabled();
65
+ }
70
66
 
71
- /**
72
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
73
- *
74
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
75
- */
76
- }, {
77
- key: "isActive",
78
- value: function isActive() {
79
- return this.mousePan.isActive() || this.touchPan.isActive();
80
- }
81
- }]);
82
- return DragPanHandler;
83
- }();
84
- export { DragPanHandler as default };
67
+ /**
68
+ * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
69
+ *
70
+ * @returns {boolean} `true` if the "drag to pan" interaction is active.
71
+ */
72
+ isActive() {
73
+ return this.mousePan.isActive() || this.touchPan.isActive();
74
+ }
75
+ }
@@ -1,10 +1,9 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  /**
4
3
  * The `DragRotateHandler` allows the user to rotate the map by clicking and
5
4
  * dragging the cursor while holding the right mouse button or `ctrl` key.
6
5
  */
7
- var DragRotateHandler = /*#__PURE__*/function () {
6
+ export default class DragRotateHandler {
8
7
  /**
9
8
  * @param {Object} [options]
10
9
  * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
@@ -12,8 +11,10 @@ var DragRotateHandler = /*#__PURE__*/function () {
12
11
  * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
13
12
  * @private
14
13
  */
15
- function DragRotateHandler(options, mouseRotate, mousePitch) {
16
- _classCallCheck(this, DragRotateHandler);
14
+ constructor(options, mouseRotate, mousePitch) {
15
+ _defineProperty(this, "mouseRotate", void 0);
16
+ _defineProperty(this, "mousePitch", void 0);
17
+ _defineProperty(this, "pitchWithRotate", void 0);
17
18
  this.pitchWithRotate = options.pitchWithRotate;
18
19
  this.mouseRotate = mouseRotate;
19
20
  this.mousePitch = mousePitch;
@@ -25,50 +26,39 @@ var DragRotateHandler = /*#__PURE__*/function () {
25
26
  * @example
26
27
  * map.dragRotate.enable();
27
28
  */
28
- _createClass(DragRotateHandler, [{
29
- key: "enable",
30
- value: function enable() {
31
- this.mouseRotate.enable();
32
- if (this.pitchWithRotate) {
33
- this.mousePitch.enable();
34
- }
29
+ enable() {
30
+ this.mouseRotate.enable();
31
+ if (this.pitchWithRotate) {
32
+ this.mousePitch.enable();
35
33
  }
34
+ }
36
35
 
37
- /**
38
- * Disables the "drag to rotate" interaction.
39
- *
40
- * @example
41
- * map.dragRotate.disable();
42
- */
43
- }, {
44
- key: "disable",
45
- value: function disable() {
46
- this.mouseRotate.disable();
47
- this.mousePitch.disable();
48
- }
36
+ /**
37
+ * Disables the "drag to rotate" interaction.
38
+ *
39
+ * @example
40
+ * map.dragRotate.disable();
41
+ */
42
+ disable() {
43
+ this.mouseRotate.disable();
44
+ this.mousePitch.disable();
45
+ }
49
46
 
50
- /**
51
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
52
- *
53
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
54
- */
55
- }, {
56
- key: "isEnabled",
57
- value: function isEnabled() {
58
- return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
59
- }
47
+ /**
48
+ * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
49
+ *
50
+ * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
51
+ */
52
+ isEnabled() {
53
+ return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
54
+ }
60
55
 
61
- /**
62
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
63
- *
64
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
65
- */
66
- }, {
67
- key: "isActive",
68
- value: function isActive() {
69
- return this.mouseRotate.isActive() || this.mousePitch.isActive();
70
- }
71
- }]);
72
- return DragRotateHandler;
73
- }();
74
- export { DragRotateHandler as default };
56
+ /**
57
+ * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
58
+ *
59
+ * @returns {boolean} `true` if the "drag to rotate" interaction is active.
60
+ */
61
+ isActive() {
62
+ return this.mouseRotate.isActive() || this.mousePitch.isActive();
63
+ }
64
+ }
@@ -1,5 +1,4 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  /**
4
3
  * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
5
4
  * pinching on a touchscreen.
@@ -7,12 +6,17 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
7
6
  * They can zoom with one finger by double tapping and dragging. On the second tap,
8
7
  * hold the finger down and drag up or down to zoom in or out.
9
8
  */
10
- var TouchZoomRotateHandler = /*#__PURE__*/function () {
9
+ export default class TouchZoomRotateHandler {
11
10
  /**
12
11
  * @private
13
12
  */
14
- function TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom) {
15
- _classCallCheck(this, TouchZoomRotateHandler);
13
+ constructor(el, touchZoom, touchRotate, tapDragZoom) {
14
+ _defineProperty(this, "el", void 0);
15
+ _defineProperty(this, "touchZoom", void 0);
16
+ _defineProperty(this, "touchRotate", void 0);
17
+ _defineProperty(this, "tapDragZoom", void 0);
18
+ _defineProperty(this, "rotationDisabled", void 0);
19
+ _defineProperty(this, "enabled", void 0);
16
20
  this.el = el;
17
21
  this.touchZoom = touchZoom;
18
22
  this.touchRotate = touchRotate;
@@ -32,84 +36,69 @@ var TouchZoomRotateHandler = /*#__PURE__*/function () {
32
36
  * @example
33
37
  * map.touchZoomRotate.enable({ around: 'center' });
34
38
  */
35
- _createClass(TouchZoomRotateHandler, [{
36
- key: "enable",
37
- value: function enable(options) {
38
- this.touchZoom.enable(options);
39
- if (!this.rotationDisabled) {
40
- this.touchRotate.enable(options);
41
- }
42
- this.tapDragZoom.enable();
43
- this.el.classList.add('l7-touch-zoom-rotate');
39
+ enable(options) {
40
+ this.touchZoom.enable(options);
41
+ if (!this.rotationDisabled) {
42
+ this.touchRotate.enable(options);
44
43
  }
44
+ this.tapDragZoom.enable();
45
+ this.el.classList.add('l7-touch-zoom-rotate');
46
+ }
45
47
 
46
- /**
47
- * Disables the "pinch to rotate and zoom" interaction.
48
- *
49
- * @example
50
- * map.touchZoomRotate.disable();
51
- */
52
- }, {
53
- key: "disable",
54
- value: function disable() {
55
- this.touchZoom.disable();
56
- this.touchRotate.disable();
57
- this.tapDragZoom.disable();
58
- this.el.classList.remove('l7-touch-zoom-rotate');
59
- }
48
+ /**
49
+ * Disables the "pinch to rotate and zoom" interaction.
50
+ *
51
+ * @example
52
+ * map.touchZoomRotate.disable();
53
+ */
54
+ disable() {
55
+ this.touchZoom.disable();
56
+ this.touchRotate.disable();
57
+ this.tapDragZoom.disable();
58
+ this.el.classList.remove('l7-touch-zoom-rotate');
59
+ }
60
60
 
61
- /**
62
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
63
- *
64
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
65
- */
66
- }, {
67
- key: "isEnabled",
68
- value: function isEnabled() {
69
- return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
70
- }
61
+ /**
62
+ * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
63
+ *
64
+ * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
65
+ */
66
+ isEnabled() {
67
+ return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
68
+ }
71
69
 
72
- /**
73
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
74
- *
75
- * @returns {boolean} //eslint-disable-line
76
- */
77
- }, {
78
- key: "isActive",
79
- value: function isActive() {
80
- return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
81
- }
70
+ /**
71
+ * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
72
+ *
73
+ * @returns {boolean} //eslint-disable-line
74
+ */
75
+ isActive() {
76
+ return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
77
+ }
82
78
 
83
- /**
84
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
85
- * interaction enabled.
86
- *
87
- * @example
88
- * map.touchZoomRotate.disableRotation();
89
- */
90
- }, {
91
- key: "disableRotation",
92
- value: function disableRotation() {
93
- this.rotationDisabled = true;
94
- this.touchRotate.disable();
95
- }
79
+ /**
80
+ * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
81
+ * interaction enabled.
82
+ *
83
+ * @example
84
+ * map.touchZoomRotate.disableRotation();
85
+ */
86
+ disableRotation() {
87
+ this.rotationDisabled = true;
88
+ this.touchRotate.disable();
89
+ }
96
90
 
97
- /**
98
- * Enables the "pinch to rotate" interaction.
99
- *
100
- * @example
101
- * map.touchZoomRotate.enable();
102
- * map.touchZoomRotate.enableRotation();
103
- */
104
- }, {
105
- key: "enableRotation",
106
- value: function enableRotation() {
107
- this.rotationDisabled = false;
108
- if (this.touchZoom.isEnabled()) {
109
- this.touchRotate.enable();
110
- }
91
+ /**
92
+ * Enables the "pinch to rotate" interaction.
93
+ *
94
+ * @example
95
+ * map.touchZoomRotate.enable();
96
+ * map.touchZoomRotate.enableRotation();
97
+ */
98
+ enableRotation() {
99
+ this.rotationDisabled = false;
100
+ if (this.touchZoom.isEnabled()) {
101
+ this.touchRotate.enable();
111
102
  }
112
- }]);
113
- return TouchZoomRotateHandler;
114
- }();
115
- export { TouchZoomRotateHandler as default };
103
+ }
104
+ }
@@ -1,97 +1,77 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- 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; } } }; }
4
- 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); }
5
- 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; }
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
2
  // @ts-ignore
7
3
  import Point from "../../geo/point";
8
4
  import { indexTouches } from "../handler_util";
9
5
  function getCentroid(points) {
10
- var sum = new Point(0, 0);
11
- var _iterator = _createForOfIteratorHelper(points),
12
- _step;
13
- try {
14
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
15
- var point = _step.value;
16
- sum._add(point);
17
- }
18
- // @ts-ignore
19
- } catch (err) {
20
- _iterator.e(err);
21
- } finally {
22
- _iterator.f();
6
+ const sum = new Point(0, 0);
7
+ for (const point of points) {
8
+ sum._add(point);
23
9
  }
10
+ // @ts-ignore
24
11
  return sum.div(points.length);
25
12
  }
26
- export var MAX_TAP_INTERVAL = 500;
27
- export var MAX_TOUCH_TIME = 500;
28
- export var MAX_DIST = 30;
29
- var SingleTapRecognizer = /*#__PURE__*/function () {
30
- function SingleTapRecognizer(options) {
31
- _classCallCheck(this, SingleTapRecognizer);
13
+ export const MAX_TAP_INTERVAL = 500;
14
+ export const MAX_TOUCH_TIME = 500;
15
+ export const MAX_DIST = 30;
16
+ export default class SingleTapRecognizer {
17
+ constructor(options) {
18
+ _defineProperty(this, "numTouches", void 0);
19
+ _defineProperty(this, "centroid", void 0);
20
+ _defineProperty(this, "startTime", void 0);
21
+ _defineProperty(this, "aborted", void 0);
22
+ _defineProperty(this, "touches", void 0);
32
23
  this.reset();
33
24
  this.numTouches = options.numTouches;
34
25
  }
35
- _createClass(SingleTapRecognizer, [{
36
- key: "reset",
37
- value: function reset() {
38
- // @ts-ignore
39
- delete this.centroid;
40
- // @ts-ignore
41
- delete this.startTime;
42
- // @ts-ignore
43
- delete this.touches;
44
- this.aborted = false;
26
+ reset() {
27
+ // @ts-ignore
28
+ delete this.centroid;
29
+ // @ts-ignore
30
+ delete this.startTime;
31
+ // @ts-ignore
32
+ delete this.touches;
33
+ this.aborted = false;
34
+ }
35
+ touchstart(e, points, mapTouches) {
36
+ if (this.centroid || mapTouches.length > this.numTouches) {
37
+ this.aborted = true;
45
38
  }
46
- }, {
47
- key: "touchstart",
48
- value: function touchstart(e, points, mapTouches) {
49
- if (this.centroid || mapTouches.length > this.numTouches) {
50
- this.aborted = true;
51
- }
52
- if (this.aborted) {
53
- return;
54
- }
55
- if (this.startTime === undefined) {
56
- this.startTime = e.timeStamp;
57
- }
58
- if (mapTouches.length === this.numTouches) {
59
- this.centroid = getCentroid(points);
60
- this.touches = indexTouches(mapTouches, points);
61
- }
39
+ if (this.aborted) {
40
+ return;
62
41
  }
63
- }, {
64
- key: "touchmove",
65
- value: function touchmove(e, points, mapTouches) {
66
- if (this.aborted || !this.centroid) {
67
- return;
68
- }
69
- var newTouches = indexTouches(mapTouches, points);
70
- for (var id in this.touches) {
71
- if (this.touches[id]) {
72
- var prevPos = this.touches[id];
73
- var pos = newTouches[id];
74
- if (!pos || pos.dist(prevPos) > MAX_DIST) {
75
- this.aborted = true;
76
- }
42
+ if (this.startTime === undefined) {
43
+ this.startTime = e.timeStamp;
44
+ }
45
+ if (mapTouches.length === this.numTouches) {
46
+ this.centroid = getCentroid(points);
47
+ this.touches = indexTouches(mapTouches, points);
48
+ }
49
+ }
50
+ touchmove(e, points, mapTouches) {
51
+ if (this.aborted || !this.centroid) {
52
+ return;
53
+ }
54
+ const newTouches = indexTouches(mapTouches, points);
55
+ for (const id in this.touches) {
56
+ if (this.touches[id]) {
57
+ const prevPos = this.touches[id];
58
+ const pos = newTouches[id];
59
+ if (!pos || pos.dist(prevPos) > MAX_DIST) {
60
+ this.aborted = true;
77
61
  }
78
62
  }
79
63
  }
80
- }, {
81
- key: "touchend",
82
- value: function touchend(e, points, mapTouches) {
83
- if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
84
- this.aborted = true;
85
- }
86
- if (mapTouches.length === 0) {
87
- var centroid = !this.aborted && this.centroid;
88
- this.reset();
89
- if (centroid) {
90
- return centroid;
91
- }
64
+ }
65
+ touchend(e, points, mapTouches) {
66
+ if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
67
+ this.aborted = true;
68
+ }
69
+ if (mapTouches.length === 0) {
70
+ const centroid = !this.aborted && this.centroid;
71
+ this.reset();
72
+ if (centroid) {
73
+ return centroid;
92
74
  }
93
75
  }
94
- }]);
95
- return SingleTapRecognizer;
96
- }();
97
- export { SingleTapRecognizer as default };
76
+ }
77
+ }