@antv/l7-map 2.9.21 → 2.9.22-alpha.0

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 (223) hide show
  1. package/es/camera.js +115 -85
  2. package/es/css/l7.css +98 -0
  3. package/es/earthmap.js +27 -43
  4. package/es/geo/edge_insets.js +44 -14
  5. package/es/geo/lng_lat.js +15 -11
  6. package/es/geo/lng_lat_bounds.js +6 -10
  7. package/es/geo/mercator.js +24 -12
  8. package/es/geo/point.js +2 -8
  9. package/es/geo/simple.js +24 -12
  10. package/es/geo/transform.js +421 -120
  11. package/es/handler/IHandler.js +1 -2
  12. package/es/handler/blockable_map_event.js +13 -14
  13. package/es/handler/box_zoom.js +43 -27
  14. package/es/handler/click_zoom.js +3 -8
  15. package/es/handler/events/event.js +3 -6
  16. package/es/handler/events/index.js +4 -5
  17. package/es/handler/events/map_mouse_event.js +30 -20
  18. package/es/handler/events/map_touch_event.js +55 -25
  19. package/es/handler/events/map_wheel_event.js +24 -15
  20. package/es/handler/events/render_event.js +3 -6
  21. package/es/handler/handler_inertia.js +10 -12
  22. package/es/handler/handler_manager.js +75 -72
  23. package/es/handler/handler_util.js +2 -2
  24. package/es/handler/keyboard.js +20 -15
  25. package/es/handler/map_event.js +23 -12
  26. package/es/handler/mouse/index.js +4 -5
  27. package/es/handler/mouse/mouse_handler.js +17 -21
  28. package/es/handler/mouse/mousepan_handler.js +5 -5
  29. package/es/handler/mouse/mousepitch_hander.js +7 -5
  30. package/es/handler/mouse/mouserotate_hander.js +7 -5
  31. package/es/handler/mouse/util.js +3 -3
  32. package/es/handler/scroll_zoom.js +103 -67
  33. package/es/handler/shim/dblclick_zoom.js +35 -8
  34. package/es/handler/shim/drag_pan.js +48 -12
  35. package/es/handler/shim/drag_rotate.js +39 -10
  36. package/es/handler/shim/touch_zoom_rotate.js +59 -16
  37. package/es/handler/tap/single_tap_recognizer.js +7 -17
  38. package/es/handler/tap/tap_drag_zoom.js +5 -18
  39. package/es/handler/tap/tap_recognizer.js +4 -15
  40. package/es/handler/tap/tap_zoom.js +4 -13
  41. package/es/handler/touch/index.js +5 -6
  42. package/es/handler/touch/touch_pan.js +9 -20
  43. package/es/handler/touch/touch_pitch.js +11 -23
  44. package/es/handler/touch/touch_rotate.js +15 -18
  45. package/es/handler/touch/touch_zoom.js +5 -19
  46. package/es/handler/touch/two_touch.js +14 -21
  47. package/es/hash.js +28 -16
  48. package/es/index.js +2 -3
  49. package/es/interface.js +1 -2
  50. package/es/map.js +26 -47
  51. package/es/util.js +15 -6
  52. package/es/utils/Aabb.js +11 -12
  53. package/es/utils/dom.js +30 -11
  54. package/es/utils/performance.js +10 -6
  55. package/es/utils/primitives.js +11 -10
  56. package/es/utils/task_queue.js +6 -13
  57. package/lib/camera.js +508 -721
  58. package/lib/css/l7.css +98 -0
  59. package/lib/earthmap.js +222 -392
  60. package/lib/geo/edge_insets.js +64 -83
  61. package/lib/geo/lng_lat.js +65 -81
  62. package/lib/geo/lng_lat_bounds.js +124 -165
  63. package/lib/geo/mercator.js +62 -78
  64. package/lib/geo/point.js +171 -239
  65. package/lib/geo/simple.js +61 -80
  66. package/lib/geo/transform.js +470 -653
  67. package/lib/handler/IHandler.js +17 -2
  68. package/lib/handler/blockable_map_event.js +63 -83
  69. package/lib/handler/box_zoom.js +123 -176
  70. package/lib/handler/click_zoom.js +56 -68
  71. package/lib/handler/events/event.js +35 -23
  72. package/lib/handler/events/index.js +35 -29
  73. package/lib/handler/events/map_mouse_event.js +42 -72
  74. package/lib/handler/events/map_touch_event.js +45 -80
  75. package/lib/handler/events/map_wheel_event.js +34 -58
  76. package/lib/handler/events/render_event.js +31 -52
  77. package/lib/handler/handler_inertia.js +113 -160
  78. package/lib/handler/handler_manager.js +379 -620
  79. package/lib/handler/handler_util.js +28 -10
  80. package/lib/handler/keyboard.js +114 -146
  81. package/lib/handler/map_event.js +84 -120
  82. package/lib/handler/mouse/index.js +35 -29
  83. package/lib/handler/mouse/mouse_handler.js +90 -123
  84. package/lib/handler/mouse/mousepan_handler.js +46 -65
  85. package/lib/handler/mouse/mousepitch_hander.js +44 -63
  86. package/lib/handler/mouse/mouserotate_hander.js +44 -63
  87. package/lib/handler/mouse/util.js +38 -20
  88. package/lib/handler/scroll_zoom.js +175 -258
  89. package/lib/handler/shim/dblclick_zoom.js +42 -48
  90. package/lib/handler/shim/drag_pan.js +48 -59
  91. package/lib/handler/shim/drag_rotate.js +43 -51
  92. package/lib/handler/shim/touch_zoom_rotate.js +58 -78
  93. package/lib/handler/tap/single_tap_recognizer.js +84 -117
  94. package/lib/handler/tap/tap_drag_zoom.js +92 -115
  95. package/lib/handler/tap/tap_recognizer.js +60 -78
  96. package/lib/handler/tap/tap_zoom.js +88 -119
  97. package/lib/handler/touch/index.js +38 -37
  98. package/lib/handler/touch/touch_pan.js +98 -132
  99. package/lib/handler/touch/touch_pitch.js +73 -117
  100. package/lib/handler/touch/touch_rotate.js +58 -94
  101. package/lib/handler/touch/touch_zoom.js +49 -84
  102. package/lib/handler/touch/two_touch.js +88 -128
  103. package/lib/hash.js +100 -133
  104. package/lib/index.js +19 -31
  105. package/lib/interface.js +17 -2
  106. package/lib/map.js +238 -420
  107. package/lib/util.js +67 -78
  108. package/lib/utils/Aabb.js +80 -132
  109. package/lib/utils/dom.js +84 -141
  110. package/lib/utils/performance.js +54 -42
  111. package/lib/utils/primitives.js +59 -51
  112. package/lib/utils/task_queue.js +61 -108
  113. package/package.json +11 -8
  114. package/es/camera.js.map +0 -1
  115. package/es/earthmap.js.map +0 -1
  116. package/es/geo/edge_insets.js.map +0 -1
  117. package/es/geo/lng_lat.js.map +0 -1
  118. package/es/geo/lng_lat_bounds.js.map +0 -1
  119. package/es/geo/mercator.js.map +0 -1
  120. package/es/geo/point.js.map +0 -1
  121. package/es/geo/simple.js.map +0 -1
  122. package/es/geo/transform.js.map +0 -1
  123. package/es/handler/IHandler.js.map +0 -1
  124. package/es/handler/blockable_map_event.js.map +0 -1
  125. package/es/handler/box_zoom.js.map +0 -1
  126. package/es/handler/click_zoom.js.map +0 -1
  127. package/es/handler/events/event.js.map +0 -1
  128. package/es/handler/events/index.js.map +0 -1
  129. package/es/handler/events/map_mouse_event.js.map +0 -1
  130. package/es/handler/events/map_touch_event.js.map +0 -1
  131. package/es/handler/events/map_wheel_event.js.map +0 -1
  132. package/es/handler/events/render_event.js.map +0 -1
  133. package/es/handler/handler_inertia.js.map +0 -1
  134. package/es/handler/handler_manager.js.map +0 -1
  135. package/es/handler/handler_util.js.map +0 -1
  136. package/es/handler/keyboard.js.map +0 -1
  137. package/es/handler/map_event.js.map +0 -1
  138. package/es/handler/mouse/index.js.map +0 -1
  139. package/es/handler/mouse/mouse_handler.js.map +0 -1
  140. package/es/handler/mouse/mousepan_handler.js.map +0 -1
  141. package/es/handler/mouse/mousepitch_hander.js.map +0 -1
  142. package/es/handler/mouse/mouserotate_hander.js.map +0 -1
  143. package/es/handler/mouse/util.js.map +0 -1
  144. package/es/handler/scroll_zoom.js.map +0 -1
  145. package/es/handler/shim/dblclick_zoom.js.map +0 -1
  146. package/es/handler/shim/drag_pan.js.map +0 -1
  147. package/es/handler/shim/drag_rotate.js.map +0 -1
  148. package/es/handler/shim/touch_zoom_rotate.js.map +0 -1
  149. package/es/handler/tap/single_tap_recognizer.js.map +0 -1
  150. package/es/handler/tap/tap_drag_zoom.js.map +0 -1
  151. package/es/handler/tap/tap_recognizer.js.map +0 -1
  152. package/es/handler/tap/tap_zoom.js.map +0 -1
  153. package/es/handler/touch/index.js.map +0 -1
  154. package/es/handler/touch/touch_pan.js.map +0 -1
  155. package/es/handler/touch/touch_pitch.js.map +0 -1
  156. package/es/handler/touch/touch_rotate.js.map +0 -1
  157. package/es/handler/touch/touch_zoom.js.map +0 -1
  158. package/es/handler/touch/two_touch.js.map +0 -1
  159. package/es/hash.js.map +0 -1
  160. package/es/index.js.map +0 -1
  161. package/es/interface.js.map +0 -1
  162. package/es/map.js.map +0 -1
  163. package/es/util.js.map +0 -1
  164. package/es/utils/Aabb.js.map +0 -1
  165. package/es/utils/dom.js.map +0 -1
  166. package/es/utils/performance.js.map +0 -1
  167. package/es/utils/primitives.js.map +0 -1
  168. package/es/utils/task_queue.js.map +0 -1
  169. package/lib/camera.js.map +0 -1
  170. package/lib/earthmap.js.map +0 -1
  171. package/lib/geo/edge_insets.js.map +0 -1
  172. package/lib/geo/lng_lat.js.map +0 -1
  173. package/lib/geo/lng_lat_bounds.js.map +0 -1
  174. package/lib/geo/mercator.js.map +0 -1
  175. package/lib/geo/point.js.map +0 -1
  176. package/lib/geo/simple.js.map +0 -1
  177. package/lib/geo/transform.js.map +0 -1
  178. package/lib/handler/IHandler.js.map +0 -1
  179. package/lib/handler/blockable_map_event.js.map +0 -1
  180. package/lib/handler/box_zoom.js.map +0 -1
  181. package/lib/handler/click_zoom.js.map +0 -1
  182. package/lib/handler/events/event.js.map +0 -1
  183. package/lib/handler/events/index.js.map +0 -1
  184. package/lib/handler/events/map_mouse_event.js.map +0 -1
  185. package/lib/handler/events/map_touch_event.js.map +0 -1
  186. package/lib/handler/events/map_wheel_event.js.map +0 -1
  187. package/lib/handler/events/render_event.js.map +0 -1
  188. package/lib/handler/handler_inertia.js.map +0 -1
  189. package/lib/handler/handler_manager.js.map +0 -1
  190. package/lib/handler/handler_util.js.map +0 -1
  191. package/lib/handler/keyboard.js.map +0 -1
  192. package/lib/handler/map_event.js.map +0 -1
  193. package/lib/handler/mouse/index.js.map +0 -1
  194. package/lib/handler/mouse/mouse_handler.js.map +0 -1
  195. package/lib/handler/mouse/mousepan_handler.js.map +0 -1
  196. package/lib/handler/mouse/mousepitch_hander.js.map +0 -1
  197. package/lib/handler/mouse/mouserotate_hander.js.map +0 -1
  198. package/lib/handler/mouse/util.js.map +0 -1
  199. package/lib/handler/scroll_zoom.js.map +0 -1
  200. package/lib/handler/shim/dblclick_zoom.js.map +0 -1
  201. package/lib/handler/shim/drag_pan.js.map +0 -1
  202. package/lib/handler/shim/drag_rotate.js.map +0 -1
  203. package/lib/handler/shim/touch_zoom_rotate.js.map +0 -1
  204. package/lib/handler/tap/single_tap_recognizer.js.map +0 -1
  205. package/lib/handler/tap/tap_drag_zoom.js.map +0 -1
  206. package/lib/handler/tap/tap_recognizer.js.map +0 -1
  207. package/lib/handler/tap/tap_zoom.js.map +0 -1
  208. package/lib/handler/touch/index.js.map +0 -1
  209. package/lib/handler/touch/touch_pan.js.map +0 -1
  210. package/lib/handler/touch/touch_pitch.js.map +0 -1
  211. package/lib/handler/touch/touch_rotate.js.map +0 -1
  212. package/lib/handler/touch/touch_zoom.js.map +0 -1
  213. package/lib/handler/touch/two_touch.js.map +0 -1
  214. package/lib/hash.js.map +0 -1
  215. package/lib/index.js.map +0 -1
  216. package/lib/interface.js.map +0 -1
  217. package/lib/map.js.map +0 -1
  218. package/lib/util.js.map +0 -1
  219. package/lib/utils/Aabb.js.map +0 -1
  220. package/lib/utils/dom.js.map +0 -1
  221. package/lib/utils/performance.js.map +0 -1
  222. package/lib/utils/primitives.js.map +0 -1
  223. package/lib/utils/task_queue.js.map +0 -1
