@antv/l7-map 2.9.32-alpha.1 → 2.9.32-alpha.3

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/package.json +3 -3
  2. package/es/camera.d.ts +0 -84
  3. package/es/camera.js +0 -765
  4. package/es/css/l7.css +0 -98
  5. package/es/earthmap.d.ts +0 -66
  6. package/es/earthmap.js +0 -421
  7. package/es/geo/edge_insets.d.ts +0 -54
  8. package/es/geo/edge_insets.js +0 -118
  9. package/es/geo/lng_lat.d.ts +0 -18
  10. package/es/geo/lng_lat.js +0 -81
  11. package/es/geo/lng_lat_bounds.d.ts +0 -24
  12. package/es/geo/lng_lat_bounds.js +0 -167
  13. package/es/geo/mercator.d.ts +0 -28
  14. package/es/geo/mercator.js +0 -91
  15. package/es/geo/point.d.ts +0 -40
  16. package/es/geo/point.js +0 -231
  17. package/es/geo/simple.d.ts +0 -28
  18. package/es/geo/simple.js +0 -90
  19. package/es/geo/transform.d.ts +0 -198
  20. package/es/geo/transform.js +0 -971
  21. package/es/handler/IHandler.d.ts +0 -34
  22. package/es/handler/IHandler.js +0 -1
  23. package/es/handler/blockable_map_event.d.ts +0 -17
  24. package/es/handler/blockable_map_event.js +0 -83
  25. package/es/handler/box_zoom.d.ts +0 -59
  26. package/es/handler/box_zoom.js +0 -200
  27. package/es/handler/click_zoom.d.ts +0 -16
  28. package/es/handler/click_zoom.js +0 -59
  29. package/es/handler/events/event.d.ts +0 -4
  30. package/es/handler/events/event.js +0 -12
  31. package/es/handler/events/index.d.ts +0 -4
  32. package/es/handler/events/index.js +0 -4
  33. package/es/handler/events/map_mouse_event.d.ts +0 -34
  34. package/es/handler/events/map_mouse_event.js +0 -75
  35. package/es/handler/events/map_touch_event.d.ts +0 -57
  36. package/es/handler/events/map_touch_event.js +0 -105
  37. package/es/handler/events/map_wheel_event.d.ts +0 -33
  38. package/es/handler/events/map_wheel_event.js +0 -61
  39. package/es/handler/events/render_event.d.ts +0 -5
  40. package/es/handler/events/render_event.js +0 -39
  41. package/es/handler/handler_inertia.d.ts +0 -23
  42. package/es/handler/handler_inertia.js +0 -184
  43. package/es/handler/handler_manager.d.ts +0 -61
  44. package/es/handler/handler_manager.js +0 -684
  45. package/es/handler/handler_util.d.ts +0 -4
  46. package/es/handler/handler_util.js +0 -10
  47. package/es/handler/keyboard.d.ts +0 -36
  48. package/es/handler/keyboard.js +0 -162
  49. package/es/handler/map_event.d.ts +0 -29
  50. package/es/handler/map_event.js +0 -131
  51. package/es/handler/mouse/index.d.ts +0 -4
  52. package/es/handler/mouse/index.js +0 -4
  53. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  54. package/es/handler/mouse/mouse_handler.js +0 -129
  55. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  56. package/es/handler/mouse/mousepan_handler.js +0 -54
  57. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  58. package/es/handler/mouse/mousepitch_hander.js +0 -56
  59. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  60. package/es/handler/mouse/mouserotate_hander.js +0 -56
  61. package/es/handler/mouse/util.d.ts +0 -6
  62. package/es/handler/mouse/util.js +0 -12
  63. package/es/handler/scroll_zoom.d.ts +0 -93
  64. package/es/handler/scroll_zoom.js +0 -353
  65. package/es/handler/shim/dblclick_zoom.d.ts +0 -40
  66. package/es/handler/shim/dblclick_zoom.js +0 -72
  67. package/es/handler/shim/drag_pan.d.ts +0 -61
  68. package/es/handler/shim/drag_pan.js +0 -96
  69. package/es/handler/shim/drag_rotate.d.ts +0 -46
  70. package/es/handler/shim/drag_rotate.js +0 -80
  71. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  72. package/es/handler/shim/touch_zoom_rotate.js +0 -130
  73. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  74. package/es/handler/tap/single_tap_recognizer.js +0 -120
  75. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  76. package/es/handler/tap/tap_drag_zoom.js +0 -114
  77. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  78. package/es/handler/tap/tap_recognizer.js +0 -62
  79. package/es/handler/tap/tap_zoom.d.ts +0 -22
  80. package/es/handler/tap/tap_zoom.js +0 -115
  81. package/es/handler/touch/index.d.ts +0 -5
  82. package/es/handler/touch/index.js +0 -5
  83. package/es/handler/touch/touch_pan.d.ts +0 -30
  84. package/es/handler/touch/touch_pan.js +0 -128
  85. package/es/handler/touch/touch_pitch.d.ts +0 -13
  86. package/es/handler/touch/touch_pitch.js +0 -110
  87. package/es/handler/touch/touch_rotate.d.ts +0 -12
  88. package/es/handler/touch/touch_rotate.js +0 -88
  89. package/es/handler/touch/touch_zoom.d.ts +0 -12
  90. package/es/handler/touch/touch_zoom.js +0 -67
  91. package/es/handler/touch/two_touch.d.ts +0 -23
  92. package/es/handler/touch/two_touch.js +0 -134
  93. package/es/hash.d.ts +0 -14
  94. package/es/hash.js +0 -156
  95. package/es/index.d.ts +0 -3
  96. package/es/index.js +0 -3
  97. package/es/interface.d.ts +0 -34
  98. package/es/interface.js +0 -1
  99. package/es/map.d.ts +0 -70
  100. package/es/map.js +0 -463
  101. package/es/util.d.ts +0 -18
  102. package/es/util.js +0 -84
  103. package/es/utils/Aabb.d.ts +0 -12
  104. package/es/utils/Aabb.js +0 -133
  105. package/es/utils/dom.d.ts +0 -4
  106. package/es/utils/dom.js +0 -218
  107. package/es/utils/performance.d.ts +0 -17
  108. package/es/utils/performance.js +0 -62
  109. package/es/utils/primitives.d.ts +0 -6
  110. package/es/utils/primitives.js +0 -45
  111. package/es/utils/task_queue.d.ts +0 -13
  112. package/es/utils/task_queue.js +0 -106
  113. package/lib/camera.js +0 -533
  114. package/lib/css/l7.css +0 -98
  115. package/lib/earthmap.js +0 -278
  116. package/lib/geo/edge_insets.js +0 -76
  117. package/lib/geo/lng_lat.js +0 -73
  118. package/lib/geo/lng_lat_bounds.js +0 -138
  119. package/lib/geo/mercator.js +0 -91
  120. package/lib/geo/point.js +0 -176
  121. package/lib/geo/simple.js +0 -87
  122. package/lib/geo/transform.js +0 -503
  123. package/lib/handler/IHandler.js +0 -17
  124. package/lib/handler/blockable_map_event.js +0 -71
  125. package/lib/handler/box_zoom.js +0 -139
  126. package/lib/handler/click_zoom.js +0 -59
  127. package/lib/handler/events/event.js +0 -38
  128. package/lib/handler/events/index.js +0 -38
  129. package/lib/handler/events/map_mouse_event.js +0 -44
  130. package/lib/handler/events/map_touch_event.js +0 -48
  131. package/lib/handler/events/map_wheel_event.js +0 -36
  132. package/lib/handler/events/render_event.js +0 -33
  133. package/lib/handler/handler_inertia.js +0 -149
  134. package/lib/handler/handler_manager.js +0 -455
  135. package/lib/handler/handler_util.js +0 -35
  136. package/lib/handler/keyboard.js +0 -131
  137. package/lib/handler/map_event.js +0 -91
  138. package/lib/handler/mouse/index.js +0 -38
  139. package/lib/handler/mouse/mouse_handler.js +0 -103
  140. package/lib/handler/mouse/mousepan_handler.js +0 -48
  141. package/lib/handler/mouse/mousepitch_hander.js +0 -47
  142. package/lib/handler/mouse/mouserotate_hander.js +0 -47
  143. package/lib/handler/mouse/util.js +0 -44
  144. package/lib/handler/scroll_zoom.js +0 -225
  145. package/lib/handler/shim/dblclick_zoom.js +0 -46
  146. package/lib/handler/shim/drag_pan.js +0 -55
  147. package/lib/handler/shim/drag_rotate.js +0 -49
  148. package/lib/handler/shim/touch_zoom_rotate.js +0 -71
  149. package/lib/handler/tap/single_tap_recognizer.js +0 -102
  150. package/lib/handler/tap/tap_drag_zoom.js +0 -106
  151. package/lib/handler/tap/tap_recognizer.js +0 -66
  152. package/lib/handler/tap/tap_zoom.js +0 -99
  153. package/lib/handler/touch/index.js +0 -41
  154. package/lib/handler/touch/touch_pan.js +0 -110
  155. package/lib/handler/touch/touch_pitch.js +0 -86
  156. package/lib/handler/touch/touch_rotate.js +0 -65
  157. package/lib/handler/touch/touch_zoom.js +0 -56
  158. package/lib/handler/touch/two_touch.js +0 -105
  159. package/lib/hash.js +0 -120
  160. package/lib/index.js +0 -21
  161. package/lib/interface.js +0 -17
  162. package/lib/map.js +0 -308
  163. package/lib/util.js +0 -97
  164. package/lib/utils/Aabb.js +0 -90
  165. package/lib/utils/dom.js +0 -159
  166. package/lib/utils/performance.js +0 -80
  167. package/lib/utils/primitives.js +0 -63
  168. package/lib/utils/task_queue.js +0 -72
@@ -1,110 +0,0 @@
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 = {});
@@ -1,86 +0,0 @@
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 = {});
@@ -1,65 +0,0 @@
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 = {});
@@ -1,56 +0,0 @@
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 = {});
@@ -1,105 +0,0 @@
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 DELETED
@@ -1,120 +0,0 @@
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 DELETED
@@ -1,21 +0,0 @@
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);
package/lib/interface.js DELETED
@@ -1,17 +0,0 @@
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);