@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,110 @@
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/touch_pan.ts
23
+ var touch_pan_exports = {};
24
+ __export(touch_pan_exports, {
25
+ default: () => TouchPanHandler
26
+ });
27
+ module.exports = __toCommonJS(touch_pan_exports);
28
+ var import_point = __toESM(require("../../geo/point"));
29
+ var import_handler_util = require("../handler_util");
30
+ var TouchPanHandler = class {
31
+ constructor(options) {
32
+ this.minTouches = 1;
33
+ this.clickTolerance = options.clickTolerance || 1;
34
+ this.reset();
35
+ }
36
+ reset() {
37
+ this.active = false;
38
+ this.touches = {};
39
+ this.sum = new import_point.default(0, 0);
40
+ }
41
+ touchstart(e, points, mapTouches) {
42
+ return this.calculateTransform(e, points, mapTouches);
43
+ }
44
+ touchmove(e, points, mapTouches) {
45
+ if (!this.active) {
46
+ return;
47
+ }
48
+ e.preventDefault();
49
+ return this.calculateTransform(e, points, mapTouches);
50
+ }
51
+ touchend(e, points, mapTouches) {
52
+ this.calculateTransform(e, points, mapTouches);
53
+ if (this.active && mapTouches.length < this.minTouches) {
54
+ this.reset();
55
+ }
56
+ }
57
+ touchcancel() {
58
+ this.reset();
59
+ }
60
+ enable() {
61
+ this.enabled = true;
62
+ }
63
+ disable() {
64
+ this.enabled = false;
65
+ this.reset();
66
+ }
67
+ isEnabled() {
68
+ return this.enabled;
69
+ }
70
+ isActive() {
71
+ return this.active;
72
+ }
73
+ calculateTransform(e, points, mapTouches) {
74
+ if (mapTouches.length > 0) {
75
+ this.active = true;
76
+ }
77
+ const touches = (0, import_handler_util.indexTouches)(mapTouches, points);
78
+ const touchPointSum = new import_point.default(0, 0);
79
+ const touchDeltaSum = new import_point.default(0, 0);
80
+ let touchDeltaCount = 0;
81
+ for (const identifier in touches) {
82
+ if (touches[identifier]) {
83
+ const point = touches[identifier];
84
+ const prevPoint = this.touches[identifier];
85
+ if (prevPoint) {
86
+ touchPointSum._add(point);
87
+ touchDeltaSum._add(point.sub(prevPoint));
88
+ touchDeltaCount++;
89
+ touches[identifier] = point;
90
+ }
91
+ }
92
+ }
93
+ this.touches = touches;
94
+ if (touchDeltaCount < this.minTouches || !touchDeltaSum.mag()) {
95
+ return;
96
+ }
97
+ const panDelta = touchDeltaSum.div(touchDeltaCount);
98
+ this.sum._add(panDelta);
99
+ if (this.sum.mag() < this.clickTolerance) {
100
+ return;
101
+ }
102
+ const around = touchPointSum.div(touchDeltaCount);
103
+ return {
104
+ around,
105
+ panDelta
106
+ };
107
+ }
108
+ };
109
+ // Annotate the CommonJS export names for ESM import in node:
110
+ 0 && (module.exports = {});
@@ -0,0 +1,86 @@
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/touch_pitch.ts
23
+ var touch_pitch_exports = {};
24
+ __export(touch_pitch_exports, {
25
+ default: () => TouchPitchHandler
26
+ });
27
+ module.exports = __toCommonJS(touch_pitch_exports);
28
+ var import_two_touch = __toESM(require("./two_touch"));
29
+ function isVertical(vector) {
30
+ return Math.abs(vector.y) > Math.abs(vector.x);
31
+ }
32
+ var ALLOWED_SINGLE_TOUCH_TIME = 100;
33
+ var TouchPitchHandler = class extends import_two_touch.default {
34
+ reset() {
35
+ super.reset();
36
+ this.valid = void 0;
37
+ delete this.firstMove;
38
+ delete this.lastPoints;
39
+ }
40
+ start(points) {
41
+ this.lastPoints = points;
42
+ if (isVertical(points[0].sub(points[1]))) {
43
+ this.valid = false;
44
+ }
45
+ }
46
+ move(points, center, e) {
47
+ const vectorA = points[0].sub(this.lastPoints[0]);
48
+ const vectorB = points[1].sub(this.lastPoints[1]);
49
+ this.valid = this.gestureBeginsVertically(vectorA, vectorB, e.timeStamp);
50
+ if (!this.valid) {
51
+ return;
52
+ }
53
+ this.lastPoints = points;
54
+ this.active = true;
55
+ const yDeltaAverage = (vectorA.y + vectorB.y) / 2;
56
+ const degreesPerPixelMoved = -0.5;
57
+ return {
58
+ pitchDelta: yDeltaAverage * degreesPerPixelMoved
59
+ };
60
+ }
61
+ gestureBeginsVertically(vectorA, vectorB, timeStamp) {
62
+ if (this.valid !== void 0) {
63
+ return this.valid;
64
+ }
65
+ const threshold = 2;
66
+ const movedA = vectorA.mag() >= threshold;
67
+ const movedB = vectorB.mag() >= threshold;
68
+ if (!movedA && !movedB) {
69
+ return;
70
+ }
71
+ if (!movedA || !movedB) {
72
+ if (this.firstMove === void 0) {
73
+ this.firstMove = timeStamp;
74
+ }
75
+ if (timeStamp - this.firstMove < ALLOWED_SINGLE_TOUCH_TIME) {
76
+ return void 0;
77
+ } else {
78
+ return false;
79
+ }
80
+ }
81
+ const isSameDirection = vectorA.y > 0 === vectorB.y > 0;
82
+ return isVertical(vectorA) && isVertical(vectorB) && isSameDirection;
83
+ }
84
+ };
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {});
@@ -0,0 +1,65 @@
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/touch_rotate.ts
23
+ var touch_rotate_exports = {};
24
+ __export(touch_rotate_exports, {
25
+ default: () => TouchRotateHandler
26
+ });
27
+ module.exports = __toCommonJS(touch_rotate_exports);
28
+ var import_two_touch = __toESM(require("./two_touch"));
29
+ var ROTATION_THRESHOLD = 25;
30
+ function getBearingDelta(a, b) {
31
+ return a.angleWith(b) * 180 / Math.PI;
32
+ }
33
+ var TouchRotateHandler = class extends import_two_touch.default {
34
+ reset() {
35
+ super.reset();
36
+ delete this.minDiameter;
37
+ delete this.startVector;
38
+ delete this.vector;
39
+ }
40
+ start(points) {
41
+ this.startVector = this.vector = points[0].sub(points[1]);
42
+ this.minDiameter = points[0].dist(points[1]);
43
+ }
44
+ move(points, pinchAround) {
45
+ const lastVector = this.vector;
46
+ this.vector = points[0].sub(points[1]);
47
+ if (!this.active && this.isBelowThreshold(this.vector)) {
48
+ return;
49
+ }
50
+ this.active = true;
51
+ return {
52
+ bearingDelta: getBearingDelta(this.vector, lastVector),
53
+ pinchAround
54
+ };
55
+ }
56
+ isBelowThreshold(vector) {
57
+ this.minDiameter = Math.min(this.minDiameter, vector.mag());
58
+ const circumference = Math.PI * this.minDiameter;
59
+ const threshold = ROTATION_THRESHOLD / circumference * 360;
60
+ const bearingDeltaSinceStart = getBearingDelta(vector, this.startVector);
61
+ return Math.abs(bearingDeltaSinceStart) < threshold;
62
+ }
63
+ };
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {});
@@ -0,0 +1,56 @@
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/touch_zoom.ts
23
+ var touch_zoom_exports = {};
24
+ __export(touch_zoom_exports, {
25
+ default: () => TouchZoomHandler
26
+ });
27
+ module.exports = __toCommonJS(touch_zoom_exports);
28
+ var import_two_touch = __toESM(require("./two_touch"));
29
+ var ZOOM_THRESHOLD = 0.1;
30
+ function getZoomDelta(distance, lastDistance) {
31
+ return Math.log(distance / lastDistance) / Math.LN2;
32
+ }
33
+ var TouchZoomHandler = class extends import_two_touch.default {
34
+ reset() {
35
+ super.reset();
36
+ delete this.distance;
37
+ delete this.startDistance;
38
+ }
39
+ start(points) {
40
+ this.startDistance = this.distance = points[0].dist(points[1]);
41
+ }
42
+ move(points, pinchAround) {
43
+ const lastDistance = this.distance;
44
+ this.distance = points[0].dist(points[1]);
45
+ if (!this.active && Math.abs(getZoomDelta(this.distance, this.startDistance)) < ZOOM_THRESHOLD) {
46
+ return;
47
+ }
48
+ this.active = true;
49
+ return {
50
+ zoomDelta: getZoomDelta(this.distance, lastDistance),
51
+ pinchAround
52
+ };
53
+ }
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {});
@@ -0,0 +1,105 @@
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/two_touch.ts
23
+ var two_touch_exports = {};
24
+ __export(two_touch_exports, {
25
+ default: () => TwoTouchHandler
26
+ });
27
+ module.exports = __toCommonJS(two_touch_exports);
28
+ var import_dom = __toESM(require("../../utils/dom"));
29
+ var TwoTouchHandler = class {
30
+ constructor() {
31
+ this.reset();
32
+ }
33
+ reset() {
34
+ this.active = false;
35
+ delete this.firstTwoTouches;
36
+ }
37
+ start(points) {
38
+ return;
39
+ }
40
+ move(points, pinchAround, e) {
41
+ return;
42
+ }
43
+ touchstart(e, points, mapTouches) {
44
+ if (this.firstTwoTouches || mapTouches.length < 2) {
45
+ return;
46
+ }
47
+ this.firstTwoTouches = [mapTouches[0].identifier, mapTouches[1].identifier];
48
+ this.start([points[0], points[1]]);
49
+ }
50
+ touchmove(e, points, mapTouches) {
51
+ if (!this.firstTwoTouches) {
52
+ return;
53
+ }
54
+ e.preventDefault();
55
+ const [idA, idB] = this.firstTwoTouches;
56
+ const a = getTouchById(mapTouches, points, idA);
57
+ const b = getTouchById(mapTouches, points, idB);
58
+ if (!a || !b) {
59
+ return;
60
+ }
61
+ const pinchAround = this.aroundCenter ? null : a.add(b).div(2);
62
+ return this.move([a, b], pinchAround, e);
63
+ }
64
+ touchend(e, points, mapTouches) {
65
+ if (!this.firstTwoTouches) {
66
+ return;
67
+ }
68
+ const [idA, idB] = this.firstTwoTouches;
69
+ const a = getTouchById(mapTouches, points, idA);
70
+ const b = getTouchById(mapTouches, points, idB);
71
+ if (a && b) {
72
+ return;
73
+ }
74
+ if (this.active) {
75
+ import_dom.default.suppressClick();
76
+ }
77
+ this.reset();
78
+ }
79
+ touchcancel() {
80
+ this.reset();
81
+ }
82
+ enable(options) {
83
+ this.enabled = true;
84
+ this.aroundCenter = !!options && options.around === "center";
85
+ }
86
+ disable() {
87
+ this.enabled = false;
88
+ this.reset();
89
+ }
90
+ isEnabled() {
91
+ return this.enabled;
92
+ }
93
+ isActive() {
94
+ return this.active;
95
+ }
96
+ };
97
+ function getTouchById(mapTouches, points, identifier) {
98
+ for (let i = 0; i < mapTouches.length; i++) {
99
+ if (mapTouches[i].identifier === identifier) {
100
+ return points[i];
101
+ }
102
+ }
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {});
package/lib/hash.js ADDED
@@ -0,0 +1,120 @@
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/hash.ts
20
+ var hash_exports = {};
21
+ __export(hash_exports, {
22
+ default: () => hash_default
23
+ });
24
+ module.exports = __toCommonJS(hash_exports);
25
+ var import_l7_utils = require("@antv/l7-utils");
26
+ var import_lodash = require("lodash");
27
+ var Hash = class {
28
+ constructor(hashName) {
29
+ this.onHashChange = () => {
30
+ const loc = this.getCurrentHash();
31
+ if (loc.length >= 3 && !loc.some((v) => isNaN(+v))) {
32
+ const bearing = this.map.dragRotate.isEnabled() && this.map.touchZoomRotate.isEnabled() ? +(loc[3] || 0) : this.map.getBearing();
33
+ this.map.jumpTo({
34
+ center: [+loc[2], +loc[1]],
35
+ zoom: +loc[0],
36
+ bearing,
37
+ pitch: +(loc[4] || 0)
38
+ });
39
+ return true;
40
+ }
41
+ return false;
42
+ };
43
+ this.getCurrentHash = () => {
44
+ const hash = window.location.hash.replace("#", "");
45
+ if (this.hashName) {
46
+ let keyval;
47
+ hash.split("&").map((part) => part.split("=")).forEach((part) => {
48
+ if (part[0] === this.hashName) {
49
+ keyval = part;
50
+ }
51
+ });
52
+ return (keyval ? keyval[1] || "" : "").split("/");
53
+ }
54
+ return hash.split("/");
55
+ };
56
+ this.updateHashUnthrottled = () => {
57
+ const hash = this.getHashString();
58
+ try {
59
+ window.history.replaceState(window.history.state, "", hash);
60
+ } catch (SecurityError) {
61
+ }
62
+ };
63
+ this.hashName = hashName && encodeURIComponent(hashName);
64
+ this.updateHash = (0, import_lodash.throttle)(this.updateHashUnthrottled, 30 * 1e3 / 100);
65
+ }
66
+ addTo(map) {
67
+ this.map = map;
68
+ import_l7_utils.$window.addEventListener("hashchange", this.onHashChange, false);
69
+ this.map.on("moveend", this.updateHash);
70
+ return this;
71
+ }
72
+ remove() {
73
+ import_l7_utils.$window.removeEventListener("hashchange", this.onHashChange, false);
74
+ this.map.off("moveend", this.updateHash);
75
+ delete this.map;
76
+ return this;
77
+ }
78
+ getHashString(mapFeedback) {
79
+ const center = this.map.getCenter();
80
+ const zoom = Math.round(this.map.getZoom() * 100) / 100;
81
+ const precision = Math.ceil((zoom * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10);
82
+ const m = Math.pow(10, precision);
83
+ const lng = Math.round(center.lng * m) / m;
84
+ const lat = Math.round(center.lat * m) / m;
85
+ const bearing = this.map.getBearing();
86
+ const pitch = this.map.getPitch();
87
+ let hash = "";
88
+ if (mapFeedback) {
89
+ hash += `/${lng}/${lat}/${zoom}`;
90
+ } else {
91
+ hash += `${zoom}/${lat}/${lng}`;
92
+ }
93
+ if (bearing || pitch) {
94
+ hash += `/${Math.round(bearing * 10) / 10}`;
95
+ }
96
+ if (pitch) {
97
+ hash += `/${Math.round(pitch)}`;
98
+ }
99
+ if (this.hashName) {
100
+ const hashName = this.hashName;
101
+ let found = false;
102
+ const parts = window.location.hash.slice(1).split("&").map((part) => {
103
+ const key = part.split("=")[0];
104
+ if (key === hashName) {
105
+ found = true;
106
+ return `${key}=${hash}`;
107
+ }
108
+ return part;
109
+ }).filter((a) => a);
110
+ if (!found) {
111
+ parts.push(`${hashName}=${hash}`);
112
+ }
113
+ return `#${parts.join("&")}`;
114
+ }
115
+ return `#${hash}`;
116
+ }
117
+ };
118
+ var hash_default = Hash;
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {});
package/lib/index.js ADDED
@@ -0,0 +1,21 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.ts
17
+ var src_exports = {};
18
+ module.exports = __toCommonJS(src_exports);
19
+ __reExport(src_exports, require("./map"), module.exports);
20
+ __reExport(src_exports, require("./earthmap"), module.exports);
21
+ __reExport(src_exports, require("./interface"), module.exports);
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/interface.ts
16
+ var interface_exports = {};
17
+ module.exports = __toCommonJS(interface_exports);