@@ -1,95 +1,76 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
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/geo/edge_insets.ts
23
+ var edge_insets_exports = {};
24
+ __export(edge_insets_exports, {
25
+ default: () => EdgeInsets
7
26
  });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- var _util = require("../util");
17
-
18
- var _point = _interopRequireDefault(require("./point"));
19
-
20
- var EdgeInsets = function () {
21
- function EdgeInsets() {
22
- var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
23
- var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
24
- var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
25
- var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
26
- (0, _classCallCheck2.default)(this, EdgeInsets);
27
- (0, _defineProperty2.default)(this, "top", void 0);
28
- (0, _defineProperty2.default)(this, "bottom", void 0);
29
- (0, _defineProperty2.default)(this, "left", void 0);
30
- (0, _defineProperty2.default)(this, "right", void 0);
31
-
27
+ module.exports = __toCommonJS(edge_insets_exports);
28
+ var import_util = require("../util");
29
+ var import_point = __toESM(require("./point"));
30
+ var EdgeInsets = class {
31
+ constructor(top = 0, bottom = 0, left = 0, right = 0) {
32
32
  if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
33
- throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
33
+ throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
34
34
  }
35
-
36
35
  this.top = top;
37
36
  this.bottom = bottom;
38
37
  this.left = left;
39
38
  this.right = right;
40
39
  }
41
-
42
- (0, _createClass2.default)(EdgeInsets, [{
43
- key: "interpolate",
44
- value: function interpolate(start, target, t) {
45
- if (target.top != null && start.top != null) {
46
- this.top = (0, _util.interpolate)(start.top, target.top, t);
47
- }
48
-
49
- if (target.bottom != null && start.bottom != null) {
50
- this.bottom = (0, _util.interpolate)(start.bottom, target.bottom, t);
51
- }
52
-
53
- if (target.left != null && start.left != null) {
54
- this.left = (0, _util.interpolate)(start.left, target.left, t);
55
- }
56
-
57
- if (target.right != null && start.right != null) {
58
- this.right = (0, _util.interpolate)(start.right, target.right, t);
59
- }
60
-
61
- return this;
62
- }
63
- }, {
64
- key: "getCenter",
65
- value: function getCenter(width, height) {
66
- var x = (0, _util.clamp)((this.left + width - this.right) / 2, 0, width);
67
- var y = (0, _util.clamp)((this.top + height - this.bottom) / 2, 0, height);
68
- return new _point.default(x, y);
40
+ interpolate(start, target, t) {
41
+ if (target.top != null && start.top != null) {
42
+ this.top = (0, import_util.interpolate)(start.top, target.top, t);
69
43
  }
70
- }, {
71
- key: "equals",
72
- value: function equals(other) {
73
- return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
44
+ if (target.bottom != null && start.bottom != null) {
45
+ this.bottom = (0, import_util.interpolate)(start.bottom, target.bottom, t);
74
46
  }
75
- }, {
76
- key: "clone",
77
- value: function clone() {
78
- return new EdgeInsets(this.top, this.bottom, this.left, this.right);
47
+ if (target.left != null && start.left != null) {
48
+ this.left = (0, import_util.interpolate)(start.left, target.left, t);
79
49
  }
80
- }, {
81
- key: "toJSON",
82
- value: function toJSON() {
83
- return {
84
- top: this.top,
85
- bottom: this.bottom,
86
- left: this.left,
87
- right: this.right
88
- };
50
+ if (target.right != null && start.right != null) {
51
+ this.right = (0, import_util.interpolate)(start.right, target.right, t);
89
52
  }
90
- }]);
91
- return EdgeInsets;
92
- }();
93
-
94
- exports.default = EdgeInsets;
95
- //# sourceMappingURL=edge_insets.js.map
53
+ return this;
54
+ }
55
+ getCenter(width, height) {
56
+ const x = (0, import_util.clamp)((this.left + width - this.right) / 2, 0, width);
57
+ const y = (0, import_util.clamp)((this.top + height - this.bottom) / 2, 0, height);
58
+ return new import_point.default(x, y);
59
+ }
60
+ equals(other) {
61
+ return this.top === other.top && this.bottom === other.bottom && this.left === other.left && this.right === other.right;
62
+ }
63
+ clone() {
64
+ return new EdgeInsets(this.top, this.bottom, this.left, this.right);
65
+ }
66
+ toJSON() {
67
+ return {
68
+ top: this.top,
69
+ bottom: this.bottom,
70
+ left: this.left,
71
+ right: this.right
72
+ };
73
+ }
74
+ };
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {});
@@ -1,89 +1,73 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
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/geo/lng_lat.ts
20
+ var lng_lat_exports = {};
21
+ __export(lng_lat_exports, {
22
+ default: () => LngLat,
23
+ earthRadius: () => earthRadius
7
24
  });
8
- exports.earthRadius = exports.default = void 0;
9
-
10
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
- var _util = require("../util");
19
-
20
- var earthRadius = 6371008.8;
21
- exports.earthRadius = earthRadius;
22
-
23
- var LngLat = function () {
24
- function LngLat(lng, lat) {
25
- (0, _classCallCheck2.default)(this, LngLat);
26
- (0, _defineProperty2.default)(this, "lng", void 0);
27
- (0, _defineProperty2.default)(this, "lat", void 0);
28
-
25
+ module.exports = __toCommonJS(lng_lat_exports);
26
+ var import_util = require("../util");
27
+ var earthRadius = 63710088e-1;
28
+ var LngLat = class {
29
+ static convert(input) {
30
+ if (input instanceof LngLat) {
31
+ return input;
32
+ }
33
+ if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
34
+ return new LngLat(Number(input[0]), Number(input[1]));
35
+ }
36
+ if (!Array.isArray(input) && typeof input === "object" && input !== null) {
37
+ const lng = "lng" in input ? input.lng : input.lon;
38
+ return new LngLat(Number(lng), Number(input.lat));
39
+ }
40
+ throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]");
41
+ }
42
+ constructor(lng, lat) {
29
43
  if (isNaN(lng) || isNaN(lat)) {
30
- throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
44
+ throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
31
45
  }
32
-
33
46
  this.lng = +lng;
34
47
  this.lat = +lat;
35
-
36
48
  if (this.lat > 90 || this.lat < -90) {
37
- throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
49
+ throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
38
50
  }
39
51
  }
40
-
41
- (0, _createClass2.default)(LngLat, [{
42
- key: "wrap",
43
- value: function wrap() {
44
- return new LngLat((0, _util.wrap)(this.lng, -180, 180), this.lat);
45
- }
46
- }, {
47
- key: "toArray",
48
- value: function toArray() {
49
- return [this.lng, this.lat];
50
- }
51
- }, {
52
- key: "toString",
53
- value: function toString() {
54
- return "LngLat(".concat(this.lng, ", ").concat(this.lat, ")");
55
- }
56
- }, {
57
- key: "distanceTo",
58
- value: function distanceTo(lngLat) {
59
- var rad = Math.PI / 180;
60
- var lat1 = this.lat * rad;
61
- var lat2 = lngLat.lat * rad;
62
- var a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
63
- var maxMeters = earthRadius * Math.acos(Math.min(a, 1));
64
- return maxMeters;
65
- }
66
- }], [{
67
- key: "convert",
68
- value: function convert(input) {
69
- if (input instanceof LngLat) {
70
- return input;
71
- }
72
-
73
- if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
74
- return new LngLat(Number(input[0]), Number(input[1]));
75
- }
76
-
77
- if (!Array.isArray(input) && (0, _typeof2.default)(input) === 'object' && input !== null) {
78
- var lng = 'lng' in input ? input.lng : input.lon;
79
- return new LngLat(Number(lng), Number(input.lat));
80
- }
81
-
82
- throw new Error('`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]');
83
- }
84
- }]);
85
- return LngLat;
86
- }();
87
-
88
- exports.default = LngLat;
89
- //# sourceMappingURL=lng_lat.js.map
52
+ wrap() {
53
+ return new LngLat((0, import_util.wrap)(this.lng, -180, 180), this.lat);
54
+ }
55
+ toArray() {
56
+ return [this.lng, this.lat];
57
+ }
58
+ toString() {
59
+ return `LngLat(${this.lng}, ${this.lat})`;
60
+ }
61
+ distanceTo(lngLat) {
62
+ const rad = Math.PI / 180;
63
+ const lat1 = this.lat * rad;
64
+ const lat2 = lngLat.lat * rad;
65
+ const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
66
+ const maxMeters = earthRadius * Math.acos(Math.min(a, 1));
67
+ return maxMeters;
68
+ }
69
+ };
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ earthRadius
73
+ });
@@ -1,27 +1,41 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
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/geo/lng_lat_bounds.ts
23
+ var lng_lat_bounds_exports = {};
24
+ __export(lng_lat_bounds_exports, {
25
+ default: () => LngLatBounds
7
26
  });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- var _lng_lat = _interopRequireDefault(require("./lng_lat"));
