@antv/l7-map 2.9.19 → 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,10 +1,20 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import { clamp, interpolate as _interpolate } from '../util';
5
- import Point from './point';
3
+ // @ts-ignore
4
+ import { clamp, interpolate as _interpolate } from "../util";
5
+ import Point from "./point";
6
+ /**
7
+ * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
8
+ * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
9
+ * on top of the map and having the vanishing point shift as UI elements resize.
10
+ *
11
+ * @param {number} [top=0]
12
+ * @param {number} [bottom=0]
13
+ * @param {number} [left=0]
14
+ * @param {number} [right=0]
15
+ */
6
16
 
7
- var EdgeInsets = function () {
17
+ var EdgeInsets = /*#__PURE__*/function () {
8
18
  function EdgeInsets() {
9
19
  var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
10
20
  var bottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -13,14 +23,6 @@ var EdgeInsets = function () {
13
23
 
14
24
  _classCallCheck(this, EdgeInsets);
15
25
 
16
- _defineProperty(this, "top", void 0);
17
-
18
- _defineProperty(this, "bottom", void 0);
19
-
20
- _defineProperty(this, "left", void 0);
21
-
22
- _defineProperty(this, "right", void 0);
23
-
24
26
  if (isNaN(top) || top < 0 || isNaN(bottom) || bottom < 0 || isNaN(left) || left < 0 || isNaN(right) || right < 0) {
25
27
  throw new Error('Invalid value for edge-insets, top, bottom, left and right must all be numbers');
26
28
  }
@@ -30,6 +32,16 @@ var EdgeInsets = function () {
30
32
  this.left = left;
31
33
  this.right = right;
32
34
  }
35
+ /**
36
+ * Interpolates the inset in-place.
37
+ * This maintains the current inset value for any inset not present in `target`.
38
+ *
39
+ * @param {PaddingOptions} target
40
+ * @param {number} t
41
+ * @returns {EdgeInsets}
42
+ * @memberof EdgeInsets
43
+ */
44
+
33
45
 
34
46
  _createClass(EdgeInsets, [{
35
47
  key: "interpolate",
@@ -52,9 +64,20 @@ var EdgeInsets = function () {
52
64
 
53
65
  return this;
54
66
  }
67
+ /**
68
+ * Utility method that computes the new apprent center or vanishing point after applying insets.
69
+ * This is in pixels and with the top left being (0.0) and +y being downwards.
70
+ *
71
+ * @param {number} width
72
+ * @param {number} height
73
+ * @returns {Point}
74
+ * @memberof EdgeInsets
75
+ */
76
+
55
77
  }, {
56
78
  key: "getCenter",
57
79
  value: function getCenter(width, height) {
80
+ // Clamp insets so they never overflow width/height and always calculate a valid center
58
81
  var x = clamp((this.left + width - this.right) / 2, 0, width);
59
82
  var y = clamp((this.top + height - this.bottom) / 2, 0, height);
60
83
  return new Point(x, y);
@@ -69,6 +92,14 @@ var EdgeInsets = function () {
69
92
  value: function clone() {
70
93
  return new EdgeInsets(this.top, this.bottom, this.left, this.right);
71
94
  }
95
+ /**
96
+ * Returns the current sdtate as json, useful when you want to have a
97
+ * read-only representation of the inset.
98
+ *
99
+ * @returns {PaddingOptions}
100
+ * @memberof EdgeInsets
101
+ */
102
+
72
103
  }, {
73
104
  key: "toJSON",
74
105
  value: function toJSON() {
@@ -84,5 +115,4 @@ var EdgeInsets = function () {
84
115
  return EdgeInsets;
85
116
  }();
86
117
 
87
- export { EdgeInsets as default };
88
- //# sourceMappingURL=edge_insets.js.map
118
+ export { EdgeInsets as default };
package/es/geo/lng_lat.js CHANGED
@@ -1,18 +1,13 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import { wrap as _wrap } from '../util';
4
+ import { wrap as _wrap } from "../util";
6
5
  export var earthRadius = 6371008.8;
7
6
 
8
- var LngLat = function () {
7
+ var LngLat = /*#__PURE__*/function () {
9
8
  function LngLat(lng, lat) {
10
9
  _classCallCheck(this, LngLat);
11
10
 
12
- _defineProperty(this, "lng", void 0);
13
-
14
- _defineProperty(this, "lat", void 0);
15
-
16
11
  if (isNaN(lng) || isNaN(lat)) {
17
12
  throw new Error("Invalid LngLat object: (".concat(lng, ", ").concat(lat, ")"));
18
13
  }
@@ -34,7 +29,16 @@ var LngLat = function () {
34
29
  key: "toArray",
35
30
  value: function toArray() {
36
31
  return [this.lng, this.lat];
37
- }
32
+ } // public toBounds(radius: number = 0) {
33
+ // const earthCircumferenceInMetersAtEquator = 40075017;
34
+ // const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
35
+ // const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
36
+ // return new LngLatBounds(
37
+ // new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
38
+ // new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
39
+ // );
40
+ // }
41
+
38
42
  }, {
39
43
  key: "toString",
40
44
  value: function toString() {
@@ -63,7 +67,8 @@ var LngLat = function () {
63
67
 
64
68
  if (!Array.isArray(input) && _typeof(input) === 'object' && input !== null) {
65
69
  var lng = 'lng' in input ? input.lng : input.lon;
66
- return new LngLat(Number(lng), Number(input.lat));
70
+ return new LngLat( // flow can't refine this to have one of lng or lat, so we have to cast to any
71
+ Number(lng), Number(input.lat));
67
72
  }
68
73
 
69
74
  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>]');
@@ -73,5 +78,4 @@ var LngLat = function () {
73
78
  return LngLat;
74
79
  }();
75
80
 
76
- export { LngLat as default };
77
- //# sourceMappingURL=lng_lat.js.map
81
+ export { LngLat as default };
@@ -1,17 +1,13 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import LngLat from './lng_lat';
3
+ import LngLat from "./lng_lat";
5
4
 
6
- var LngLatBounds = function () {
5
+ var LngLatBounds = /*#__PURE__*/function () {
7
6
  function LngLatBounds(sw, ne) {
8
7
  _classCallCheck(this, LngLatBounds);
9
8
 
10
- _defineProperty(this, "ne", void 0);
11
-
12
- _defineProperty(this, "sw", void 0);
13
-
14
- if (!sw) {} else if (ne) {
9
+ if (!sw) {// noop
10
+ } else if (ne) {
15
11
  this.setSouthWest(sw).setNorthEast(ne);
16
12
  } else if (sw.length === 4) {
17
13
  this.setSouthWest([sw[0], sw[1]]).setNorthEast([sw[2], sw[3]]);
@@ -147,6 +143,7 @@ var LngLatBounds = function () {
147
143
  var containsLongitude = this.sw.lng <= lng && lng <= this.ne.lng;
148
144
 
149
145
  if (this.sw.lng > this.ne.lng) {
146
+ // wrapped coordinates
150
147
  containsLongitude = this.sw.lng >= lng && lng >= this.ne.lng;
151
148
  }
152
149
 
@@ -166,5 +163,4 @@ var LngLatBounds = function () {
166
163
  return LngLatBounds;
167
164
  }();
168
165
 
169
- export { LngLatBounds as default };
170
- //# sourceMappingURL=lng_lat_bounds.js.map
166
+ export { LngLatBounds as default };
@@ -1,8 +1,15 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import LngLat, { earthRadius } from '../geo/lng_lat';
5
- var earthCircumfrence = 2 * Math.PI * earthRadius;
3
+ import LngLat, { earthRadius } from "../geo/lng_lat";
4
+ /*
5
+ * The average circumference of the world in meters.
6
+ */
7
+
8
+ var earthCircumfrence = 2 * Math.PI * earthRadius; // meters
9
+
10
+ /*
11
+ * The circumference at a line of latitude in meters.
12
+ */
6
13
 
7
14
  function circumferenceAtLatitude(latitude) {
8
15
  return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
@@ -27,22 +34,27 @@ export function latFromMercatorY(y) {
27
34
  export function altitudeFromMercatorZ(z, y) {
28
35
  return z * circumferenceAtLatitude(latFromMercatorY(y));
29
36
  }
37
+ /**
38
+ * Determine the Mercator scale factor for a given latitude, see
39
+ * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
40
+ *
41
+ * At the equator the scale factor will be 1, which increases at higher latitudes.
42
+ *
43
+ * @param {number} lat Latitude
44
+ * @returns {number} scale factor
45
+ * @private
46
+ */
47
+
30
48
  export function mercatorScale(lat) {
31
49
  return 1 / Math.cos(lat * Math.PI / 180);
32
50
  }
33
51
 
34
- var MercatorCoordinate = function () {
52
+ var MercatorCoordinate = /*#__PURE__*/function () {
35
53
  function MercatorCoordinate(x, y) {
36
54
  var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
37
55
 
38
56
  _classCallCheck(this, MercatorCoordinate);
39
57
 
40
- _defineProperty(this, "x", void 0);
41
-
42
- _defineProperty(this, "y", void 0);
43
-
44
- _defineProperty(this, "z", void 0);
45
-
46
58
  this.x = +x;
47
59
  this.y = +y;
48
60
  this.z = +z;
@@ -61,6 +73,7 @@ var MercatorCoordinate = function () {
61
73
  }, {
62
74
  key: "meterInMercatorCoordinateUnits",
63
75
  value: function meterInMercatorCoordinateUnits() {
76
+ // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
64
77
  return 1 / earthCircumfrence * mercatorScale(latFromMercatorY(this.y));
65
78
  }
66
79
  }], [{
@@ -75,5 +88,4 @@ var MercatorCoordinate = function () {
75
88
  return MercatorCoordinate;
76
89
  }();
77
90
 
78
- export { MercatorCoordinate as default };
79
- //# sourceMappingURL=mercator.js.map
91
+ export { MercatorCoordinate as default };
package/es/geo/point.js CHANGED
@@ -1,15 +1,10 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
3
 
5
- var Point = function () {
4
+ var Point = /*#__PURE__*/function () {
6
5
  function Point(x, y) {
7
6
  _classCallCheck(this, Point);
8
7
 
9
- _defineProperty(this, "x", void 0);
10
-
11
- _defineProperty(this, "y", void 0);
12
-
13
8
  this.x = x;
14
9
  this.y = y;
15
10
  }
@@ -233,5 +228,4 @@ var Point = function () {
233
228
  return Point;
234
229
  }();
235
230
 
236
- export { Point as default };
237
- //# sourceMappingURL=point.js.map
231
+ export { Point as default };
package/es/geo/simple.js CHANGED
@@ -1,8 +1,15 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import LngLat, { earthRadius } from '../geo/lng_lat';
5
- var earthCircumfrence = 2 * Math.PI * earthRadius;
3
+ import LngLat, { earthRadius } from "../geo/lng_lat";
4
+ /*
5
+ * The average circumference of the world in meters.
6
+ */
7
+
8
+ var earthCircumfrence = 2 * Math.PI * earthRadius; // meters
9
+
10
+ /*
11
+ * The circumference at a line of latitude in meters.
12
+ */
6
13
 
7
14
  function circumferenceAtLatitude(latitude) {
8
15
  return earthCircumfrence * Math.cos(latitude * Math.PI / 180);
@@ -26,22 +33,27 @@ export function latFromMercatorY(y) {
26
33
  export function altitudeFromMercatorZ(z, y) {
27
34
  return z;
28
35
  }
36
+ /**
37
+ * Determine the Mercator scale factor for a given latitude, see
38
+ * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
39
+ *
40
+ * At the equator the scale factor will be 1, which increases at higher latitudes.
41
+ *
42
+ * @param {number} lat Latitude
43
+ * @returns {number} scale factor
44
+ * @private
45
+ */
46
+
29
47
  export function mercatorScale(lat) {
30
48
  return 1;
31
49
  }
32
50
 
33
- var SimpleCoordinate = function () {
51
+ var SimpleCoordinate = /*#__PURE__*/function () {
34
52
  function SimpleCoordinate(x, y) {
35
53
  var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
36
54
 
37
55
  _classCallCheck(this, SimpleCoordinate);
38
56
 
39
- _defineProperty(this, "x", void 0);
40
-
41
- _defineProperty(this, "y", void 0);
42
-
43
- _defineProperty(this, "z", void 0);
44
-
45
57
  this.x = +x;
46
58
  this.y = +y;
47
59
  this.z = +z;
@@ -60,6 +72,7 @@ var SimpleCoordinate = function () {
60
72
  }, {
61
73
  key: "meterInMercatorCoordinateUnits",
62
74
  value: function meterInMercatorCoordinateUnits() {
75
+ // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
63
76
  return 1;
64
77
  }
65
78
  }], [{
@@ -74,5 +87,4 @@ var SimpleCoordinate = function () {
74
87
  return SimpleCoordinate;
75
88
  }();
76
89
 
77
- export { SimpleCoordinate as default };
78
- //# sourceMappingURL=simple.js.map
90
+ export { SimpleCoordinate as default };