@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,96 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import { isMini } from '@antv/l7-utils';
4
-
5
- /**
6
- * The `DragPanHandler` allows the user to pan the map by clicking and dragging
7
- * the cursor.
8
- */
9
- var DragPanHandler = /*#__PURE__*/function () {
10
- /**
11
- * @private
12
- */
13
- function DragPanHandler(el, mousePan, touchPan) {
14
- _classCallCheck(this, DragPanHandler);
15
-
16
- this.el = el;
17
- this.mousePan = mousePan;
18
- this.touchPan = touchPan;
19
- }
20
- /**
21
- * Enables the "drag to pan" interaction.
22
- *
23
- * @param {Object} [options] Options object
24
- * @param {number} [options.linearity=0] factor used to scale the drag velocity
25
- * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.
26
- * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.
27
- * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.
28
- *
29
- * @example
30
- * map.dragPan.enable();
31
- * @example
32
- * map.dragPan.enable({
33
- * linearity: 0.3,
34
- * easing: bezier(0, 0, 0.3, 1),
35
- * maxSpeed: 1400,
36
- * deceleration: 2500,
37
- * });
38
- */
39
-
40
-
41
- _createClass(DragPanHandler, [{
42
- key: "enable",
43
- value: function enable(options) {
44
- this.inertiaOptions = options || {};
45
- this.mousePan.enable();
46
- this.touchPan.enable();
47
-
48
- if (!isMini) {
49
- this.el.classList.add('l7-touch-drag-pan');
50
- }
51
- }
52
- /**
53
- * Disables the "drag to pan" interaction.
54
- *
55
- * @example
56
- * map.dragPan.disable();
57
- */
58
-
59
- }, {
60
- key: "disable",
61
- value: function disable() {
62
- this.mousePan.disable();
63
- this.touchPan.disable();
64
-
65
- if (!isMini) {
66
- this.el.classList.remove('l7-touch-drag-pan');
67
- }
68
- }
69
- /**
70
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
71
- *
72
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
73
- */
74
-
75
- }, {
76
- key: "isEnabled",
77
- value: function isEnabled() {
78
- return this.mousePan.isEnabled() && this.touchPan.isEnabled();
79
- }
80
- /**
81
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
82
- *
83
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
84
- */
85
-
86
- }, {
87
- key: "isActive",
88
- value: function isActive() {
89
- return this.mousePan.isActive() || this.touchPan.isActive();
90
- }
91
- }]);
92
-
93
- return DragPanHandler;
94
- }();
95
-
96
- export { DragPanHandler as default };
@@ -1,46 +0,0 @@
1
- import { MousePitchHandler, MouseRotateHandler } from '../mouse';
2
- /**
3
- * The `DragRotateHandler` allows the user to rotate the map by clicking and
4
- * dragging the cursor while holding the right mouse button or `ctrl` key.
5
- */
6
- export default class DragRotateHandler {
7
- private mouseRotate;
8
- private mousePitch;
9
- private pitchWithRotate;
10
- /**
11
- * @param {Object} [options]
12
- * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
13
- * bearing will snap to north.
14
- * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
15
- * @private
16
- */
17
- constructor(options: {
18
- pitchWithRotate: boolean;
19
- }, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler);
20
- /**
21
- * Enables the "drag to rotate" interaction.
22
- *
23
- * @example
24
- * map.dragRotate.enable();
25
- */
26
- enable(): void;
27
- /**
28
- * Disables the "drag to rotate" interaction.
29
- *
30
- * @example
31
- * map.dragRotate.disable();
32
- */
33
- disable(): void;
34
- /**
35
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
36
- *
37
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
38
- */
39
- isEnabled(): boolean;
40
- /**
41
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
42
- *
43
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
44
- */
45
- isActive(): boolean;
46
- }
@@ -1,80 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
-
4
- /**
5
- * The `DragRotateHandler` allows the user to rotate the map by clicking and
6
- * dragging the cursor while holding the right mouse button or `ctrl` key.
7
- */
8
- var DragRotateHandler = /*#__PURE__*/function () {
9
- /**
10
- * @param {Object} [options]
11
- * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
12
- * bearing will snap to north.
13
- * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
14
- * @private
15
- */
16
- function DragRotateHandler(options, mouseRotate, mousePitch) {
17
- _classCallCheck(this, DragRotateHandler);
18
-
19
- this.pitchWithRotate = options.pitchWithRotate;
20
- this.mouseRotate = mouseRotate;
21
- this.mousePitch = mousePitch;
22
- }
23
- /**
24
- * Enables the "drag to rotate" interaction.
25
- *
26
- * @example
27
- * map.dragRotate.enable();
28
- */
29
-
30
-
31
- _createClass(DragRotateHandler, [{
32
- key: "enable",
33
- value: function enable() {
34
- this.mouseRotate.enable();
35
-
36
- if (this.pitchWithRotate) {
37
- this.mousePitch.enable();
38
- }
39
- }
40
- /**
41
- * Disables the "drag to rotate" interaction.
42
- *
43
- * @example
44
- * map.dragRotate.disable();
45
- */
46
-
47
- }, {
48
- key: "disable",
49
- value: function disable() {
50
- this.mouseRotate.disable();
51
- this.mousePitch.disable();
52
- }
53
- /**
54
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
55
- *
56
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
57
- */
58
-
59
- }, {
60
- key: "isEnabled",
61
- value: function isEnabled() {
62
- return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
63
- }
64
- /**
65
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
66
- *
67
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
68
- */
69
-
70
- }, {
71
- key: "isActive",
72
- value: function isActive() {
73
- return this.mouseRotate.isActive() || this.mousePitch.isActive();
74
- }
75
- }]);
76
-
77
- return DragRotateHandler;
78
- }();
79
-
80
- export { DragRotateHandler as default };
@@ -1,70 +0,0 @@
1
- import TapDragZoomHandler from '../tap/tap_drag_zoom';
2
- import { TouchRotateHandler, TouchZoomHandler } from '../touch';
3
- /**
4
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
5
- * pinching on a touchscreen.
6
- *
7
- * They can zoom with one finger by double tapping and dragging. On the second tap,
8
- * hold the finger down and drag up or down to zoom in or out.
9
- */
10
- export default class TouchZoomRotateHandler {
11
- private el;
12
- private touchZoom;
13
- private touchRotate;
14
- private tapDragZoom;
15
- private rotationDisabled;
16
- private enabled;
17
- /**
18
- * @private
19
- */
20
- constructor(el: HTMLElement, touchZoom: TouchZoomHandler, touchRotate: TouchRotateHandler, tapDragZoom: TapDragZoomHandler);
21
- /**
22
- * Enables the "pinch to rotate and zoom" interaction.
23
- *
24
- * @param {Object} [options] Options object.
25
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
26
- *
27
- * @example
28
- * map.touchZoomRotate.enable();
29
- * @example
30
- * map.touchZoomRotate.enable({ around: 'center' });
31
- */
32
- enable(options: {
33
- around?: 'center';
34
- }): void;
35
- /**
36
- * Disables the "pinch to rotate and zoom" interaction.
37
- *
38
- * @example
39
- * map.touchZoomRotate.disable();
40
- */
41
- disable(): void;
42
- /**
43
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
44
- *
45
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
46
- */
47
- isEnabled(): boolean;
48
- /**
49
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
50
- *
51
- * @returns {boolean} //eslint-disable-line
52
- */
53
- isActive(): boolean;
54
- /**
55
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
56
- * interaction enabled.
57
- *
58
- * @example
59
- * map.touchZoomRotate.disableRotation();
60
- */
61
- disableRotation(): void;
62
- /**
63
- * Enables the "pinch to rotate" interaction.
64
- *
65
- * @example
66
- * map.touchZoomRotate.enable();
67
- * map.touchZoomRotate.enableRotation();
68
- */
69
- enableRotation(): void;
70
- }
@@ -1,130 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import { isMini } from '@antv/l7-utils';
4
-
5
- /**
6
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
7
- * pinching on a touchscreen.
8
- *
9
- * They can zoom with one finger by double tapping and dragging. On the second tap,
10
- * hold the finger down and drag up or down to zoom in or out.
11
- */
12
- var TouchZoomRotateHandler = /*#__PURE__*/function () {
13
- /**
14
- * @private
15
- */
16
- function TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom) {
17
- _classCallCheck(this, TouchZoomRotateHandler);
18
-
19
- this.el = el;
20
- this.touchZoom = touchZoom;
21
- this.touchRotate = touchRotate;
22
- this.tapDragZoom = tapDragZoom;
23
- this.rotationDisabled = false;
24
- this.enabled = true;
25
- }
26
- /**
27
- * Enables the "pinch to rotate and zoom" interaction.
28
- *
29
- * @param {Object} [options] Options object.
30
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
31
- *
32
- * @example
33
- * map.touchZoomRotate.enable();
34
- * @example
35
- * map.touchZoomRotate.enable({ around: 'center' });
36
- */
37
-
38
-
39
- _createClass(TouchZoomRotateHandler, [{
40
- key: "enable",
41
- value: function enable(options) {
42
- this.touchZoom.enable(options);
43
-
44
- if (!this.rotationDisabled) {
45
- this.touchRotate.enable(options);
46
- }
47
-
48
- this.tapDragZoom.enable();
49
-
50
- if (!isMini) {
51
- this.el.classList.add('l7-touch-zoom-rotate');
52
- }
53
- }
54
- /**
55
- * Disables the "pinch to rotate and zoom" interaction.
56
- *
57
- * @example
58
- * map.touchZoomRotate.disable();
59
- */
60
-
61
- }, {
62
- key: "disable",
63
- value: function disable() {
64
- this.touchZoom.disable();
65
- this.touchRotate.disable();
66
- this.tapDragZoom.disable();
67
-
68
- if (!isMini) {
69
- this.el.classList.remove('l7-touch-zoom-rotate');
70
- }
71
- }
72
- /**
73
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
74
- *
75
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
76
- */
77
-
78
- }, {
79
- key: "isEnabled",
80
- value: function isEnabled() {
81
- return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
82
- }
83
- /**
84
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
85
- *
86
- * @returns {boolean} //eslint-disable-line
87
- */
88
-
89
- }, {
90
- key: "isActive",
91
- value: function isActive() {
92
- return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
93
- }
94
- /**
95
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
96
- * interaction enabled.
97
- *
98
- * @example
99
- * map.touchZoomRotate.disableRotation();
100
- */
101
-
102
- }, {
103
- key: "disableRotation",
104
- value: function disableRotation() {
105
- this.rotationDisabled = true;
106
- this.touchRotate.disable();
107
- }
108
- /**
109
- * Enables the "pinch to rotate" interaction.
110
- *
111
- * @example
112
- * map.touchZoomRotate.enable();
113
- * map.touchZoomRotate.enableRotation();
114
- */
115
-
116
- }, {
117
- key: "enableRotation",
118
- value: function enableRotation() {
119
- this.rotationDisabled = false;
120
-
121
- if (this.touchZoom.isEnabled()) {
122
- this.touchRotate.enable();
123
- }
124
- }
125
- }]);
126
-
127
- return TouchZoomRotateHandler;
128
- }();
129
-
130
- export { TouchZoomRotateHandler as default };
@@ -1,20 +0,0 @@
1
- import Point from '../../geo/point';
2
- export declare const MAX_TAP_INTERVAL = 500;
3
- export declare const MAX_TOUCH_TIME = 500;
4
- export declare const MAX_DIST = 30;
5
- export default class SingleTapRecognizer {
6
- numTouches: number;
7
- centroid: Point;
8
- startTime: number;
9
- aborted: boolean;
10
- touches: {
11
- [key: string]: Point;
12
- };
13
- constructor(options: {
14
- numTouches: number;
15
- });
16
- reset(): void;
17
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
18
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
19
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | undefined;
20
- }
@@ -1,120 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
-
4
- 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; } } }; }
5
-
6
- 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); }
7
-
8
- 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; }
9
-
10
- // @ts-ignore
11
- import Point from "../../geo/point";
12
- import { indexTouches } from "../handler_util";
13
-
14
- function getCentroid(points) {
15
- var sum = new Point(0, 0);
16
-
17
- var _iterator = _createForOfIteratorHelper(points),
18
- _step;
19
-
20
- try {
21
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
22
- var point = _step.value;
23
-
24
- sum._add(point);
25
- } // @ts-ignore
26
-
27
- } catch (err) {
28
- _iterator.e(err);
29
- } finally {
30
- _iterator.f();
31
- }
32
-
33
- return sum.div(points.length);
34
- }
35
-
36
- export var MAX_TAP_INTERVAL = 500;
37
- export var MAX_TOUCH_TIME = 500;
38
- export var MAX_DIST = 30;
39
-
40
- var SingleTapRecognizer = /*#__PURE__*/function () {
41
- function SingleTapRecognizer(options) {
42
- _classCallCheck(this, SingleTapRecognizer);
43
-
44
- this.reset();
45
- this.numTouches = options.numTouches;
46
- }
47
-
48
- _createClass(SingleTapRecognizer, [{
49
- key: "reset",
50
- value: function reset() {
51
- // @ts-ignore
52
- delete this.centroid; // @ts-ignore
53
-
54
- delete this.startTime; // @ts-ignore
55
-
56
- delete this.touches;
57
- this.aborted = false;
58
- }
59
- }, {
60
- key: "touchstart",
61
- value: function touchstart(e, points, mapTouches) {
62
- if (this.centroid || mapTouches.length > this.numTouches) {
63
- this.aborted = true;
64
- }
65
-
66
- if (this.aborted) {
67
- return;
68
- }
69
-
70
- if (this.startTime === undefined) {
71
- this.startTime = e.timeStamp;
72
- }
73
-
74
- if (mapTouches.length === this.numTouches) {
75
- this.centroid = getCentroid(points);
76
- this.touches = indexTouches(mapTouches, points);
77
- }
78
- }
79
- }, {
80
- key: "touchmove",
81
- value: function touchmove(e, points, mapTouches) {
82
- if (this.aborted || !this.centroid) {
83
- return;
84
- }
85
-
86
- var newTouches = indexTouches(mapTouches, points);
87
-
88
- for (var id in this.touches) {
89
- if (this.touches[id]) {
90
- var prevPos = this.touches[id];
91
- var pos = newTouches[id];
92
-
93
- if (!pos || pos.dist(prevPos) > MAX_DIST) {
94
- this.aborted = true;
95
- }
96
- }
97
- }
98
- }
99
- }, {
100
- key: "touchend",
101
- value: function touchend(e, points, mapTouches) {
102
- if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
103
- this.aborted = true;
104
- }
105
-
106
- if (mapTouches.length === 0) {
107
- var centroid = !this.aborted && this.centroid;
108
- this.reset();
109
-
110
- if (centroid) {
111
- return centroid;
112
- }
113
- }
114
- }
115
- }]);
116
-
117
- return SingleTapRecognizer;
118
- }();
119
-
120
- export { SingleTapRecognizer as default };
@@ -1,22 +0,0 @@
1
- import Point from '../../geo/point';
2
- import TapRecognizer from './tap_recognizer';
3
- export default class TapDragZoomHandler {
4
- enabled: boolean;
5
- active: boolean;
6
- swipePoint: Point;
7
- swipeTouch: number;
8
- tapTime: number;
9
- tap: TapRecognizer;
10
- constructor();
11
- reset(): void;
12
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
13
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
14
- zoomDelta: number;
15
- } | undefined;
16
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
17
- touchcancel(): void;
18
- enable(): void;
19
- disable(): void;
20
- isEnabled(): boolean;
21
- isActive(): boolean;
22
- }
@@ -1,114 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- // @ts-ignore
4
- import { MAX_TAP_INTERVAL } from "./single_tap_recognizer";
5
- import TapRecognizer from "./tap_recognizer";
6
-
7
- var TapDragZoomHandler = /*#__PURE__*/function () {
8
- function TapDragZoomHandler() {
9
- _classCallCheck(this, TapDragZoomHandler);
10
-
11
- this.tap = new TapRecognizer({
12
- numTouches: 1,
13
- numTaps: 1
14
- });
15
- this.reset();
16
- }
17
-
18
- _createClass(TapDragZoomHandler, [{
19
- key: "reset",
20
- value: function reset() {
21
- this.active = false; // @ts-ignore
22
-
23
- delete this.swipePoint; // @ts-ignore
24
-
25
- delete this.swipeTouch; // @ts-ignore
26
-
27
- delete this.tapTime;
28
- this.tap.reset();
29
- }
30
- }, {
31
- key: "touchstart",
32
- value: function touchstart(e, points, mapTouches) {
33
- if (this.swipePoint) {
34
- return;
35
- }
36
-
37
- if (this.tapTime && e.timeStamp - this.tapTime > MAX_TAP_INTERVAL) {
38
- this.reset();
39
- }
40
-
41
- if (!this.tapTime) {
42
- this.tap.touchstart(e, points, mapTouches);
43
- } else if (mapTouches.length > 0) {
44
- this.swipePoint = points[0];
45
- this.swipeTouch = mapTouches[0].identifier;
46
- }
47
- }
48
- }, {
49
- key: "touchmove",
50
- value: function touchmove(e, points, mapTouches) {
51
- if (!this.tapTime) {
52
- this.tap.touchmove(e, points, mapTouches);
53
- } else if (this.swipePoint) {
54
- if (mapTouches[0].identifier !== this.swipeTouch) {
55
- return;
56
- }
57
-
58
- var newSwipePoint = points[0];
59
- var dist = newSwipePoint.y - this.swipePoint.y;
60
- this.swipePoint = newSwipePoint;
61
- e.preventDefault();
62
- this.active = true;
63
- return {
64
- zoomDelta: dist / 128
65
- };
66
- }
67
- }
68
- }, {
69
- key: "touchend",
70
- value: function touchend(e, points, mapTouches) {
71
- if (!this.tapTime) {
72
- var point = this.tap.touchend(e, points, mapTouches);
73
-
74
- if (point) {
75
- this.tapTime = e.timeStamp;
76
- }
77
- } else if (this.swipePoint) {
78
- if (mapTouches.length === 0) {
79
- this.reset();
80
- }
81
- }
82
- }
83
- }, {
84
- key: "touchcancel",
85
- value: function touchcancel() {
86
- this.reset();
87
- }
88
- }, {
89
- key: "enable",
90
- value: function enable() {
91
- this.enabled = true;
92
- }
93
- }, {
94
- key: "disable",
95
- value: function disable() {
96
- this.enabled = false;
97
- this.reset();
98
- }
99
- }, {
100
- key: "isEnabled",
101
- value: function isEnabled() {
102
- return this.enabled;
103
- }
104
- }, {
105
- key: "isActive",
106
- value: function isActive() {
107
- return this.active;
108
- }
109
- }]);
110
-
111
- return TapDragZoomHandler;
112
- }();
113
-
114
- export { TapDragZoomHandler as default };