17
-
18
- var LngLatBounds = function () {
19
- function LngLatBounds(sw, ne) {
20
- (0, _classCallCheck2.default)(this, LngLatBounds);
21
- (0, _defineProperty2.default)(this, "ne", void 0);
22
- (0, _defineProperty2.default)(this, "sw", void 0);
23
-
24
- if (!sw) {} else if (ne) {
27
+ module.exports = __toCommonJS(lng_lat_bounds_exports);
28
+ var import_lng_lat = __toESM(require("./lng_lat"));
29
+ var LngLatBounds = class {
30
+ static convert(input) {
31
+ if (input instanceof LngLatBounds) {
32
+ return input;
33
+ }
34
+ return new LngLatBounds(input);
35
+ }
36
+ constructor(sw, ne) {
37
+ if (!sw) {
38
+ } else if (ne) {
25
39
  this.setSouthWest(sw).setNorthEast(ne);
26
40
  } else if (sw.length === 4) {
27
41
  this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
@@ -29,151 +43,96 @@ var LngLatBounds = function () {
29
43
  this.setSouthWest(sw[0]).setNorthEast(sw[1]);
30
44
  }
31
45
  }
32
-
33
- (0, _createClass2.default)(LngLatBounds, [{
34
- key: "setNorthEast",
35
- value: function setNorthEast(ne) {
36
- this.ne = ne instanceof _lng_lat.default ? new _lng_lat.default(ne.lng, ne.lat) : _lng_lat.default.convert(ne);
37
- return this;
38
- }
39
- }, {
40
- key: "setSouthWest",
41
- value: function setSouthWest(sw) {
42
- this.sw = sw instanceof _lng_lat.default ? new _lng_lat.default(sw.lng, sw.lat) : _lng_lat.default.convert(sw);
43
- return this;
44
- }
45
- }, {
46
- key: "extend",
47
- value: function extend(obj) {
48
- var sw = this.sw;
49
- var ne = this.ne;
50
- var sw2;
51
- var ne2;
52
-
53
- if (obj instanceof _lng_lat.default) {
54
- sw2 = obj;
55
- ne2 = obj;
56
- } else if (obj instanceof LngLatBounds) {
57
- sw2 = obj.sw;
58
- ne2 = obj.ne;
59
-
60
- if (!sw2 || !ne2) {
61
- return this;
62
- }
63
- } else {
64
- if (Array.isArray(obj)) {
65
- if (obj.length === 4 || obj.every(Array.isArray)) {
66
- var lngLatBoundsObj = obj;
67
- return this.extend(LngLatBounds.convert(lngLatBoundsObj));
68
- } else {
69
- var lngLatObj = obj;
70
- return this.extend(_lng_lat.default.convert(lngLatObj));
71
- }
72
- }
73
-
46
+ setNorthEast(ne) {
47
+ this.ne = ne instanceof import_lng_lat.default ? new import_lng_lat.default(ne.lng, ne.lat) : import_lng_lat.default.convert(ne);
48
+ return this;
49
+ }
50
+ setSouthWest(sw) {
51
+ this.sw = sw instanceof import_lng_lat.default ? new import_lng_lat.default(sw.lng, sw.lat) : import_lng_lat.default.convert(sw);
52
+ return this;
53
+ }
54
+ extend(obj) {
55
+ const sw = this.sw;
56
+ const ne = this.ne;
57
+ let sw2;
58
+ let ne2;
59
+ if (obj instanceof import_lng_lat.default) {
60
+ sw2 = obj;
61
+ ne2 = obj;
62
+ } else if (obj instanceof LngLatBounds) {
63
+ sw2 = obj.sw;
64
+ ne2 = obj.ne;
65
+ if (!sw2 || !ne2) {
74
66
  return this;
75
67
  }
76
-
77
- if (!sw && !ne) {
78
- this.sw = new _lng_lat.default(sw2.lng, sw2.lat);
79
- this.ne = new _lng_lat.default(ne2.lng, ne2.lat);
80
- } else {
81
- sw.lng = Math.min(sw2.lng, sw.lng);
82
- sw.lat = Math.min(sw2.lat, sw.lat);
83
- ne.lng = Math.max(ne2.lng, ne.lng);
84
- ne.lat = Math.max(ne2.lat, ne.lat);
68
+ } else {
69
+ if (Array.isArray(obj)) {
70
+ if (obj.length === 4 || obj.every(Array.isArray)) {
71
+ const lngLatBoundsObj = obj;
72
+ return this.extend(LngLatBounds.convert(lngLatBoundsObj));
73
+ } else {
74
+ const lngLatObj = obj;
75
+ return this.extend(import_lng_lat.default.convert(lngLatObj));
76
+ }
85
77
  }
86
-
87
78
  return this;
88
79
  }
89
- }, {
90
- key: "getCenter",
91
- value: function getCenter() {
92
- return new _lng_lat.default((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
93
- }
94
- }, {
95
- key: "getSouthWest",
96
- value: function getSouthWest() {
97
- return this.sw;
98
- }
99
- }, {
100
- key: "getNorthEast",
101
- value: function getNorthEast() {
102
- return this.ne;
103
- }
104
- }, {
105
- key: "getNorthWest",
106
- value: function getNorthWest() {
107
- return new _lng_lat.default(this.getWest(), this.getNorth());
108
- }
109
- }, {
110
- key: "getSouthEast",
111
- value: function getSouthEast() {
112
- return new _lng_lat.default(this.getEast(), this.getSouth());
113
- }
114
- }, {
115
- key: "getWest",
116
- value: function getWest() {
117
- return this.sw.lng;
118
- }
119
- }, {
120
- key: "getSouth",
121
- value: function getSouth() {
122
- return this.sw.lat;
123
- }
124
- }, {
125
- key: "getEast",
126
- value: function getEast() {
127
- return this.ne.lng;
128
- }
129
- }, {
130
- key: "getNorth",
131
- value: function getNorth() {
132
- return this.ne.lat;
133
- }
134
- }, {
135
- key: "toArray",
136
- value: function toArray() {
137
- return [this.sw.toArray(), this.ne.toArray()];
138
- }
139
- }, {
140
- key: "toString",
141
- value: function toString() {
142
- return "LngLatBounds(".concat(this.sw.toString(), ", ").concat(this.ne.toString(), ")");
143
- }
144
- }, {
145
- key: "isEmpty",
146
- value: function isEmpty() {
147
- return !(this.sw && this.ne);
148
- }
149
- }, {
150
- key: "contains",
151
- value: function contains(lnglat) {
152
- var _LngLat$convert = _lng_lat.default.convert(lnglat),
153
- lng = _LngLat$convert.lng,
154
- lat = _LngLat$convert.lat;
155
-
156
- var containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
157
- var containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
158
-
159
- if (this.sw.lng > this.ne.lng) {
160
- containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
161
- }
162
-
163
- return containsLatitude && containsLongitude;
164
- }
165
- }], [{
166
- key: "convert",
167
- value: function convert(input) {
168
- if (input instanceof LngLatBounds) {
169
- return input;
170
- }
171
-
172
- return new LngLatBounds(input);
80
+ if (!sw && !ne) {
81
+ this.sw = new import_lng_lat.default(sw2.lng, sw2.lat);
82
+ this.ne = new import_lng_lat.default(ne2.lng, ne2.lat);
83
+ } else {
84
+ sw.lng = Math.min(sw2.lng, sw.lng);
85
+ sw.lat = Math.min(sw2.lat, sw.lat);
86
+ ne.lng = Math.max(ne2.lng, ne.lng);
87
+ ne.lat = Math.max(ne2.lat, ne.lat);
173
88
  }
174
- }]);
175
- return LngLatBounds;
176
- }();
177
-
178
- exports.default = LngLatBounds;
179
- //# sourceMappingURL=lng_lat_bounds.js.map
89
+ return this;
90
+ }
91
+ getCenter() {
92
+ return new import_lng_lat.default((this.sw.lng + this.ne.lng) / 2, (this.sw.lat + this.ne.lat) / 2);
93
+ }
94
+ getSouthWest() {
95
+ return this.sw;
96
+ }
97
+ getNorthEast() {
98
+ return this.ne;
99
+ }
100
+ getNorthWest() {
101
+ return new import_lng_lat.default(this.getWest(), this.getNorth());
102
+ }
103
+ getSouthEast() {
104
+ return new import_lng_lat.default(this.getEast(), this.getSouth());
105
+ }
106
+ getWest() {
107
+ return this.sw.lng;
108
+ }
109
+ getSouth() {
110
+ return this.sw.lat;
111
+ }
112
+ getEast() {
113
+ return this.ne.lng;
114
+ }
115
+ getNorth() {
116
+ return this.ne.lat;
117
+ }
118
+ toArray() {
119
+ return [this.sw.toArray(), this.ne.toArray()];
120
+ }
121
+ toString() {
122
+ return `LngLatBounds(${this.sw.toString()}, ${this.ne.toString()})`;
123
+ }
124
+ isEmpty() {
125
+ return !(this.sw && this.ne);
126
+ }
127
+ contains(lnglat) {
128
+ const { lng, lat } = import_lng_lat.default.convert(lnglat);
129
+ const containsLatitude = this.sw.lat <= lat && lat <= this.ne.lat;
130
+ let containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
131
+ if (this.sw.lng > this.ne.lng) {
132
+ containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
133
+ }
134
+ return containsLatitude && containsLongitude;
135
+ }
136
+ };
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {});