@antv/l7-map 2.9.32-alpha.2 → 2.9.33

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/es/camera.d.ts +84 -0
  2. package/es/camera.js +765 -0
  3. package/es/css/l7.css +98 -0
  4. package/es/earthmap.d.ts +66 -0
  5. package/es/earthmap.js +421 -0
  6. package/es/geo/edge_insets.d.ts +54 -0
  7. package/es/geo/edge_insets.js +118 -0
  8. package/es/geo/lng_lat.d.ts +18 -0
  9. package/es/geo/lng_lat.js +81 -0
  10. package/es/geo/lng_lat_bounds.d.ts +24 -0
  11. package/es/geo/lng_lat_bounds.js +167 -0
  12. package/es/geo/mercator.d.ts +28 -0
  13. package/es/geo/mercator.js +91 -0
  14. package/es/geo/point.d.ts +40 -0
  15. package/es/geo/point.js +231 -0
  16. package/es/geo/simple.d.ts +28 -0
  17. package/es/geo/simple.js +90 -0
  18. package/es/geo/transform.d.ts +198 -0
  19. package/es/geo/transform.js +971 -0
  20. package/es/handler/IHandler.d.ts +34 -0
  21. package/es/handler/IHandler.js +1 -0
  22. package/es/handler/blockable_map_event.d.ts +17 -0
  23. package/es/handler/blockable_map_event.js +83 -0
  24. package/es/handler/box_zoom.d.ts +59 -0
  25. package/es/handler/box_zoom.js +200 -0
  26. package/es/handler/click_zoom.d.ts +16 -0
  27. package/es/handler/click_zoom.js +59 -0
  28. package/es/handler/events/event.d.ts +4 -0
  29. package/es/handler/events/event.js +12 -0
  30. package/es/handler/events/index.d.ts +4 -0
  31. package/es/handler/events/index.js +4 -0
  32. package/es/handler/events/map_mouse_event.d.ts +34 -0
  33. package/es/handler/events/map_mouse_event.js +75 -0
  34. package/es/handler/events/map_touch_event.d.ts +57 -0
  35. package/es/handler/events/map_touch_event.js +105 -0
  36. package/es/handler/events/map_wheel_event.d.ts +33 -0
  37. package/es/handler/events/map_wheel_event.js +61 -0
  38. package/es/handler/events/render_event.d.ts +5 -0
  39. package/es/handler/events/render_event.js +39 -0
  40. package/es/handler/handler_inertia.d.ts +23 -0
  41. package/es/handler/handler_inertia.js +184 -0
  42. package/es/handler/handler_manager.d.ts +61 -0
  43. package/es/handler/handler_manager.js +684 -0
  44. package/es/handler/handler_util.d.ts +4 -0
  45. package/es/handler/handler_util.js +10 -0
  46. package/es/handler/keyboard.d.ts +36 -0
  47. package/es/handler/keyboard.js +162 -0
  48. package/es/handler/map_event.d.ts +29 -0
  49. package/es/handler/map_event.js +131 -0
  50. package/es/handler/mouse/index.d.ts +4 -0
  51. package/es/handler/mouse/index.js +4 -0
  52. package/es/handler/mouse/mouse_handler.d.ts +22 -0
  53. package/es/handler/mouse/mouse_handler.js +129 -0
  54. package/es/handler/mouse/mousepan_handler.d.ts +10 -0
  55. package/es/handler/mouse/mousepan_handler.js +54 -0
  56. package/es/handler/mouse/mousepitch_hander.d.ts +9 -0
  57. package/es/handler/mouse/mousepitch_hander.js +56 -0
  58. package/es/handler/mouse/mouserotate_hander.d.ts +9 -0
  59. package/es/handler/mouse/mouserotate_hander.js +56 -0
  60. package/es/handler/mouse/util.d.ts +6 -0
  61. package/es/handler/mouse/util.js +12 -0
  62. package/es/handler/scroll_zoom.d.ts +93 -0
  63. package/es/handler/scroll_zoom.js +353 -0
  64. package/es/handler/shim/dblclick_zoom.d.ts +40 -0
  65. package/es/handler/shim/dblclick_zoom.js +72 -0
  66. package/es/handler/shim/drag_pan.d.ts +61 -0
  67. package/es/handler/shim/drag_pan.js +96 -0
  68. package/es/handler/shim/drag_rotate.d.ts +46 -0
  69. package/es/handler/shim/drag_rotate.js +80 -0
  70. package/es/handler/shim/touch_zoom_rotate.d.ts +70 -0
  71. package/es/handler/shim/touch_zoom_rotate.js +130 -0
  72. package/es/handler/tap/single_tap_recognizer.d.ts +20 -0
  73. package/es/handler/tap/single_tap_recognizer.js +120 -0
  74. package/es/handler/tap/tap_drag_zoom.d.ts +22 -0
  75. package/es/handler/tap/tap_drag_zoom.js +114 -0
  76. package/es/handler/tap/tap_recognizer.d.ts +17 -0
  77. package/es/handler/tap/tap_recognizer.js +62 -0
  78. package/es/handler/tap/tap_zoom.d.ts +22 -0
  79. package/es/handler/tap/tap_zoom.js +115 -0
  80. package/es/handler/touch/index.d.ts +5 -0
  81. package/es/handler/touch/index.js +5 -0
  82. package/es/handler/touch/touch_pan.d.ts +30 -0
  83. package/es/handler/touch/touch_pan.js +128 -0
  84. package/es/handler/touch/touch_pitch.d.ts +13 -0
  85. package/es/handler/touch/touch_pitch.js +110 -0
  86. package/es/handler/touch/touch_rotate.d.ts +12 -0
  87. package/es/handler/touch/touch_rotate.js +88 -0
  88. package/es/handler/touch/touch_zoom.d.ts +12 -0
  89. package/es/handler/touch/touch_zoom.js +67 -0
  90. package/es/handler/touch/two_touch.d.ts +23 -0
  91. package/es/handler/touch/two_touch.js +134 -0
  92. package/es/hash.d.ts +14 -0
  93. package/es/hash.js +156 -0
  94. package/es/index.d.ts +3 -0
  95. package/es/index.js +3 -0
  96. package/es/interface.d.ts +34 -0
  97. package/es/interface.js +1 -0
  98. package/es/map.d.ts +70 -0
  99. package/es/map.js +463 -0
  100. package/es/util.d.ts +18 -0
  101. package/es/util.js +84 -0
  102. package/es/utils/Aabb.d.ts +12 -0
  103. package/es/utils/Aabb.js +133 -0
  104. package/es/utils/dom.d.ts +4 -0
  105. package/es/utils/dom.js +218 -0
  106. package/es/utils/performance.d.ts +17 -0
  107. package/es/utils/performance.js +62 -0
  108. package/es/utils/primitives.d.ts +6 -0
  109. package/es/utils/primitives.js +45 -0
  110. package/es/utils/task_queue.d.ts +13 -0
  111. package/es/utils/task_queue.js +106 -0
  112. package/lib/camera.js +533 -0
  113. package/lib/css/l7.css +98 -0
  114. package/lib/earthmap.js +278 -0
  115. package/lib/geo/edge_insets.js +76 -0
  116. package/lib/geo/lng_lat.js +73 -0
  117. package/lib/geo/lng_lat_bounds.js +138 -0
  118. package/lib/geo/mercator.js +91 -0
  119. package/lib/geo/point.js +176 -0
  120. package/lib/geo/simple.js +87 -0
  121. package/lib/geo/transform.js +503 -0
  122. package/lib/handler/IHandler.js +17 -0
  123. package/lib/handler/blockable_map_event.js +71 -0
  124. package/lib/handler/box_zoom.js +139 -0
  125. package/lib/handler/click_zoom.js +59 -0
  126. package/lib/handler/events/event.js +38 -0
  127. package/lib/handler/events/index.js +38 -0
  128. package/lib/handler/events/map_mouse_event.js +44 -0
  129. package/lib/handler/events/map_touch_event.js +48 -0
  130. package/lib/handler/events/map_wheel_event.js +36 -0
  131. package/lib/handler/events/render_event.js +33 -0
  132. package/lib/handler/handler_inertia.js +149 -0
  133. package/lib/handler/handler_manager.js +455 -0
  134. package/lib/handler/handler_util.js +35 -0
  135. package/lib/handler/keyboard.js +131 -0
  136. package/lib/handler/map_event.js +91 -0
  137. package/lib/handler/mouse/index.js +38 -0
  138. package/lib/handler/mouse/mouse_handler.js +103 -0
  139. package/lib/handler/mouse/mousepan_handler.js +48 -0
  140. package/lib/handler/mouse/mousepitch_hander.js +47 -0
  141. package/lib/handler/mouse/mouserotate_hander.js +47 -0
  142. package/lib/handler/mouse/util.js +44 -0
  143. package/lib/handler/scroll_zoom.js +225 -0
  144. package/lib/handler/shim/dblclick_zoom.js +46 -0
  145. package/lib/handler/shim/drag_pan.js +55 -0
  146. package/lib/handler/shim/drag_rotate.js +49 -0
  147. package/lib/handler/shim/touch_zoom_rotate.js +71 -0
  148. package/lib/handler/tap/single_tap_recognizer.js +102 -0
  149. package/lib/handler/tap/tap_drag_zoom.js +106 -0
  150. package/lib/handler/tap/tap_recognizer.js +66 -0
  151. package/lib/handler/tap/tap_zoom.js +99 -0
  152. package/lib/handler/touch/index.js +41 -0
  153. package/lib/handler/touch/touch_pan.js +110 -0
  154. package/lib/handler/touch/touch_pitch.js +86 -0
  155. package/lib/handler/touch/touch_rotate.js +65 -0
  156. package/lib/handler/touch/touch_zoom.js +56 -0
  157. package/lib/handler/touch/two_touch.js +105 -0
  158. package/lib/hash.js +120 -0
  159. package/lib/index.js +21 -0
  160. package/lib/interface.js +17 -0
  161. package/lib/map.js +308 -0
  162. package/lib/util.js +97 -0
  163. package/lib/utils/Aabb.js +90 -0
  164. package/lib/utils/dom.js +159 -0
  165. package/lib/utils/performance.js +80 -0
  166. package/lib/utils/primitives.js +63 -0
  167. package/lib/utils/task_queue.js +72 -0
  168. package/package.json +3 -3
