@antv/l7-map 2.25.5 → 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,116 +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.TapRecognizer = exports.SingleTapRecognizer = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
10
- var _handler_util = require("./handler_util");
11
- function getCentroid(points) {
12
- const sum = new _pointGeometry.default(0, 0);
13
- for (const point of points) {
14
- sum._add(point);
15
- }
16
- return sum.div(points.length);
17
- }
18
- const MAX_TAP_INTERVAL = exports.MAX_TAP_INTERVAL = 500;
19
- const MAX_TOUCH_TIME = 500;
20
- const MAX_DIST = exports.MAX_DIST = 30;
21
- class SingleTapRecognizer {
22
- constructor(options) {
23
- (0, _defineProperty2.default)(this, "numTouches", void 0);
24
- (0, _defineProperty2.default)(this, "centroid", void 0);
25
- (0, _defineProperty2.default)(this, "startTime", void 0);
26
- (0, _defineProperty2.default)(this, "aborted", void 0);
27
- (0, _defineProperty2.default)(this, "touches", void 0);
28
- this.reset();
29
- this.numTouches = options.numTouches;
30
- }
31
- reset() {
32
- delete this.centroid;
33
- delete this.startTime;
34
- delete this.touches;
35
- this.aborted = false;
36
- }
37
- touchstart(e, points, mapTouches) {
38
- if (this.centroid || mapTouches.length > this.numTouches) {
39
- this.aborted = true;
40
- }
41
- if (this.aborted) {
42
- return;
43
- }
44
- if (this.startTime === undefined) {
45
- this.startTime = e.timeStamp;
46
- }
47
- if (mapTouches.length === this.numTouches) {
48
- this.centroid = getCentroid(points);
49
- this.touches = (0, _handler_util.indexTouches)(mapTouches, points);
50
- }
51
- }
52
- touchmove(e, points, mapTouches) {
53
- if (this.aborted || !this.centroid) return;
54
- const newTouches = (0, _handler_util.indexTouches)(mapTouches, points);
55
- for (const id in this.touches) {
56
- const prevPos = this.touches[id];
57
- const pos = newTouches[id];
58
- if (!pos || pos.dist(prevPos) > MAX_DIST) {
59
- this.aborted = true;
60
- }
61
- }
62
- }
63
- touchend(e, points, mapTouches) {
64
- if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
65
- this.aborted = true;
66
- }
67
- if (mapTouches.length === 0) {
68
- const centroid = !this.aborted && this.centroid;
69
- this.reset();
70
- if (centroid) return centroid;
71
- }
72
- }
73
- }
74
- exports.SingleTapRecognizer = SingleTapRecognizer;
75
- class TapRecognizer {
76
- constructor(options) {
77
- (0, _defineProperty2.default)(this, "singleTap", void 0);
78
- (0, _defineProperty2.default)(this, "numTaps", void 0);
79
- (0, _defineProperty2.default)(this, "lastTime", void 0);
80
- (0, _defineProperty2.default)(this, "lastTap", void 0);
81
- (0, _defineProperty2.default)(this, "count", void 0);
82
- this.singleTap = new SingleTapRecognizer(options);
83
- this.numTaps = options.numTaps;
84
- this.reset();
85
- }
86
- reset() {
87
- this.lastTime = Infinity;
88
- delete this.lastTap;
89
- this.count = 0;
90
- this.singleTap.reset();
91
- }
92
- touchstart(e, points, mapTouches) {
93
- this.singleTap.touchstart(e, points, mapTouches);
94
- }
95
- touchmove(e, points, mapTouches) {
96
- this.singleTap.touchmove(e, points, mapTouches);
97
- }
98
- touchend(e, points, mapTouches) {
99
- const tap = this.singleTap.touchend(e, points, mapTouches);
100
- if (tap) {
101
- const soonEnough = e.timeStamp - this.lastTime < MAX_TAP_INTERVAL;
102
- const closeEnough = !this.lastTap || this.lastTap.dist(tap) < MAX_DIST;
103
- if (!soonEnough || !closeEnough) {
104
- this.reset();
105
- }
106
- this.count++;
107
- this.lastTime = e.timeStamp;
108
- this.lastTap = tap;
109
- if (this.count === this.numTaps) {
110
- this.reset();
111
- return tap;
112
- }
113
- }
114
- }
115
- }
116
- exports.TapRecognizer = TapRecognizer;
@@ -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 type { Map } from '../map';
5
- import { TapRecognizer } from './tap_recognizer';
6
- import { TransformProvider } from './transform-provider';
7
- /**
8
- * A `TapZoomHandler` allows the user to zoom the map at a point by double tapping
9
- */
10
- export declare class TapZoomHandler implements Handler {
11
- _tr: TransformProvider;
12
- _enabled: boolean;
13
- _active: boolean;
14
- _zoomIn: TapRecognizer;
15
- _zoomOut: TapRecognizer;
16
- constructor(map: Map);
17
- reset(): void;
18
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
19
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
20
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): {
21
- cameraAnimation: (map: Map) => Map;
22
- };
23
- touchcancel(): void;
24
- enable(): void;
25
- disable(): void;
26
- isEnabled(): boolean;
27
- isActive(): boolean;
28
- }
@@ -1,94 +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.TapZoomHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _tap_recognizer = require("./tap_recognizer");
10
- var _transformProvider = require("./transform-provider");
11
- /**
12
- * A `TapZoomHandler` allows the user to zoom the map at a point by double tapping
13
- */
14
- class TapZoomHandler {
15
- constructor(map) {
16
- (0, _defineProperty2.default)(this, "_tr", void 0);
17
- (0, _defineProperty2.default)(this, "_enabled", void 0);
18
- (0, _defineProperty2.default)(this, "_active", void 0);
19
- (0, _defineProperty2.default)(this, "_zoomIn", void 0);
20
- (0, _defineProperty2.default)(this, "_zoomOut", void 0);
21
- this._tr = new _transformProvider.TransformProvider(map);
22
- this._zoomIn = new _tap_recognizer.TapRecognizer({
23
- numTouches: 1,
24
- numTaps: 2
25
- });
26
- this._zoomOut = new _tap_recognizer.TapRecognizer({
27
- numTouches: 2,
28
- numTaps: 1
29
- });
30
- this.reset();
31
- }
32
- reset() {
33
- this._active = false;
34
- this._zoomIn.reset();
35
- this._zoomOut.reset();
36
- }
37
- touchstart(e, points, mapTouches) {
38
- this._zoomIn.touchstart(e, points, mapTouches);
39
- this._zoomOut.touchstart(e, points, mapTouches);
40
- }
41
- touchmove(e, points, mapTouches) {
42
- this._zoomIn.touchmove(e, points, mapTouches);
43
- this._zoomOut.touchmove(e, points, mapTouches);
44
- }
45
- touchend(e, points, mapTouches) {
46
- const zoomInPoint = this._zoomIn.touchend(e, points, mapTouches);
47
- const zoomOutPoint = this._zoomOut.touchend(e, points, mapTouches);
48
- const tr = this._tr;
49
- if (zoomInPoint) {
50
- this._active = true;
51
- e.preventDefault();
52
- setTimeout(() => this.reset(), 0);
53
- return {
54
- cameraAnimation: map => map.easeTo({
55
- duration: 300,
56
- zoom: tr.zoom + 1,
57
- around: tr.unproject(zoomInPoint)
58
- }, {
59
- originalEvent: e
60
- })
61
- };
62
- } else if (zoomOutPoint) {
63
- this._active = true;
64
- e.preventDefault();
65
- setTimeout(() => this.reset(), 0);
66
- return {
67
- cameraAnimation: map => map.easeTo({
68
- duration: 300,
69
- zoom: tr.zoom - 1,
70
- around: tr.unproject(zoomOutPoint)
71
- }, {
72
- originalEvent: e
73
- })
74
- };
75
- }
76
- }
77
- touchcancel() {
78
- this.reset();
79
- }
80
- enable() {
81
- this._enabled = true;
82
- }
83
- disable() {
84
- this._enabled = false;
85
- this.reset();
86
- }
87
- isEnabled() {
88
- return this._enabled;
89
- }
90
- isActive() {
91
- return this._active;
92
- }
93
- }
94
- exports.TapZoomHandler = TapZoomHandler;
@@ -1,40 +0,0 @@
1
- /// <reference types="mapbox__point-geometry" />
2
- import Point from '@mapbox/point-geometry';
3
- import type { Handler } from '../handler_manager';
4
- import type { Map } from '../map';
5
- /**
6
- * A `TouchPanHandler` allows the user to pan the map using touch gestures.
7
- */
8
- export declare class TouchPanHandler implements Handler {
9
- _enabled: boolean;
10
- _active: boolean;
11
- _touches: {
12
- [k in string | number]: Point;
13
- };
14
- _clickTolerance: number;
15
- _sum: Point;
16
- _map: Map;
17
- constructor(options: {
18
- clickTolerance: number;
19
- }, map: Map);
20
- reset(): void;
21
- minTouchs(): 1 | 2;
22
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): {
23
- around: Point;
24
- panDelta: Point;
25
- };
26
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): {
27
- around: Point;
28
- panDelta: Point;
29
- };
30
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
31
- touchcancel(): void;
32
- _calculateTransform(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): {
33
- around: Point;
34
- panDelta: Point;
35
- };
36
- enable(): void;
37
- disable(): void;
38
- isEnabled(): boolean;
39
- isActive(): boolean;
40
- }
@@ -1,92 +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.TouchPanHandler = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
10
- var _handler_util = require("./handler_util");
11
- /**
12
- * A `TouchPanHandler` allows the user to pan the map using touch gestures.
13
- */
14
- class TouchPanHandler {
15
- constructor(options, map) {
16
- (0, _defineProperty2.default)(this, "_enabled", void 0);
17
- (0, _defineProperty2.default)(this, "_active", void 0);
18
- (0, _defineProperty2.default)(this, "_touches", void 0);
19
- (0, _defineProperty2.default)(this, "_clickTolerance", void 0);
20
- (0, _defineProperty2.default)(this, "_sum", void 0);
21
- (0, _defineProperty2.default)(this, "_map", void 0);
22
- this._clickTolerance = options.clickTolerance || 1;
23
- this._map = map;
24
- this.reset();
25
- }
26
- reset() {
27
- this._active = false;
28
- this._touches = {};
29
- this._sum = new _pointGeometry.default(0, 0);
30
- }
31
- minTouchs() {
32
- return this._map.cooperativeGestures.isEnabled() ? 2 : 1;
33
- }
34
- touchstart(e, points, mapTouches) {
35
- return this._calculateTransform(e, points, mapTouches);
36
- }
37
- touchmove(e, points, mapTouches) {
38
- if (!this._active || mapTouches.length < this.minTouchs()) return;
39
- e.preventDefault();
40
- return this._calculateTransform(e, points, mapTouches);
41
- }
42
- touchend(e, points, mapTouches) {
43
- this._calculateTransform(e, points, mapTouches);
44
- if (this._active && mapTouches.length < this.minTouchs()) {
45
- this.reset();
46
- }
47
- }
48
- touchcancel() {
49
- this.reset();
50
- }
51
- _calculateTransform(e, points, mapTouches) {
52
- if (mapTouches.length > 0) this._active = true;
53
- const touches = (0, _handler_util.indexTouches)(mapTouches, points);
54
- const touchPointSum = new _pointGeometry.default(0, 0);
55
- const touchDeltaSum = new _pointGeometry.default(0, 0);
56
- let touchDeltaCount = 0;
57
- for (const identifier in touches) {
58
- const point = touches[identifier];
59
- const prevPoint = this._touches[identifier];
60
- if (prevPoint) {
61
- touchPointSum._add(point);
62
- touchDeltaSum._add(point.sub(prevPoint));
63
- touchDeltaCount++;
64
- touches[identifier] = point;
65
- }
66
- }
67
- this._touches = touches;
68
- if (touchDeltaCount < this.minTouchs() || !touchDeltaSum.mag()) return;
69
- const panDelta = touchDeltaSum.div(touchDeltaCount);
70
- this._sum._add(panDelta);
71
- if (this._sum.mag() < this._clickTolerance) return;
72
- const around = touchPointSum.div(touchDeltaCount);
73
- return {
74
- around,
75
- panDelta
76
- };
77
- }
78
- enable() {
79
- this._enabled = true;
80
- }
81
- disable() {
82
- this._enabled = false;
83
- this.reset();
84
- }
85
- isEnabled() {
86
- return this._enabled;
87
- }
88
- isActive() {
89
- return this._active;
90
- }
91
- }
92
- exports.TouchPanHandler = TouchPanHandler;
@@ -1,23 +0,0 @@
1
- import type { PointLike } from '../camera';
2
- import type { LngLat } from '../geo/lng_lat';
3
- import type { Transform } from '../geo/transform';
4
- import type { Map } from '../map';
5
- /**
6
- * @internal
7
- * Shared utilities for the Handler classes to access the correct camera state.
8
- * If Camera.transformCameraUpdate is specified, the "desired state" of camera may differ from the state used for rendering.
9
- * The handlers need the "desired state" to track accumulated changes.
10
- */
11
- export declare class TransformProvider {
12
- _map: Map;
13
- constructor(map: Map);
14
- get transform(): Transform;
15
- get center(): {
16
- lng: number;
17
- lat: number;
18
- };
19
- get zoom(): number;
20
- get pitch(): number;
21
- get bearing(): number;
22
- unproject(point: PointLike): LngLat;
23
- }
@@ -1,43 +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.TransformProvider = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
10
- /**
11
- * @internal
12
- * Shared utilities for the Handler classes to access the correct camera state.
13
- * If Camera.transformCameraUpdate is specified, the "desired state" of camera may differ from the state used for rendering.
14
- * The handlers need the "desired state" to track accumulated changes.
15
- */
16
- class TransformProvider {
17
- constructor(map) {
18
- (0, _defineProperty2.default)(this, "_map", void 0);
19
- this._map = map;
20
- }
21
- get transform() {
22
- return this._map._requestedCameraState || this._map.transform;
23
- }
24
- get center() {
25
- return {
26
- lng: this.transform.center.lng,
27
- lat: this.transform.center.lat
28
- };
29
- }
30
- get zoom() {
31
- return this.transform.zoom;
32
- }
33
- get pitch() {
34
- return this.transform.pitch;
35
- }
36
- get bearing() {
37
- return this.transform.bearing;
38
- }
39
- unproject(point) {
40
- return this.transform.pointLocation(_pointGeometry.default.convert(point));
41
- }
42
- }
43
- exports.TransformProvider = TransformProvider;
@@ -1,107 +0,0 @@
1
- /// <reference types="mapbox__point-geometry" />
2
- import type Point from '@mapbox/point-geometry';
3
- import type { Handler, HandlerResult } from '../handler_manager';
4
- import type { Map } from '../map';
5
- /**
6
- * An options object sent to the enable function of some of the handlers
7
- */
8
- export type AroundCenterOptions = {
9
- /**
10
- * If "center" is passed, map will zoom around the center of map
11
- */
12
- around: 'center';
13
- };
14
- /**
15
- * The `TwoFingersTouchHandler`s allows the user to zoom, pitch and rotate the map using two fingers
16
- *
17
- */
18
- declare abstract class TwoFingersTouchHandler implements Handler {
19
- _enabled?: boolean;
20
- _active?: boolean;
21
- _firstTwoTouches?: [number, number];
22
- _vector?: Point;
23
- _startVector?: Point;
24
- _aroundCenter?: boolean;
25
- /** @internal */
26
- constructor();
27
- reset(): void;
28
- abstract _start(points: [Point, Point]): void;
29
- abstract _move(points: [Point, Point], pinchAround: Point | null, e: TouchEvent): HandlerResult | void;
30
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
31
- touchmove(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): HandlerResult | void;
32
- touchend(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
33
- touchcancel(): void;
34
- /**
35
- * Enables the "drag to pitch" interaction.
36
- *
37
- * @example
38
- * ```ts
39
- * map.touchPitch.enable();
40
- * ```
41
- */
42
- enable(options?: AroundCenterOptions | boolean | null): void;
43
- /**
44
- * Disables the "drag to pitch" interaction.
45
- *
46
- * @example
47
- * ```ts
48
- * map.touchPitch.disable();
49
- * ```
50
- */
51
- disable(): void;
52
- /**
53
- * Returns a Boolean indicating whether the "drag to pitch" interaction is enabled.
54
- *
55
- * @returns `true` if the "drag to pitch" interaction is enabled.
56
- */
57
- isEnabled(): boolean;
58
- /**
59
- * Returns a Boolean indicating whether the "drag to pitch" interaction is active, i.e. currently being used.
60
- *
61
- * @returns `true` if the "drag to pitch" interaction is active.
62
- */
63
- isActive(): boolean;
64
- }
65
- /**
66
- * The `TwoFingersTouchHandler`s allows the user to zoom the map two fingers
67
- *
68
- * @group Handlers
69
- */
70
- export declare class TwoFingersTouchZoomHandler extends TwoFingersTouchHandler {
71
- _distance?: number;
72
- _startDistance?: number;
73
- reset(): void;
74
- _start(points: [Point, Point]): void;
75
- _move(points: [Point, Point], pinchAround: Point | null): HandlerResult | void;
76
- }
77
- /**
78
- * The `TwoFingersTouchHandler`s allows the user to rotate the map two fingers
79
- *
80
- * @group Handlers
81
- */
82
- export declare class TwoFingersTouchRotateHandler extends TwoFingersTouchHandler {
83
- _minDiameter?: number;
84
- reset(): void;
85
- _start(points: [Point, Point]): void;
86
- _move(points: [Point, Point], pinchAround: Point | null, _e: TouchEvent): HandlerResult | void;
87
- _isBelowThreshold(vector: Point): boolean;
88
- }
89
- /**
90
- * The `TwoFingersTouchPitchHandler` allows the user to pitch the map by dragging up and down with two fingers.
91
- *
92
- * @group Handlers
93
- */
94
- export declare class TwoFingersTouchPitchHandler extends TwoFingersTouchHandler {
95
- _valid?: boolean;
96
- _firstMove?: number;
97
- _lastPoints?: [Point, Point];
98
- _map: Map;
99
- _currentTouchCount: number;
100
- constructor(map: Map);
101
- reset(): void;
102
- touchstart(e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>): void;
103
- _start(points: [Point, Point]): void;
104
- _move(points: [Point, Point], center: Point | null, e: TouchEvent): HandlerResult | void;
105
- gestureBeginsVertically(vectorA: Point, vectorB: Point, timeStamp: number): boolean | undefined;
106
- }
107
- export {};