@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,91 @@
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/map_event.ts
20
+ var map_event_exports = {};
21
+ __export(map_event_exports, {
22
+ default: () => MapEventHandler
23
+ });
24
+ module.exports = __toCommonJS(map_event_exports);
25
+ var import_events = require("./events");
26
+ var MapEventHandler = class {
27
+ constructor(map, options) {
28
+ this.map = map;
29
+ this.clickTolerance = options.clickTolerance;
30
+ }
31
+ reset() {
32
+ delete this.mousedownPos;
33
+ }
34
+ wheel(e) {
35
+ return this.firePreventable(new import_events.MapWheelEvent(e.type, this.map, e));
36
+ }
37
+ mousedown(e, point) {
38
+ this.mousedownPos = point;
39
+ return this.firePreventable(new import_events.MapMouseEvent(e.type, this.map, e));
40
+ }
41
+ mouseup(e) {
42
+ this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
43
+ }
44
+ click(e, point) {
45
+ if (this.mousedownPos && this.mousedownPos.dist(point) >= this.clickTolerance) {
46
+ return;
47
+ }
48
+ this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
49
+ }
50
+ dblclick(e) {
51
+ return this.firePreventable(new import_events.MapMouseEvent(e.type, this.map, e));
52
+ }
53
+ mouseover(e) {
54
+ this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
55
+ }
56
+ mouseout(e) {
57
+ this.map.emit(e.type, new import_events.MapMouseEvent(e.type, this.map, e));
58
+ }
59
+ touchstart(e) {
60
+ return this.firePreventable(new import_events.MapTouchEvent(e.type, this.map, e));
61
+ }
62
+ touchmove(e) {
63
+ this.map.emit(e.type, new import_events.MapTouchEvent(e.type, this.map, e));
64
+ }
65
+ touchend(e) {
66
+ this.map.emit(e.type, new import_events.MapTouchEvent(e.type, this.map, e));
67
+ }
68
+ touchcancel(e) {
69
+ this.map.emit(e.type, new import_events.MapTouchEvent(e.type, this.map, e));
70
+ }
71
+ firePreventable(mapEvent) {
72
+ this.map.emit(mapEvent.type, mapEvent);
73
+ if (mapEvent.defaultPrevented) {
74
+ return {};
75
+ }
76
+ }
77
+ isEnabled() {
78
+ return true;
79
+ }
80
+ isActive() {
81
+ return false;
82
+ }
83
+ enable() {
84
+ return false;
85
+ }
86
+ disable() {
87
+ return false;
88
+ }
89
+ };
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {});
@@ -0,0 +1,38 @@
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/mouse/index.ts
23
+ var mouse_exports = {};
24
+ __export(mouse_exports, {
25
+ MousePanHandler: () => import_mousepan_handler.default,
26
+ MousePitchHandler: () => import_mouserotate_hander.default,
27
+ MouseRotateHandler: () => import_mousepitch_hander.default
28
+ });
29
+ module.exports = __toCommonJS(mouse_exports);
30
+ var import_mousepan_handler = __toESM(require("./mousepan_handler"));
31
+ var import_mousepitch_hander = __toESM(require("./mousepitch_hander"));
32
+ var import_mouserotate_hander = __toESM(require("./mouserotate_hander"));
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ MousePanHandler,
36
+ MousePitchHandler,
37
+ MouseRotateHandler
38
+ });
@@ -0,0 +1,103 @@
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/mouse/mouse_handler.ts
23
+ var mouse_handler_exports = {};
24
+ __export(mouse_handler_exports, {
25
+ default: () => MouseHandler
26
+ });
27
+ module.exports = __toCommonJS(mouse_handler_exports);
28
+ var import_dom = __toESM(require("../../utils/dom"));
29
+ var import_util = require("./util");
30
+ var MouseHandler = class {
31
+ constructor(options) {
32
+ this.reset();
33
+ this.clickTolerance = options.clickTolerance || 1;
34
+ }
35
+ reset() {
36
+ this.active = false;
37
+ this.moved = false;
38
+ delete this.lastPoint;
39
+ delete this.eventButton;
40
+ }
41
+ mousedown(e, point) {
42
+ if (this.lastPoint) {
43
+ return;
44
+ }
45
+ const eventButton = import_dom.default.mouseButton(e);
46
+ if (!this.correctButton(e, eventButton)) {
47
+ return;
48
+ }
49
+ this.lastPoint = point;
50
+ this.eventButton = eventButton;
51
+ }
52
+ mousemoveWindow(e, point) {
53
+ const lastPoint = this.lastPoint;
54
+ if (!lastPoint) {
55
+ return;
56
+ }
57
+ e.preventDefault();
58
+ if ((0, import_util.buttonStillPressed)(e, this.eventButton)) {
59
+ this.reset();
60
+ return;
61
+ }
62
+ if (!this.moved && point.dist(lastPoint) < this.clickTolerance) {
63
+ return;
64
+ }
65
+ this.moved = true;
66
+ this.lastPoint = point;
67
+ return this.move(lastPoint, point);
68
+ }
69
+ mouseupWindow(e) {
70
+ if (!this.lastPoint) {
71
+ return;
72
+ }
73
+ const eventButton = import_dom.default.mouseButton(e);
74
+ if (eventButton !== this.eventButton) {
75
+ return;
76
+ }
77
+ if (this.moved) {
78
+ import_dom.default.suppressClick();
79
+ }
80
+ this.reset();
81
+ }
82
+ enable() {
83
+ this.enabled = true;
84
+ }
85
+ disable() {
86
+ this.enabled = false;
87
+ this.reset();
88
+ }
89
+ isEnabled() {
90
+ return this.enabled;
91
+ }
92
+ isActive() {
93
+ return this.active;
94
+ }
95
+ correctButton(e, button) {
96
+ return false;
97
+ }
98
+ move(lastPoint, point) {
99
+ return;
100
+ }
101
+ };
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {});
@@ -0,0 +1,48 @@
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/mouse/mousepan_handler.ts
23
+ var mousepan_handler_exports = {};
24
+ __export(mousepan_handler_exports, {
25
+ default: () => MousePanHandler
26
+ });
27
+ module.exports = __toCommonJS(mousepan_handler_exports);
28
+ var import_mouse_handler = __toESM(require("./mouse_handler"));
29
+ var import_util = require("./util");
30
+ var MousePanHandler = class extends import_mouse_handler.default {
31
+ mousedown(e, point) {
32
+ super.mousedown(e, point);
33
+ if (this.lastPoint) {
34
+ this.active = true;
35
+ }
36
+ }
37
+ move(lastPoint, point) {
38
+ return {
39
+ around: point,
40
+ panDelta: point.sub(lastPoint)
41
+ };
42
+ }
43
+ correctButton(e, button) {
44
+ return button === import_util.LEFT_BUTTON && !e.ctrlKey;
45
+ }
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {});
@@ -0,0 +1,47 @@
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/mouse/mousepitch_hander.ts
23
+ var mousepitch_hander_exports = {};
24
+ __export(mousepitch_hander_exports, {
25
+ default: () => MousePitchHandler
26
+ });
27
+ module.exports = __toCommonJS(mousepitch_hander_exports);
28
+ var import_mouse_handler = __toESM(require("./mouse_handler"));
29
+ var import_util = require("./util");
30
+ var MousePitchHandler = class extends import_mouse_handler.default {
31
+ correctButton(e, button) {
32
+ return button === import_util.LEFT_BUTTON && e.ctrlKey || button === import_util.RIGHT_BUTTON;
33
+ }
34
+ move(lastPoint, point) {
35
+ const degreesPerPixelMoved = -0.5;
36
+ const pitchDelta = (point.y - lastPoint.y) * degreesPerPixelMoved;
37
+ if (pitchDelta) {
38
+ this.active = true;
39
+ return { pitchDelta };
40
+ }
41
+ }
42
+ contextmenu(e) {
43
+ e.preventDefault();
44
+ }
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {});
@@ -0,0 +1,47 @@
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/mouse/mouserotate_hander.ts
23
+ var mouserotate_hander_exports = {};
24
+ __export(mouserotate_hander_exports, {
25
+ default: () => MouseRotateHandler
26
+ });
27
+ module.exports = __toCommonJS(mouserotate_hander_exports);
28
+ var import_mouse_handler = __toESM(require("./mouse_handler"));
29
+ var import_util = require("./util");
30
+ var MouseRotateHandler = class extends import_mouse_handler.default {
31
+ contextmenu(e) {
32
+ e.preventDefault();
33
+ }
34
+ correctButton(e, button) {
35
+ return button === import_util.LEFT_BUTTON && e.ctrlKey || button === import_util.RIGHT_BUTTON;
36
+ }
37
+ move(lastPoint, point) {
38
+ const degreesPerPixelMoved = 0.8;
39
+ const bearingDelta = (point.x - lastPoint.x) * degreesPerPixelMoved;
40
+ if (bearingDelta) {
41
+ this.active = true;
42
+ return { bearingDelta };
43
+ }
44
+ }
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {});
@@ -0,0 +1,44 @@
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/mouse/util.ts
20
+ var util_exports = {};
21
+ __export(util_exports, {
22
+ BUTTONS_FLAGS: () => BUTTONS_FLAGS,
23
+ LEFT_BUTTON: () => LEFT_BUTTON,
24
+ RIGHT_BUTTON: () => RIGHT_BUTTON,
25
+ buttonStillPressed: () => buttonStillPressed
26
+ });
27
+ module.exports = __toCommonJS(util_exports);
28
+ var LEFT_BUTTON = 0;
29
+ var RIGHT_BUTTON = 2;
30
+ var BUTTONS_FLAGS = {
31
+ [LEFT_BUTTON]: 1,
32
+ [RIGHT_BUTTON]: 2
33
+ };
34
+ function buttonStillPressed(e, button) {
35
+ const flag = BUTTONS_FLAGS[button];
36
+ return e.buttons === void 0 || (e.buttons & flag) !== flag;
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ BUTTONS_FLAGS,
41
+ LEFT_BUTTON,
42
+ RIGHT_BUTTON,
43
+ buttonStillPressed
44
+ });
@@ -0,0 +1,225 @@
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/scroll_zoom.ts
23
+ var scroll_zoom_exports = {};
24
+ __export(scroll_zoom_exports, {
25
+ default: () => scroll_zoom_default
26
+ });
27
+ module.exports = __toCommonJS(scroll_zoom_exports);
28
+ var import_lng_lat = __toESM(require("../geo/lng_lat"));
29
+ var import_util = require("../util");
30
+ var import_dom = __toESM(require("../utils/dom"));
31
+ var wheelZoomDelta = 4.000244140625;
32
+ var defaultZoomRate = 1 / 100;
33
+ var wheelZoomRate = 1 / 450;
34
+ var maxScalePerFrame = 2;
35
+ var ScrollZoomHandler = class {
36
+ constructor(map, handler) {
37
+ this.onScrollFrame = () => {
38
+ if (!this.frameId) {
39
+ return;
40
+ }
41
+ this.frameId = null;
42
+ if (!this.isActive()) {
43
+ return;
44
+ }
45
+ const tr = this.map.transform;
46
+ if (this.delta !== 0) {
47
+ const zoomRate = this.type === "wheel" && Math.abs(this.delta) > wheelZoomDelta ? this.wheelZoomRate : this.defaultZoomRate;
48
+ let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this.delta * zoomRate)));
49
+ if (this.delta < 0 && scale !== 0) {
50
+ scale = 1 / scale;
51
+ }
52
+ const fromScale = typeof this.targetZoom === "number" ? tr.zoomScale(this.targetZoom) : tr.scale;
53
+ this.targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));
54
+ if (this.type === "wheel") {
55
+ this.startZoom = tr.zoom;
56
+ this.easing = this.smoothOutEasing(200);
57
+ }
58
+ this.delta = 0;
59
+ }
60
+ const targetZoom = typeof this.targetZoom === "number" ? this.targetZoom : tr.zoom;
61
+ const startZoom = this.startZoom;
62
+ const easing = this.easing;
63
+ let finished = false;
64
+ let zoom;
65
+ if (this.type === "wheel" && startZoom && easing) {
66
+ const t = Math.min(((0, import_util.now)() - this.lastWheelEventTime) / 200, 1);
67
+ const k = easing(t);
68
+ zoom = (0, import_util.interpolate)(startZoom, targetZoom, k);
69
+ if (t < 1) {
70
+ if (!this.frameId) {
71
+ this.frameId = true;
72
+ }
73
+ } else {
74
+ finished = true;
75
+ }
76
+ } else {
77
+ zoom = targetZoom;
78
+ finished = true;
79
+ }
80
+ this.active = true;
81
+ if (finished) {
82
+ this.active = false;
83
+ this.finishTimeout = setTimeout(() => {
84
+ this.zooming = false;
85
+ this.handler.triggerRenderFrame();
86
+ delete this.targetZoom;
87
+ delete this.finishTimeout;
88
+ }, 200);
89
+ }
90
+ return {
91
+ noInertia: true,
92
+ needsRenderFrame: !finished,
93
+ zoomDelta: zoom - tr.zoom,
94
+ around: this.aroundPoint,
95
+ originalEvent: this.lastWheelEvent
96
+ };
97
+ };
98
+ this.map = map;
99
+ this.el = map.getCanvasContainer();
100
+ this.handler = handler;
101
+ this.delta = 0;
102
+ this.defaultZoomRate = defaultZoomRate;
103
+ this.wheelZoomRate = wheelZoomRate;
104
+ }
105
+ setZoomRate(zoomRate) {
106
+ this.defaultZoomRate = zoomRate;
107
+ }
108
+ setWheelZoomRate(zoomRate) {
109
+ this.wheelZoomRate = zoomRate;
110
+ }
111
+ isEnabled() {
112
+ return !!this.enabled;
113
+ }
114
+ isActive() {
115
+ return !!this.active || this.finishTimeout !== void 0;
116
+ }
117
+ isZooming() {
118
+ return !!this.zooming;
119
+ }
120
+ enable(options) {
121
+ if (this.isEnabled()) {
122
+ return;
123
+ }
124
+ this.enabled = true;
125
+ this.aroundCenter = options && options.around === "center";
126
+ }
127
+ disable() {
128
+ if (!this.isEnabled()) {
129
+ return;
130
+ }
131
+ this.enabled = false;
132
+ }
133
+ wheel(e) {
134
+ if (!this.isEnabled()) {
135
+ return;
136
+ }
137
+ let value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
138
+ const nowTime = (0, import_util.now)();
139
+ const timeDelta = nowTime - (this.lastWheelEventTime || 0);
140
+ this.lastWheelEventTime = nowTime;
141
+ if (value !== 0 && value % wheelZoomDelta === 0) {
142
+ this.type = "wheel";
143
+ } else if (value !== 0 && Math.abs(value) < 4) {
144
+ this.type = "trackpad";
145
+ } else if (timeDelta > 400) {
146
+ this.type = null;
147
+ this.lastValue = value;
148
+ this.timeout = setTimeout(this.onTimeout, 40, e);
149
+ } else if (!this.type) {
150
+ this.type = Math.abs(timeDelta * value) < 200 ? "trackpad" : "wheel";
151
+ if (this.timeout) {
152
+ clearTimeout(this.timeout);
153
+ this.timeout = null;
154
+ value += this.lastValue;
155
+ }
156
+ }
157
+ if (e.shiftKey && value) {
158
+ value = value / 4;
159
+ }
160
+ if (this.type) {
161
+ this.lastWheelEvent = e;
162
+ this.delta -= value;
163
+ if (!this.active) {
164
+ this.start(e);
165
+ }
166
+ }
167
+ e.preventDefault();
168
+ }
169
+ renderFrame() {
170
+ return this.onScrollFrame();
171
+ }
172
+ reset() {
173
+ this.active = false;
174
+ }
175
+ onTimeout(initialEvent) {
176
+ this.type = "wheel";
177
+ this.delta -= this.lastValue;
178
+ if (!this.active && this.start) {
179
+ this.start(initialEvent);
180
+ }
181
+ }
182
+ start(e) {
183
+ if (!this.delta) {
184
+ return;
185
+ }
186
+ if (this.frameId) {
187
+ this.frameId = null;
188
+ }
189
+ this.active = true;
190
+ if (!this.isZooming()) {
191
+ this.zooming = true;
192
+ }
193
+ if (this.finishTimeout) {
194
+ clearTimeout(this.finishTimeout);
195
+ delete this.finishTimeout;
196
+ }
197
+ const pos = import_dom.default.mousePos(this.el, e);
198
+ this.around = import_lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
199
+ this.aroundPoint = this.map.transform.locationPoint(this.around);
200
+ if (!this.frameId) {
201
+ this.frameId = true;
202
+ this.handler.triggerRenderFrame();
203
+ }
204
+ }
205
+ smoothOutEasing(duration) {
206
+ let easing = import_util.ease;
207
+ if (this.prevEase) {
208
+ const preEase = this.prevEase;
209
+ const t = ((0, import_util.now)() - preEase.start) / preEase.duration;
210
+ const speed = preEase.easing(t + 0.01) - preEase.easing(t);
211
+ const x = 0.27 / Math.sqrt(speed * speed + 1e-4) * 0.01;
212
+ const y = Math.sqrt(0.27 * 0.27 - x * x);
213
+ easing = (0, import_util.bezier)(x, y, 0.25, 1);
214
+ }
215
+ this.prevEase = {
216
+ start: (0, import_util.now)(),
217
+ duration,
218
+ easing
219
+ };
220
+ return easing;
221
+ }
222
+ };
223
+ var scroll_zoom_default = ScrollZoomHandler;
224
+ // Annotate the CommonJS export names for ESM import in node:
225
+ 0 && (module.exports = {});
@@ -0,0 +1,46 @@
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/dblclick_zoom.ts
20
+ var dblclick_zoom_exports = {};
21
+ __export(dblclick_zoom_exports, {
22
+ default: () => DoubleClickZoomHandler
23
+ });
24
+ module.exports = __toCommonJS(dblclick_zoom_exports);
25
+ var DoubleClickZoomHandler = class {
26
+ constructor(clickZoom, TapZoom) {
27
+ this.clickZoom = clickZoom;
28
+ this.tapZoom = TapZoom;
29
+ }
30
+ enable() {
31
+ this.clickZoom.enable();
32
+ this.tapZoom.enable();
33
+ }
34
+ disable() {
35
+ this.clickZoom.disable();
36
+ this.tapZoom.disable();
37
+ }
38
+ isEnabled() {
39
+ return this.clickZoom.isEnabled() && this.tapZoom.isEnabled();
40
+ }
41
+ isActive() {
42
+ return this.clickZoom.isActive() || this.tapZoom.isActive();
43
+ }
44
+ };
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {});