@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
@@ -5,18 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  /**
11
10
  * The `DoubleClickZoomHandler` allows the user to zoom the map at a point by
12
11
  * double clicking or double tapping.
13
12
  */
14
- var DoubleClickZoomHandler = exports.default = /*#__PURE__*/function () {
13
+ class DoubleClickZoomHandler {
15
14
  /**
16
15
  * @private
17
16
  */
18
- function DoubleClickZoomHandler(clickZoom, TapZoom) {
19
- (0, _classCallCheck2.default)(this, DoubleClickZoomHandler);
17
+ constructor(clickZoom, TapZoom) {
18
+ (0, _defineProperty2.default)(this, "clickZoom", void 0);
19
+ (0, _defineProperty2.default)(this, "tapZoom", void 0);
20
20
  this.clickZoom = clickZoom;
21
21
  this.tapZoom = TapZoom;
22
22
  }
@@ -27,47 +27,38 @@ var DoubleClickZoomHandler = exports.default = /*#__PURE__*/function () {
27
27
  * @example
28
28
  * map.doubleClickZoom.enable();
29
29
  */
30
- (0, _createClass2.default)(DoubleClickZoomHandler, [{
31
- key: "enable",
32
- value: function enable() {
33
- this.clickZoom.enable();
34
- this.tapZoom.enable();
35
- }
30
+ enable() {
31
+ this.clickZoom.enable();
32
+ this.tapZoom.enable();
33
+ }
36
34
 
37
- /**
38
- * Disables the "double click to zoom" interaction.
39
- *
40
- * @example
41
- * map.doubleClickZoom.disable();
42
- */
43
- }, {
44
- key: "disable",
45
- value: function disable() {
46
- this.clickZoom.disable();
47
- this.tapZoom.disable();
48
- }
35
+ /**
36
+ * Disables the "double click to zoom" interaction.
37
+ *
38
+ * @example
39
+ * map.doubleClickZoom.disable();
40
+ */
41
+ disable() {
42
+ this.clickZoom.disable();
43
+ this.tapZoom.disable();
44
+ }
49
45
 
50
- /**
51
- * Returns a Boolean indicating whether the "double click to zoom" interaction is enabled.
52
- *
53
- * @returns {boolean} `true` if the "double click to zoom" interaction is enabled.
54
- */
55
- }, {
56
- key: "isEnabled",
57
- value: function isEnabled() {
58
- return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
59
- }
46
+ /**
47
+ * Returns a Boolean indicating whether the "double click to zoom" interaction is enabled.
48
+ *
49
+ * @returns {boolean} `true` if the "double click to zoom" interaction is enabled.
50
+ */
51
+ isEnabled() {
52
+ return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
53
+ }
60
54
 
61
- /**
62
- * Returns a Boolean indicating whether the "double click to zoom" interaction is active, i.e. currently being used.
63
- *
64
- * @returns {boolean} `true` if the "double click to zoom" interaction is active.
65
- */
66
- }, {
67
- key: "isActive",
68
- value: function isActive() {
69
- return this.clickZoom.isActive() || this.tapZoom.isActive();
70
- }
71
- }]);
72
- return DoubleClickZoomHandler;
73
- }();
55
+ /**
56
+ * Returns a Boolean indicating whether the "double click to zoom" interaction is active, i.e. currently being used.
57
+ *
58
+ * @returns {boolean} `true` if the "double click to zoom" interaction is active.
59
+ */
60
+ isActive() {
61
+ return this.clickZoom.isActive() || this.tapZoom.isActive();
62
+ }
63
+ }
64
+ exports.default = DoubleClickZoomHandler;
@@ -0,0 +1,61 @@
1
+ import type { MousePanHandler } from '../mouse/';
2
+ import type { TouchPanHandler } from '../touch/';
3
+ export interface IDragPanOptions {
4
+ linearity?: number;
5
+ easing?: (t: number) => number;
6
+ deceleration?: number;
7
+ maxSpeed?: number;
8
+ }
9
+ /**
10
+ * The `DragPanHandler` allows the user to pan the map by clicking and dragging
11
+ * the cursor.
12
+ */
13
+ export default class DragPanHandler {
14
+ inertiaOptions: IDragPanOptions;
15
+ private el;
16
+ private mousePan;
17
+ private touchPan;
18
+ /**
19
+ * @private
20
+ */
21
+ constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler);
22
+ /**
23
+ * Enables the "drag to pan" interaction.
24
+ *
25
+ * @param {Object} [options] Options object
26
+ * @param {number} [options.linearity=0] factor used to scale the drag velocity
27
+ * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.
28
+ * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.
29
+ * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.
30
+ *
31
+ * @example
32
+ * map.dragPan.enable();
33
+ * @example
34
+ * map.dragPan.enable({
35
+ * linearity: 0.3,
36
+ * easing: bezier(0, 0, 0.3, 1),
37
+ * maxSpeed: 1400,
38
+ * deceleration: 2500,
39
+ * });
40
+ */
41
+ enable(options?: IDragPanOptions): void;
42
+ /**
43
+ * Disables the "drag to pan" interaction.
44
+ *
45
+ * @example
46
+ * map.dragPan.disable();
47
+ */
48
+ disable(): void;
49
+ /**
50
+ * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
51
+ *
52
+ * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
53
+ */
54
+ isEnabled(): boolean;
55
+ /**
56
+ * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
57
+ *
58
+ * @returns {boolean} `true` if the "drag to pan" interaction is active.
59
+ */
60
+ isActive(): boolean;
61
+ }
@@ -5,18 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  /**
11
10
  * The `DragPanHandler` allows the user to pan the map by clicking and dragging
12
11
  * the cursor.
13
12
  */
14
- var DragPanHandler = exports.default = /*#__PURE__*/function () {
13
+ class DragPanHandler {
15
14
  /**
16
15
  * @private
17
16
  */
18
- function DragPanHandler(el, mousePan, touchPan) {
19
- (0, _classCallCheck2.default)(this, DragPanHandler);
17
+ constructor(el, mousePan, touchPan) {
18
+ (0, _defineProperty2.default)(this, "inertiaOptions", void 0);
19
+ (0, _defineProperty2.default)(this, "el", void 0);
20
+ (0, _defineProperty2.default)(this, "mousePan", void 0);
21
+ (0, _defineProperty2.default)(this, "touchPan", void 0);
20
22
  this.el = el;
21
23
  this.mousePan = mousePan;
22
24
  this.touchPan = touchPan;
@@ -41,50 +43,41 @@ var DragPanHandler = exports.default = /*#__PURE__*/function () {
41
43
  * deceleration: 2500,
42
44
  * });
43
45
  */
44
- (0, _createClass2.default)(DragPanHandler, [{
45
- key: "enable",
46
- value: function enable(options) {
47
- this.inertiaOptions = options || {};
48
- this.mousePan.enable();
49
- this.touchPan.enable();
50
- this.el.classList.add('l7-touch-drag-pan');
51
- }
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
52
 
53
- /**
54
- * Disables the "drag to pan" interaction.
55
- *
56
- * @example
57
- * map.dragPan.disable();
58
- */
59
- }, {
60
- key: "disable",
61
- value: function disable() {
62
- this.mousePan.disable();
63
- this.touchPan.disable();
64
- this.el.classList.remove('l7-touch-drag-pan');
65
- }
53
+ /**
54
+ * Disables the "drag to pan" interaction.
55
+ *
56
+ * @example
57
+ * map.dragPan.disable();
58
+ */
59
+ disable() {
60
+ this.mousePan.disable();
61
+ this.touchPan.disable();
62
+ this.el.classList.remove('l7-touch-drag-pan');
63
+ }
66
64
 
67
- /**
68
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
69
- *
70
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
71
- */
72
- }, {
73
- key: "isEnabled",
74
- value: function isEnabled() {
75
- return this.mousePan.isEnabled() && this.touchPan.isEnabled();
76
- }
65
+ /**
66
+ * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
67
+ *
68
+ * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
69
+ */
70
+ isEnabled() {
71
+ return this.mousePan.isEnabled() && this.touchPan.isEnabled();
72
+ }
77
73
 
78
- /**
79
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
80
- *
81
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
82
- */
83
- }, {
84
- key: "isActive",
85
- value: function isActive() {
86
- return this.mousePan.isActive() || this.touchPan.isActive();
87
- }
88
- }]);
89
- return DragPanHandler;
90
- }();
74
+ /**
75
+ * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
76
+ *
77
+ * @returns {boolean} `true` if the "drag to pan" interaction is active.
78
+ */
79
+ isActive() {
80
+ return this.mousePan.isActive() || this.touchPan.isActive();
81
+ }
82
+ }
83
+ exports.default = DragPanHandler;
@@ -0,0 +1,46 @@
1
+ import type { 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
+ }
@@ -5,13 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
9
  /**
11
10
  * The `DragRotateHandler` allows the user to rotate the map by clicking and
12
11
  * dragging the cursor while holding the right mouse button or `ctrl` key.
13
12
  */
14
- var DragRotateHandler = exports.default = /*#__PURE__*/function () {
13
+ class DragRotateHandler {
15
14
  /**
16
15
  * @param {Object} [options]
17
16
  * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
@@ -19,8 +18,10 @@ var DragRotateHandler = exports.default = /*#__PURE__*/function () {
19
18
  * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
20
19
  * @private
21
20
  */
22
- function DragRotateHandler(options, mouseRotate, mousePitch) {
23
- (0, _classCallCheck2.default)(this, DragRotateHandler);
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);
24
25
  this.pitchWithRotate = options.pitchWithRotate;
25
26
  this.mouseRotate = mouseRotate;
26
27
  this.mousePitch = mousePitch;
@@ -32,49 +33,40 @@ var DragRotateHandler = exports.default = /*#__PURE__*/function () {
32
33
  * @example
33
34
  * map.dragRotate.enable();
34
35
  */
35
- (0, _createClass2.default)(DragRotateHandler, [{
36
- key: "enable",
37
- value: function enable() {
38
- this.mouseRotate.enable();
39
- if (this.pitchWithRotate) {
40
- this.mousePitch.enable();
41
- }
36
+ enable() {
37
+ this.mouseRotate.enable();
38
+ if (this.pitchWithRotate) {
39
+ this.mousePitch.enable();
42
40
  }
41
+ }
43
42
 
44
- /**
45
- * Disables the "drag to rotate" interaction.
46
- *
47
- * @example
48
- * map.dragRotate.disable();
49
- */
50
- }, {
51
- key: "disable",
52
- value: function disable() {
53
- this.mouseRotate.disable();
54
- this.mousePitch.disable();
55
- }
43
+ /**
44
+ * Disables the "drag to rotate" interaction.
45
+ *
46
+ * @example
47
+ * map.dragRotate.disable();
48
+ */
49
+ disable() {
50
+ this.mouseRotate.disable();
51
+ this.mousePitch.disable();
52
+ }
56
53
 
57
- /**
58
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
59
- *
60
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
61
- */
62
- }, {
63
- key: "isEnabled",
64
- value: function isEnabled() {
65
- return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
66
- }
54
+ /**
55
+ * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
56
+ *
57
+ * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
58
+ */
59
+ isEnabled() {
60
+ return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
61
+ }
67
62
 
68
- /**
69
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
70
- *
71
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
72
- */
73
- }, {
74
- key: "isActive",
75
- value: function isActive() {
76
- return this.mouseRotate.isActive() || this.mousePitch.isActive();
77
- }
78
- }]);
79
- return DragRotateHandler;
80
- }();
63
+ /**
64
+ * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
65
+ *
66
+ * @returns {boolean} `true` if the "drag to rotate" interaction is active.
67
+ */
68
+ isActive() {
69
+ return this.mouseRotate.isActive() || this.mousePitch.isActive();
70
+ }
71
+ }
72
+ exports.default = DragRotateHandler;
@@ -0,0 +1,70 @@
1
+ import type TapDragZoomHandler from '../tap/tap_drag_zoom';
2
+ import type { 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
+ }