@@ -0,0 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/handler/shim/drag_pan.ts
20
+ var drag_pan_exports = {};
21
+ __export(drag_pan_exports, {
22
+ default: () => DragPanHandler
23
+ });
24
+ module.exports = __toCommonJS(drag_pan_exports);
25
+ var import_l7_utils = require("@antv/l7-utils");
26
+ var DragPanHandler = class {
27
+ constructor(el, mousePan, touchPan) {
28
+ this.el = el;
29
+ this.mousePan = mousePan;
30
+ this.touchPan = touchPan;
31
+ }
32
+ enable(options) {
33
+ this.inertiaOptions = options || {};
34
+ this.mousePan.enable();
35
+ this.touchPan.enable();
36
+ if (!import_l7_utils.isMini) {
37
+ this.el.classList.add("l7-touch-drag-pan");
38
+ }
39
+ }
40
+ disable() {
41
+ this.mousePan.disable();
42
+ this.touchPan.disable();
43
+ if (!import_l7_utils.isMini) {
44
+ this.el.classList.remove("l7-touch-drag-pan");
45
+ }
46
+ }
47
+ isEnabled() {
48
+ return this.mousePan.isEnabled() && this.touchPan.isEnabled();
49
+ }
50
+ isActive() {
51
+ return this.mousePan.isActive() || this.touchPan.isActive();
52
+ }
53
+ };
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {});
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/handler/shim/drag_rotate.ts
20
+ var drag_rotate_exports = {};
21
+ __export(drag_rotate_exports, {
22
+ default: () => DragRotateHandler
23
+ });
24
+ module.exports = __toCommonJS(drag_rotate_exports);
25
+ var DragRotateHandler = class {
26
+ constructor(options, mouseRotate, mousePitch) {
27
+ this.pitchWithRotate = options.pitchWithRotate;
28
+ this.mouseRotate = mouseRotate;
29
+ this.mousePitch = mousePitch;
30
+ }
31
+ enable() {
32
+ this.mouseRotate.enable();
33
+ if (this.pitchWithRotate) {
34
+ this.mousePitch.enable();
35
+ }
36
+ }
37
+ disable() {
38
+ this.mouseRotate.disable();
39
+ this.mousePitch.disable();
40
+ }
41
+ isEnabled() {
42
+ return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
43
+ }
44
+ isActive() {
45
+ return this.mouseRotate.isActive() || this.mousePitch.isActive();
46
+ }
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {});
@@ -0,0 +1,71 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/handler/shim/touch_zoom_rotate.ts
20
+ var touch_zoom_rotate_exports = {};
21
+ __export(touch_zoom_rotate_exports, {
22
+ default: () => TouchZoomRotateHandler
23
+ });
24
+ module.exports = __toCommonJS(touch_zoom_rotate_exports);
25
+ var import_l7_utils = require("@antv/l7-utils");
26
+ var TouchZoomRotateHandler = class {
27
+ constructor(el, touchZoom, touchRotate, tapDragZoom) {
28
+ this.el = el;
29
+ this.touchZoom = touchZoom;
30
+ this.touchRotate = touchRotate;
31
+ this.tapDragZoom = tapDragZoom;
32
+ this.rotationDisabled = false;
33
+ this.enabled = true;
34
+ }
35
+ enable(options) {
36
+ this.touchZoom.enable(options);
37
+ if (!this.rotationDisabled) {
38
+ this.touchRotate.enable(options);
39
+ }
40
+ this.tapDragZoom.enable();
41
+ if (!import_l7_utils.isMini) {
42
+ this.el.classList.add("l7-touch-zoom-rotate");
43
+ }
44
+ }
45
+ disable() {
46
+ this.touchZoom.disable();
47
+ this.touchRotate.disable();
48
+ this.tapDragZoom.disable();
49
+ if (!import_l7_utils.isMini) {
50
+ this.el.classList.remove("l7-touch-zoom-rotate");
51
+ }
52
+ }
53
+ isEnabled() {
54
+ return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
55
+ }
56
+ isActive() {
57
+ return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
58
+ }
59
+ disableRotation() {
60
+ this.rotationDisabled = true;
61
+ this.touchRotate.disable();
62
+ }
63
+ enableRotation() {
64
+ this.rotationDisabled = false;
65
+ if (this.touchZoom.isEnabled()) {
66
+ this.touchRotate.enable();
67
+ }
68
+ }
69
+ };
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {});
@@ -0,0 +1,102 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/handler/tap/single_tap_recognizer.ts
23
+ var single_tap_recognizer_exports = {};
24
+ __export(single_tap_recognizer_exports, {
25
+ MAX_DIST: () => MAX_DIST,
26
+ MAX_TAP_INTERVAL: () => MAX_TAP_INTERVAL,
27
+ MAX_TOUCH_TIME: () => MAX_TOUCH_TIME,
28
+ default: () => SingleTapRecognizer
29
+ });
30
+ module.exports = __toCommonJS(single_tap_recognizer_exports);
31
+ var import_point = __toESM(require("../../geo/point"));
32
+ var import_handler_util = require("../handler_util");
33
+ function getCentroid(points) {
34
+ const sum = new import_point.default(0, 0);
35
+ for (const point of points) {
36
+ sum._add(point);
37
+ }
38
+ return sum.div(points.length);
39
+ }
40
+ var MAX_TAP_INTERVAL = 500;
41
+ var MAX_TOUCH_TIME = 500;
42
+ var MAX_DIST = 30;
43
+ var SingleTapRecognizer = class {
44
+ constructor(options) {
45
+ this.reset();
46
+ this.numTouches = options.numTouches;
47
+ }
48
+ reset() {
49
+ delete this.centroid;
50
+ delete this.startTime;
51
+ delete this.touches;
52
+ this.aborted = false;
53
+ }
54
+ touchstart(e, points, mapTouches) {
55
+ if (this.centroid || mapTouches.length > this.numTouches) {
56
+ this.aborted = true;
57
+ }
58
+ if (this.aborted) {
59
+ return;
60
+ }
61
+ if (this.startTime === void 0) {
62
+ this.startTime = e.timeStamp;
63
+ }
64
+ if (mapTouches.length === this.numTouches) {
65
+ this.centroid = getCentroid(points);
66
+ this.touches = (0, import_handler_util.indexTouches)(mapTouches, points);
67
+ }
68
+ }
69
+ touchmove(e, points, mapTouches) {
70
+ if (this.aborted || !this.centroid) {
71
+ return;
72
+ }
73
+ const newTouches = (0, import_handler_util.indexTouches)(mapTouches, points);
74
+ for (const id in this.touches) {
75
+ if (this.touches[id]) {
76
+ const prevPos = this.touches[id];
77
+ const pos = newTouches[id];
78
+ if (!pos || pos.dist(prevPos) > MAX_DIST) {
79
+ this.aborted = true;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ touchend(e, points, mapTouches) {
85
+ if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
86
+ this.aborted = true;
87
+ }
88
+ if (mapTouches.length === 0) {
89
+ const centroid = !this.aborted && this.centroid;
90
+ this.reset();
91
+ if (centroid) {
92
+ return centroid;
93
+ }
94
+ }
95
+ }
96
+ };
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ MAX_DIST,
100
+ MAX_TAP_INTERVAL,
101
+ MAX_TOUCH_TIME
102
+ });
@@ -0,0 +1,106 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/handler/tap/tap_drag_zoom.ts
23
+ var tap_drag_zoom_exports = {};
24
+ __export(tap_drag_zoom_exports, {
25
+ default: () => TapDragZoomHandler
26
+ });
27
+ module.exports = __toCommonJS(tap_drag_zoom_exports);
28
+ var import_single_tap_recognizer = require("./single_tap_recognizer");
29
+ var import_tap_recognizer = __toESM(require("./tap_recognizer"));
30
+ var TapDragZoomHandler = class {
31
+ constructor() {
32
+ this.tap = new import_tap_recognizer.default({
33
+ numTouches: 1,
34
+ numTaps: 1
35
+ });
36
+ this.reset();
37
+ }
38
+ reset() {
39
+ this.active = false;
40
+ delete this.swipePoint;
41
+ delete this.swipeTouch;
42
+ delete this.tapTime;
43
+ this.tap.reset();
44
+ }
45
+ touchstart(e, points, mapTouches) {
46
+ if (this.swipePoint) {
47
+ return;
48
+ }
49
+ if (this.tapTime && e.timeStamp - this.tapTime > import_single_tap_recognizer.MAX_TAP_INTERVAL) {
50
+ this.reset();
51
+ }
52
+ if (!this.tapTime) {
53
+ this.tap.touchstart(e, points, mapTouches);
54
+ } else if (mapTouches.length > 0) {
55
+ this.swipePoint = points[0];
56
+ this.swipeTouch = mapTouches[0].identifier;
57
+ }
58
+ }
59
+ touchmove(e, points, mapTouches) {
60
+ if (!this.tapTime) {
61
+ this.tap.touchmove(e, points, mapTouches);
62
+ } else if (this.swipePoint) {
63
+ if (mapTouches[0].identifier !== this.swipeTouch) {
64
+ return;
65
+ }
66
+ const newSwipePoint = points[0];
67
+ const dist = newSwipePoint.y - this.swipePoint.y;
68
+ this.swipePoint = newSwipePoint;
69
+ e.preventDefault();
70
+ this.active = true;
71
+ return {
72
+ zoomDelta: dist / 128
73
+ };
74
+ }
75
+ }
76
+ touchend(e, points, mapTouches) {
77
+ if (!this.tapTime) {
78
+ const point = this.tap.touchend(e, points, mapTouches);
79
+ if (point) {
80
+ this.tapTime = e.timeStamp;
81
+ }
82
+ } else if (this.swipePoint) {
83
+ if (mapTouches.length === 0) {
84
+ this.reset();
85
+ }
86
+ }
87
+ }
88
+ touchcancel() {
89
+ this.reset();
90
+ }
91
+ enable() {
92
+ this.enabled = true;
93
+ }
94
+ disable() {
95
+ this.enabled = false;
96
+ this.reset();
97
+ }
98
+ isEnabled() {
99
+ return this.enabled;
100
+ }
101
+ isActive() {
102
+ return this.active;
103
+ }
104
+ };
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {});
@@ -0,0 +1,66 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/handler/tap/tap_recognizer.ts
23
+ var tap_recognizer_exports = {};
24
+ __export(tap_recognizer_exports, {
25
+ default: () => TapRecognizer
26
+ });
27
+ module.exports = __toCommonJS(tap_recognizer_exports);
28
+ var import_single_tap_recognizer = __toESM(require("./single_tap_recognizer"));
29
+ var TapRecognizer = class {
30
+ constructor(options) {
31
+ this.singleTap = new import_single_tap_recognizer.default(options);
32
+ this.numTaps = options.numTaps;
33
+ this.reset();
34
+ }
35
+ reset() {
36
+ this.lastTime = Infinity;
37
+ delete this.lastTap;
38
+ this.count = 0;
39
+ this.singleTap.reset();
40
+ }
41
+ touchstart(e, points, mapTouches) {
42
+ this.singleTap.touchstart(e, points, mapTouches);
43
+ }
44
+ touchmove(e, points, mapTouches) {
45
+ this.singleTap.touchmove(e, points, mapTouches);
46
+ }
47
+ touchend(e, points, mapTouches) {
48
+ const tap = this.singleTap.touchend(e, points, mapTouches);
49
+ if (tap) {
50
+ const soonEnough = e.timeStamp - this.lastTime < import_single_tap_recognizer.MAX_TAP_INTERVAL;
51
+ const closeEnough = !this.lastTap || this.lastTap.dist(tap) < import_single_tap_recognizer.MAX_DIST;
52
+ if (!soonEnough || !closeEnough) {
53
+ this.reset();
54
+ }
55
+ this.count++;
56
+ this.lastTime = e.timeStamp;
57
+ this.lastTap = tap;
58
+ if (this.count === this.numTaps) {
59
+ this.reset();
60
+ return tap;
61
+ }
62
+ }
63
+ }
64
+ };
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {});
@@ -0,0 +1,99 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/handler/tap/tap_zoom.ts
23
+ var tap_zoom_exports = {};
24
+ __export(tap_zoom_exports, {
25
+ default: () => TapZoomHandler
26
+ });
27
+ module.exports = __toCommonJS(tap_zoom_exports);
28
+ var import_tap_recognizer = __toESM(require("./tap_recognizer"));
29
+ var TapZoomHandler = class {
30
+ constructor() {
31
+ this.zoomIn = new import_tap_recognizer.default({
32
+ numTouches: 1,
33
+ numTaps: 2
34
+ });
35
+ this.zoomOut = new import_tap_recognizer.default({
36
+ numTouches: 2,
37
+ numTaps: 1
38
+ });
39
+ this.reset();
40
+ }
41
+ reset() {
42
+ this.active = false;
43
+ this.zoomIn.reset();
44
+ this.zoomOut.reset();
45
+ }
46
+ touchstart(e, points, mapTouches) {
47
+ this.zoomIn.touchstart(e, points, mapTouches);
48
+ this.zoomOut.touchstart(e, points, mapTouches);
49
+ }
50
+ touchmove(e, points, mapTouches) {
51
+ this.zoomIn.touchmove(e, points, mapTouches);
52
+ this.zoomOut.touchmove(e, points, mapTouches);
53
+ }
54
+ touchend(e, points, mapTouches) {
55
+ const zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
56
+ const zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
57
+ if (zoomInPoint) {
58
+ this.active = true;
59
+ e.preventDefault();
60
+ setTimeout(() => this.reset(), 0);
61
+ return {
62
+ cameraAnimation: (map) => map.easeTo({
63
+ duration: 300,
64
+ zoom: map.getZoom() + 1,
65
+ around: map.unproject(zoomInPoint)
66
+ }, { originalEvent: e })
67
+ };
68
+ } else if (zoomOutPoint) {
69
+ this.active = true;
70
+ e.preventDefault();
71
+ setTimeout(() => this.reset(), 0);
72
+ return {
73
+ cameraAnimation: (map) => map.easeTo({
74
+ duration: 300,
75
+ zoom: map.getZoom() - 1,
76
+ around: map.unproject(zoomOutPoint)
77
+ }, { originalEvent: e })
78
+ };
79
+ }
80
+ }
81
+ touchcancel() {
82
+ this.reset();
83
+ }
84
+ enable() {
85
+ this.enabled = true;
86
+ }
87
+ disable() {
88
+ this.enabled = false;
89
+ this.reset();
90
+ }
91
+ isEnabled() {
92
+ return this.enabled;
93
+ }
94
+ isActive() {
95
+ return this.active;
96
+ }
97
+ };
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {});
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // src/handler/touch/index.ts
23
+ var touch_exports = {};
24
+ __export(touch_exports, {
25
+ TouchPanHandler: () => import_touch_pan.default,
26
+ TouchPitchHandler: () => import_touch_pitch.default,
27
+ TouchRotateHandler: () => import_touch_rotate.default,
28
+ TouchZoomHandler: () => import_touch_zoom.default
29
+ });
30
+ module.exports = __toCommonJS(touch_exports);
31
+ var import_touch_pan = __toESM(require("./touch_pan"));
32
+ var import_touch_pitch = __toESM(require("./touch_pitch"));
33
+ var import_touch_rotate = __toESM(require("./touch_rotate"));
34
+ var import_touch_zoom = __toESM(require("./touch_zoom"));
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ TouchPanHandler,
38
+ TouchPitchHandler,
39
+ TouchRotateHandler,
40
+ TouchZoomHandler
41
+ });