@antv/l7-map 2.25.6 → 2.25.7

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 (159) hide show
  1. package/package.json +2 -2
  2. package/es/index.d.ts +0 -5
  3. package/es/index.js +0 -4
  4. package/es/map/camera.d.ts +0 -690
  5. package/es/map/camera.js +0 -1138
  6. package/es/map/css/l7.css +0 -171
  7. package/es/map/events.d.ts +0 -384
  8. package/es/map/events.js +0 -231
  9. package/es/map/geo/edge_insets.d.ts +0 -97
  10. package/es/map/geo/edge_insets.js +0 -115
  11. package/es/map/geo/lng_lat.d.ts +0 -116
  12. package/es/map/geo/lng_lat.js +0 -159
  13. package/es/map/geo/lng_lat_bounds.d.ts +0 -217
  14. package/es/map/geo/lng_lat_bounds.js +0 -334
  15. package/es/map/geo/mercator_coordinate.d.ts +0 -113
  16. package/es/map/geo/mercator_coordinate.js +0 -142
  17. package/es/map/geo/transform.d.ts +0 -262
  18. package/es/map/geo/transform.js +0 -736
  19. package/es/map/handler/box_zoom.d.ts +0 -65
  20. package/es/map/handler/box_zoom.js +0 -145
  21. package/es/map/handler/click_zoom.d.ts +0 -24
  22. package/es/map/handler/click_zoom.js +0 -47
  23. package/es/map/handler/cooperative_gestures.d.ts +0 -40
  24. package/es/map/handler/cooperative_gestures.js +0 -94
  25. package/es/map/handler/drag_handler.d.ts +0 -88
  26. package/es/map/handler/drag_handler.js +0 -89
  27. package/es/map/handler/drag_move_state_manager.d.ts +0 -30
  28. package/es/map/handler/drag_move_state_manager.js +0 -94
  29. package/es/map/handler/handler_util.d.ts +0 -3
  30. package/es/map/handler/handler_util.js +0 -8
  31. package/es/map/handler/keyboard.d.ts +0 -88
  32. package/es/map/handler/keyboard.js +0 -197
  33. package/es/map/handler/map_event.d.ts +0 -46
  34. package/es/map/handler/map_event.js +0 -131
  35. package/es/map/handler/mouse.d.ts +0 -30
  36. package/es/map/handler/mouse.js +0 -85
  37. package/es/map/handler/one_finger_touch_drag.d.ts +0 -15
  38. package/es/map/handler/one_finger_touch_drag.js +0 -39
  39. package/es/map/handler/scroll_zoom.d.ts +0 -102
  40. package/es/map/handler/scroll_zoom.js +0 -312
  41. package/es/map/handler/shim/dblclick_zoom.d.ts +0 -44
  42. package/es/map/handler/shim/dblclick_zoom.js +0 -60
  43. package/es/map/handler/shim/drag_pan.d.ts +0 -79
  44. package/es/map/handler/shim/drag_pan.js +0 -77
  45. package/es/map/handler/shim/drag_rotate.d.ts +0 -54
  46. package/es/map/handler/shim/drag_rotate.js +0 -66
  47. package/es/map/handler/shim/two_fingers_touch.d.ts +0 -74
  48. package/es/map/handler/shim/two_fingers_touch.js +0 -106
  49. package/es/map/handler/tap_drag_zoom.d.ts +0 -28
  50. package/es/map/handler/tap_drag_zoom.js +0 -92
  51. package/es/map/handler/tap_recognizer.d.ts +0 -35
  52. package/es/map/handler/tap_recognizer.js +0 -107
  53. package/es/map/handler/tap_zoom.d.ts +0 -28
  54. package/es/map/handler/tap_zoom.js +0 -87
  55. package/es/map/handler/touch_pan.d.ts +0 -40
  56. package/es/map/handler/touch_pan.js +0 -85
  57. package/es/map/handler/transform-provider.d.ts +0 -23
  58. package/es/map/handler/transform-provider.js +0 -35
  59. package/es/map/handler/two_fingers_touch.d.ts +0 -107
  60. package/es/map/handler/two_fingers_touch.js +0 -289
  61. package/es/map/handler_inertia.d.ts +0 -20
  62. package/es/map/handler_inertia.js +0 -128
  63. package/es/map/handler_manager.d.ts +0 -154
  64. package/es/map/handler_manager.js +0 -466
  65. package/es/map/map.d.ts +0 -637
  66. package/es/map/map.js +0 -984
  67. package/es/map/util/abort_error.d.ts +0 -15
  68. package/es/map/util/abort_error.js +0 -21
  69. package/es/map/util/browser.d.ts +0 -10
  70. package/es/map/util/browser.js +0 -30
  71. package/es/map/util/dom.d.ts +0 -30
  72. package/es/map/util/dom.js +0 -105
  73. package/es/map/util/evented.d.ts +0 -75
  74. package/es/map/util/evented.js +0 -158
  75. package/es/map/util/simpleMapCoord.d.ts +0 -31
  76. package/es/map/util/simpleMapCoord.js +0 -54
  77. package/es/map/util/task_queue.d.ts +0 -18
  78. package/es/map/util/task_queue.js +0 -54
  79. package/es/map/util/util.d.ts +0 -104
  80. package/es/map/util/util.js +0 -155
  81. package/lib/index.d.ts +0 -5
  82. package/lib/index.js +0 -33
  83. package/lib/map/camera.d.ts +0 -690
  84. package/lib/map/camera.js +0 -1145
  85. package/lib/map/css/l7.css +0 -171
  86. package/lib/map/events.d.ts +0 -384
  87. package/lib/map/events.js +0 -240
  88. package/lib/map/geo/edge_insets.d.ts +0 -97
  89. package/lib/map/geo/edge_insets.js +0 -122
  90. package/lib/map/geo/lng_lat.d.ts +0 -116
  91. package/lib/map/geo/lng_lat.js +0 -166
  92. package/lib/map/geo/lng_lat_bounds.d.ts +0 -217
  93. package/lib/map/geo/lng_lat_bounds.js +0 -341
  94. package/lib/map/geo/mercator_coordinate.d.ts +0 -113
  95. package/lib/map/geo/mercator_coordinate.js +0 -157
  96. package/lib/map/geo/transform.d.ts +0 -262
  97. package/lib/map/geo/transform.js +0 -744
  98. package/lib/map/handler/box_zoom.d.ts +0 -65
  99. package/lib/map/handler/box_zoom.js +0 -153
  100. package/lib/map/handler/click_zoom.d.ts +0 -24
  101. package/lib/map/handler/click_zoom.js +0 -54
  102. package/lib/map/handler/cooperative_gestures.d.ts +0 -40
  103. package/lib/map/handler/cooperative_gestures.js +0 -101
  104. package/lib/map/handler/drag_handler.d.ts +0 -88
  105. package/lib/map/handler/drag_handler.js +0 -97
  106. package/lib/map/handler/drag_move_state_manager.d.ts +0 -30
  107. package/lib/map/handler/drag_move_state_manager.js +0 -103
  108. package/lib/map/handler/handler_util.d.ts +0 -3
  109. package/lib/map/handler/handler_util.js +0 -14
  110. package/lib/map/handler/keyboard.d.ts +0 -88
  111. package/lib/map/handler/keyboard.js +0 -205
  112. package/lib/map/handler/map_event.d.ts +0 -46
  113. package/lib/map/handler/map_event.js +0 -140
  114. package/lib/map/handler/mouse.d.ts +0 -30
  115. package/lib/map/handler/mouse.js +0 -93
  116. package/lib/map/handler/one_finger_touch_drag.d.ts +0 -15
  117. package/lib/map/handler/one_finger_touch_drag.js +0 -47
  118. package/lib/map/handler/scroll_zoom.d.ts +0 -102
  119. package/lib/map/handler/scroll_zoom.js +0 -320
  120. package/lib/map/handler/shim/dblclick_zoom.d.ts +0 -44
  121. package/lib/map/handler/shim/dblclick_zoom.js +0 -68
  122. package/lib/map/handler/shim/drag_pan.d.ts +0 -79
  123. package/lib/map/handler/shim/drag_pan.js +0 -85
  124. package/lib/map/handler/shim/drag_rotate.d.ts +0 -54
  125. package/lib/map/handler/shim/drag_rotate.js +0 -74
  126. package/lib/map/handler/shim/two_fingers_touch.d.ts +0 -74
  127. package/lib/map/handler/shim/two_fingers_touch.js +0 -114
  128. package/lib/map/handler/tap_drag_zoom.d.ts +0 -28
  129. package/lib/map/handler/tap_drag_zoom.js +0 -99
  130. package/lib/map/handler/tap_recognizer.d.ts +0 -35
  131. package/lib/map/handler/tap_recognizer.js +0 -116
  132. package/lib/map/handler/tap_zoom.d.ts +0 -28
  133. package/lib/map/handler/tap_zoom.js +0 -94
  134. package/lib/map/handler/touch_pan.d.ts +0 -40
  135. package/lib/map/handler/touch_pan.js +0 -92
  136. package/lib/map/handler/transform-provider.d.ts +0 -23
  137. package/lib/map/handler/transform-provider.js +0 -43
  138. package/lib/map/handler/two_fingers_touch.d.ts +0 -107
  139. package/lib/map/handler/two_fingers_touch.js +0 -296
  140. package/lib/map/handler_inertia.d.ts +0 -20
  141. package/lib/map/handler_inertia.js +0 -136
  142. package/lib/map/handler_manager.d.ts +0 -154
  143. package/lib/map/handler_manager.js +0 -474
  144. package/lib/map/map.d.ts +0 -637
  145. package/lib/map/map.js +0 -991
  146. package/lib/map/util/abort_error.d.ts +0 -15
  147. package/lib/map/util/abort_error.js +0 -29
  148. package/lib/map/util/browser.d.ts +0 -10
  149. package/lib/map/util/browser.js +0 -36
  150. package/lib/map/util/dom.d.ts +0 -30
  151. package/lib/map/util/dom.js +0 -113
  152. package/lib/map/util/evented.d.ts +0 -75
  153. package/lib/map/util/evented.js +0 -167
  154. package/lib/map/util/simpleMapCoord.d.ts +0 -31
  155. package/lib/map/util/simpleMapCoord.js +0 -62
  156. package/lib/map/util/task_queue.d.ts +0 -18
  157. package/lib/map/util/task_queue.js +0 -62
  158. package/lib/map/util/util.d.ts +0 -104
  159. package/lib/map/util/util.js +0 -171
@@ -1,79 +0,0 @@
1
- import type { MousePanHandler } from '../mouse';
2
- import type { TouchPanHandler } from '../touch_pan';
3
- /**
4
- * A {@link DragPanHandler} options object
5
- */
6
- export type DragPanOptions = {
7
- /**
8
- * factor used to scale the drag velocity
9
- * @defaultValue 0
10
- */
11
- linearity?: number;
12
- /**
13
- * easing function applied to `map.panTo` when applying the drag.
14
- * @param t - the easing function
15
- * @defaultValue bezier(0, 0, 0.3, 1)
16
- */
17
- easing?: (t: number) => number;
18
- /**
19
- * the maximum value of the drag velocity.
20
- * @defaultValue 1400
21
- */
22
- deceleration?: number;
23
- /**
24
- * the rate at which the speed reduces after the pan ends.
25
- * @defaultValue 2500
26
- */
27
- maxSpeed?: number;
28
- };
29
- /**
30
- * The `DragPanHandler` allows the user to pan the map by clicking and dragging
31
- * the cursor.
32
- *
33
- * @group Handlers
34
- */
35
- export declare class DragPanHandler {
36
- _el: HTMLElement;
37
- _mousePan: MousePanHandler;
38
- _touchPan: TouchPanHandler;
39
- _inertiaOptions: DragPanOptions | boolean;
40
- /** @internal */
41
- constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler);
42
- /**
43
- * Enables the "drag to pan" interaction.
44
- *
45
- * @param options - Options object
46
- * @example
47
- * ```ts
48
- * map.dragPan.enable();
49
- * map.dragPan.enable({
50
- * linearity: 0.3,
51
- * easing: bezier(0, 0, 0.3, 1),
52
- * maxSpeed: 1400,
53
- * deceleration: 2500,
54
- * });
55
- * ```
56
- */
57
- enable(options?: DragPanOptions | boolean): void;
58
- /**
59
- * Disables the "drag to pan" interaction.
60
- *
61
- * @example
62
- * ```ts
63
- * map.dragPan.disable();
64
- * ```
65
- */
66
- disable(): void;
67
- /**
68
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
69
- *
70
- * @returns `true` if the "drag to pan" interaction is enabled.
71
- */
72
- isEnabled(): boolean;
73
- /**
74
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
75
- *
76
- * @returns `true` if the "drag to pan" interaction is active.
77
- */
78
- isActive(): boolean;
79
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DragPanHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- /**
10
- * A {@link DragPanHandler} options object
11
- */
12
-
13
- /**
14
- * The `DragPanHandler` allows the user to pan the map by clicking and dragging
15
- * the cursor.
16
- *
17
- * @group Handlers
18
- */
19
- class DragPanHandler {
20
- /** @internal */
21
- constructor(el, mousePan, touchPan) {
22
- (0, _defineProperty2.default)(this, "_el", void 0);
23
- (0, _defineProperty2.default)(this, "_mousePan", void 0);
24
- (0, _defineProperty2.default)(this, "_touchPan", void 0);
25
- (0, _defineProperty2.default)(this, "_inertiaOptions", void 0);
26
- this._el = el;
27
- this._mousePan = mousePan;
28
- this._touchPan = touchPan;
29
- }
30
-
31
- /**
32
- * Enables the "drag to pan" interaction.
33
- *
34
- * @param options - Options object
35
- * @example
36
- * ```ts
37
- * map.dragPan.enable();
38
- * map.dragPan.enable({
39
- * linearity: 0.3,
40
- * easing: bezier(0, 0, 0.3, 1),
41
- * maxSpeed: 1400,
42
- * deceleration: 2500,
43
- * });
44
- * ```
45
- */
46
- enable(options) {
47
- this._inertiaOptions = options || {};
48
- this._mousePan.enable();
49
- this._touchPan.enable();
50
- this._el.classList.add('l7-touch-drag-pan');
51
- }
52
-
53
- /**
54
- * Disables the "drag to pan" interaction.
55
- *
56
- * @example
57
- * ```ts
58
- * map.dragPan.disable();
59
- * ```
60
- */
61
- disable() {
62
- this._mousePan.disable();
63
- this._touchPan.disable();
64
- this._el.classList.remove('l7-touch-drag-pan');
65
- }
66
-
67
- /**
68
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
69
- *
70
- * @returns `true` if the "drag to pan" interaction is enabled.
71
- */
72
- isEnabled() {
73
- return this._mousePan.isEnabled() && this._touchPan.isEnabled();
74
- }
75
-
76
- /**
77
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
78
- *
79
- * @returns `true` if the "drag to pan" interaction is active.
80
- */
81
- isActive() {
82
- return this._mousePan.isActive() || this._touchPan.isActive();
83
- }
84
- }
85
- exports.DragPanHandler = DragPanHandler;
@@ -1,54 +0,0 @@
1
- import type { MousePitchHandler, MouseRotateHandler } from '../mouse';
2
- /**
3
- * Options object for `DragRotateHandler`.
4
- */
5
- export type DragRotateHandlerOptions = {
6
- /**
7
- * Control the map pitch in addition to the bearing
8
- * @defaultValue true
9
- */
10
- pitchWithRotate: boolean;
11
- };
12
- /**
13
- * The `DragRotateHandler` allows the user to rotate the map by clicking and
14
- * dragging the cursor while holding the right mouse button or `ctrl` key.
15
- *
16
- * @group Handlers
17
- */
18
- export declare class DragRotateHandler {
19
- _mouseRotate: MouseRotateHandler;
20
- _mousePitch: MousePitchHandler;
21
- _pitchWithRotate: boolean;
22
- /** @internal */
23
- constructor(options: DragRotateHandlerOptions, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler);
24
- /**
25
- * Enables the "drag to rotate" interaction.
26
- *
27
- * @example
28
- * ```ts
29
- * map.dragRotate.enable();
30
- * ```
31
- */
32
- enable(): void;
33
- /**
34
- * Disables the "drag to rotate" interaction.
35
- *
36
- * @example
37
- * ```ts
38
- * map.dragRotate.disable();
39
- * ```
40
- */
41
- disable(): void;
42
- /**
43
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
44
- *
45
- * @returns `true` if the "drag to rotate" interaction is enabled.
46
- */
47
- isEnabled(): boolean;
48
- /**
49
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
50
- *
51
- * @returns `true` if the "drag to rotate" interaction is active.
52
- */
53
- isActive(): boolean;
54
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DragRotateHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- /**
10
- * Options object for `DragRotateHandler`.
11
- */
12
-
13
- /**
14
- * The `DragRotateHandler` allows the user to rotate the map by clicking and
15
- * dragging the cursor while holding the right mouse button or `ctrl` key.
16
- *
17
- * @group Handlers
18
- */
19
- class DragRotateHandler {
20
- /** @internal */
21
- constructor(options, mouseRotate, mousePitch) {
22
- (0, _defineProperty2.default)(this, "_mouseRotate", void 0);
23
- (0, _defineProperty2.default)(this, "_mousePitch", void 0);
24
- (0, _defineProperty2.default)(this, "_pitchWithRotate", void 0);
25
- this._pitchWithRotate = options.pitchWithRotate;
26
- this._mouseRotate = mouseRotate;
27
- this._mousePitch = mousePitch;
28
- }
29
-
30
- /**
31
- * Enables the "drag to rotate" interaction.
32
- *
33
- * @example
34
- * ```ts
35
- * map.dragRotate.enable();
36
- * ```
37
- */
38
- enable() {
39
- this._mouseRotate.enable();
40
- if (this._pitchWithRotate) this._mousePitch.enable();
41
- }
42
-
43
- /**
44
- * Disables the "drag to rotate" interaction.
45
- *
46
- * @example
47
- * ```ts
48
- * map.dragRotate.disable();
49
- * ```
50
- */
51
- disable() {
52
- this._mouseRotate.disable();
53
- this._mousePitch.disable();
54
- }
55
-
56
- /**
57
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
58
- *
59
- * @returns `true` if the "drag to rotate" interaction is enabled.
60
- */
61
- isEnabled() {
62
- return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled());
63
- }
64
-
65
- /**
66
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
67
- *
68
- * @returns `true` if the "drag to rotate" interaction is active.
69
- */
70
- isActive() {
71
- return this._mouseRotate.isActive() || this._mousePitch.isActive();
72
- }
73
- }
74
- exports.DragRotateHandler = DragRotateHandler;
@@ -1,74 +0,0 @@
1
- import type { TapDragZoomHandler } from '../tap_drag_zoom';
2
- import type { AroundCenterOptions, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler } from '../two_fingers_touch';
3
- /**
4
- * The `TwoFingersTouchZoomRotateHandler` 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
- * @group Handlers
11
- */
12
- export declare class TwoFingersTouchZoomRotateHandler {
13
- _el: HTMLElement;
14
- _touchZoom: TwoFingersTouchZoomHandler;
15
- _touchRotate: TwoFingersTouchRotateHandler;
16
- _tapDragZoom: TapDragZoomHandler;
17
- _rotationDisabled: boolean;
18
- _enabled: boolean;
19
- /** @internal */
20
- constructor(el: HTMLElement, touchZoom: TwoFingersTouchZoomHandler, touchRotate: TwoFingersTouchRotateHandler, tapDragZoom: TapDragZoomHandler);
21
- /**
22
- * Enables the "pinch to rotate and zoom" interaction.
23
- *
24
- * @param options - Options object.
25
- *
26
- * @example
27
- * ```ts
28
- * map.touchZoomRotate.enable();
29
- * map.touchZoomRotate.enable({ around: 'center' });
30
- * ```
31
- */
32
- enable(options?: AroundCenterOptions | boolean | null): void;
33
- /**
34
- * Disables the "pinch to rotate and zoom" interaction.
35
- *
36
- * @example
37
- * ```ts
38
- * map.touchZoomRotate.disable();
39
- * ```
40
- */
41
- disable(): void;
42
- /**
43
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
44
- *
45
- * @returns `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 `true` if the handler is active, `false` otherwise
52
- */
53
- isActive(): boolean;
54
- /**
55
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
56
- * interaction enabled.
57
- *
58
- * @example
59
- * ```ts
60
- * map.touchZoomRotate.disableRotation();
61
- * ```
62
- */
63
- disableRotation(): void;
64
- /**
65
- * Enables the "pinch to rotate" interaction.
66
- *
67
- * @example
68
- * ```ts
69
- * map.touchZoomRotate.enable();
70
- * map.touchZoomRotate.enableRotation();
71
- * ```
72
- */
73
- enableRotation(): void;
74
- }
@@ -1,114 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.TwoFingersTouchZoomRotateHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- /**
10
- * The `TwoFingersTouchZoomRotateHandler` allows the user to zoom and rotate the map by
11
- * pinching on a touchscreen.
12
- *
13
- * They can zoom with one finger by double tapping and dragging. On the second tap,
14
- * hold the finger down and drag up or down to zoom in or out.
15
- *
16
- * @group Handlers
17
- */
18
- class TwoFingersTouchZoomRotateHandler {
19
- /** @internal */
20
- constructor(el, touchZoom, touchRotate, tapDragZoom) {
21
- (0, _defineProperty2.default)(this, "_el", void 0);
22
- (0, _defineProperty2.default)(this, "_touchZoom", void 0);
23
- (0, _defineProperty2.default)(this, "_touchRotate", void 0);
24
- (0, _defineProperty2.default)(this, "_tapDragZoom", void 0);
25
- (0, _defineProperty2.default)(this, "_rotationDisabled", void 0);
26
- (0, _defineProperty2.default)(this, "_enabled", void 0);
27
- this._el = el;
28
- this._touchZoom = touchZoom;
29
- this._touchRotate = touchRotate;
30
- this._tapDragZoom = tapDragZoom;
31
- this._rotationDisabled = false;
32
- this._enabled = true;
33
- }
34
-
35
- /**
36
- * Enables the "pinch to rotate and zoom" interaction.
37
- *
38
- * @param options - Options object.
39
- *
40
- * @example
41
- * ```ts
42
- * map.touchZoomRotate.enable();
43
- * map.touchZoomRotate.enable({ around: 'center' });
44
- * ```
45
- */
46
- enable(options) {
47
- this._touchZoom.enable(options);
48
- if (!this._rotationDisabled) this._touchRotate.enable(options);
49
- this._tapDragZoom.enable();
50
- this._el.classList.add('l7-touch-zoom-rotate');
51
- }
52
-
53
- /**
54
- * Disables the "pinch to rotate and zoom" interaction.
55
- *
56
- * @example
57
- * ```ts
58
- * map.touchZoomRotate.disable();
59
- * ```
60
- */
61
- disable() {
62
- this._touchZoom.disable();
63
- this._touchRotate.disable();
64
- this._tapDragZoom.disable();
65
- this._el.classList.remove('l7-touch-zoom-rotate');
66
- }
67
-
68
- /**
69
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
70
- *
71
- * @returns `true` if the "pinch to rotate and zoom" interaction is enabled.
72
- */
73
- isEnabled() {
74
- return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled();
75
- }
76
-
77
- /**
78
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
79
- *
80
- * @returns `true` if the handler is active, `false` otherwise
81
- */
82
- isActive() {
83
- return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive();
84
- }
85
-
86
- /**
87
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
88
- * interaction enabled.
89
- *
90
- * @example
91
- * ```ts
92
- * map.touchZoomRotate.disableRotation();
93
- * ```
94
- */
95
- disableRotation() {
96
- this._rotationDisabled = true;
97
- this._touchRotate.disable();
98
- }
99
-
100
- /**
101
- * Enables the "pinch to rotate" interaction.
102
- *
103
- * @example
104
- * ```ts
105
- * map.touchZoomRotate.enable();
106
- * map.touchZoomRotate.enableRotation();
107
- * ```
108
- */
109
- enableRotation() {
110
- this._rotationDisabled = false;
111
- if (this._touchZoom.isEnabled()) this._touchRotate.enable();
112
- }
113
- }
114
- exports.TwoFingersTouchZoomRotateHandler = TwoFingersTouchZoomRotateHandler;
@@ -1,28 +0,0 @@
1
- /// <reference types="mapbox__point-geometry" />
2
- import type Point from '@mapbox/point-geometry';
3
- import type { Handler } from '../handler_manager';
4
- import { TapRecognizer } from './tap_recognizer';
5
- /**
6
- * A `TapDragZoomHandler` allows the user to zoom the map at a point by double tapping. It also allows the user pan the map by dragging.
7
- */
8
- export declare class TapDragZoomHandler implements Handler {
9
- _enabled: boolean;
10
- _active: boolean;
11
- _swipePoint: Point;
12
- _swipeTouch: number;
13
- _tapTime: number;
14
- _tapPoint: Point;
15
- _tap: TapRecognizer;
16
- constructor();
17
- reset(): void;
18
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
19
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): {
20
- zoomDelta: number;
21
- };
22
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
23
- touchcancel(): void;
24
- enable(): void;
25
- disable(): void;
26
- isEnabled(): boolean;
27
- isActive(): boolean;
28
- }
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.TapDragZoomHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _tap_recognizer = require("./tap_recognizer");
10
- /**
11
- * A `TapDragZoomHandler` allows the user to zoom the map at a point by double tapping. It also allows the user pan the map by dragging.
12
- */
13
- class TapDragZoomHandler {
14
- constructor() {
15
- (0, _defineProperty2.default)(this, "_enabled", void 0);
16
- (0, _defineProperty2.default)(this, "_active", void 0);
17
- (0, _defineProperty2.default)(this, "_swipePoint", void 0);
18
- (0, _defineProperty2.default)(this, "_swipeTouch", void 0);
19
- (0, _defineProperty2.default)(this, "_tapTime", void 0);
20
- (0, _defineProperty2.default)(this, "_tapPoint", void 0);
21
- (0, _defineProperty2.default)(this, "_tap", void 0);
22
- this._tap = new _tap_recognizer.TapRecognizer({
23
- numTouches: 1,
24
- numTaps: 1
25
- });
26
- this.reset();
27
- }
28
- reset() {
29
- this._active = false;
30
- delete this._swipePoint;
31
- delete this._swipeTouch;
32
- delete this._tapTime;
33
- delete this._tapPoint;
34
- this._tap.reset();
35
- }
36
- touchstart(e, points, mapTouches) {
37
- if (this._swipePoint) return;
38
- if (!this._tapTime) {
39
- this._tap.touchstart(e, points, mapTouches);
40
- } else {
41
- const swipePoint = points[0];
42
- const soonEnough = e.timeStamp - this._tapTime < _tap_recognizer.MAX_TAP_INTERVAL;
43
- const closeEnough = this._tapPoint.dist(swipePoint) < _tap_recognizer.MAX_DIST;
44
- if (!soonEnough || !closeEnough) {
45
- this.reset();
46
- } else if (mapTouches.length > 0) {
47
- this._swipePoint = swipePoint;
48
- this._swipeTouch = mapTouches[0].identifier;
49
- }
50
- }
51
- }
52
- touchmove(e, points, mapTouches) {
53
- if (!this._tapTime) {
54
- this._tap.touchmove(e, points, mapTouches);
55
- } else if (this._swipePoint) {
56
- if (mapTouches[0].identifier !== this._swipeTouch) {
57
- return;
58
- }
59
- const newSwipePoint = points[0];
60
- const dist = newSwipePoint.y - this._swipePoint.y;
61
- this._swipePoint = newSwipePoint;
62
- e.preventDefault();
63
- this._active = true;
64
- return {
65
- zoomDelta: dist / 128
66
- };
67
- }
68
- }
69
- touchend(e, points, mapTouches) {
70
- if (!this._tapTime) {
71
- const point = this._tap.touchend(e, points, mapTouches);
72
- if (point) {
73
- this._tapTime = e.timeStamp;
74
- this._tapPoint = point;
75
- }
76
- } else if (this._swipePoint) {
77
- if (mapTouches.length === 0) {
78
- this.reset();
79
- }
80
- }
81
- }
82
- touchcancel() {
83
- this.reset();
84
- }
85
- enable() {
86
- this._enabled = true;
87
- }
88
- disable() {
89
- this._enabled = false;
90
- this.reset();
91
- }
92
- isEnabled() {
93
- return this._enabled;
94
- }
95
- isActive() {
96
- return this._active;
97
- }
98
- }
99
- exports.TapDragZoomHandler = TapDragZoomHandler;
@@ -1,35 +0,0 @@
1
- /// <reference types="mapbox__point-geometry" />
2
- import Point from '@mapbox/point-geometry';
3
- export declare const MAX_TAP_INTERVAL = 500;
4
- export declare const MAX_DIST = 30;
5
- export declare class SingleTapRecognizer {
6
- numTouches: number;
7
- centroid: Point;
8
- startTime: number;
9
- aborted: boolean;
10
- touches: {
11
- [k in number | string]: Point;
12
- };
13
- constructor(options: {
14
- numTouches: number;
15
- });
16
- reset(): void;
17
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
18
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
19
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): Point;
20
- }
21
- export declare class TapRecognizer {
22
- singleTap: SingleTapRecognizer;
23
- numTaps: number;
24
- lastTime: number;
25
- lastTap: Point;
26
- count: number;
27
- constructor(options: {
28
- numTaps: number;
29
- numTouches: number;
30
- });
31
- reset(): void;
32
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
33
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
34
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): Point;
35
- }