maplair 4.1.0 → 4.3.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 (213) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/esm/Maplair.js +5 -4
  3. package/dist/esm/Maplair.js.map +1 -1
  4. package/dist/esm/_virtual/_rolldown/runtime.js +1 -2
  5. package/dist/esm/control/AttributionControl.js +1 -2
  6. package/dist/esm/control/ButtonControl.js +1 -2
  7. package/dist/esm/control/ContextMenu.js +1 -2
  8. package/dist/esm/control/Control.js +1 -2
  9. package/dist/esm/control/FullscreenControl.js +1 -2
  10. package/dist/esm/control/LayersControl.js +27 -31
  11. package/dist/esm/control/LayersControl.js.map +1 -1
  12. package/dist/esm/control/LegendControl.js +1 -2
  13. package/dist/esm/control/MiniMapControl.js +1 -2
  14. package/dist/esm/control/RotateControl.js +1 -2
  15. package/dist/esm/control/ScaleControl.js +1 -2
  16. package/dist/esm/control/SearchControl.js +1 -2
  17. package/dist/esm/control/SideBySideControl.js +1 -2
  18. package/dist/esm/control/TextControl.js +1 -2
  19. package/dist/esm/control/TimeControl.js +1 -2
  20. package/dist/esm/control/ZoomControl.js +18 -29
  21. package/dist/esm/control/ZoomControl.js.map +1 -1
  22. package/dist/esm/core/Class.js +2 -9
  23. package/dist/esm/core/Class.js.map +1 -1
  24. package/dist/esm/core/Events.js +2 -2
  25. package/dist/esm/core/Events.js.map +1 -1
  26. package/dist/esm/core/Handler.js +10 -3
  27. package/dist/esm/core/Handler.js.map +1 -1
  28. package/dist/esm/core/I18n.js +1 -2
  29. package/dist/esm/core/Util.js +2 -3
  30. package/dist/esm/core/Util.js.map +1 -1
  31. package/dist/esm/dom/DomEvent.DoubleTap.js +1 -2
  32. package/dist/esm/dom/DomEvent.PointerEvents.js +1 -2
  33. package/dist/esm/dom/DomEvent.js +10 -18
  34. package/dist/esm/dom/DomEvent.js.map +1 -1
  35. package/dist/esm/dom/DomUtil.js +1 -2
  36. package/dist/esm/dom/Draggable.js +4 -3
  37. package/dist/esm/dom/Draggable.js.map +1 -1
  38. package/dist/esm/dom/PosAnimation.js +1 -2
  39. package/dist/esm/geo/LatLng.js +1 -2
  40. package/dist/esm/geo/LatLngBounds.js +9 -15
  41. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  42. package/dist/esm/geo/crs/CRS.js +1 -2
  43. package/dist/esm/geo/crs/EPSG3395.js +4 -5
  44. package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
  45. package/dist/esm/geo/crs/EPSG3857.js +4 -5
  46. package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
  47. package/dist/esm/geo/crs/EPSG4326.js +3 -4
  48. package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
  49. package/dist/esm/geo/crs/EarthCRS.js +1 -2
  50. package/dist/esm/geo/crs/SimpleCRS.js +3 -4
  51. package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
  52. package/dist/esm/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +4 -5
  53. package/dist/esm/geo/projection/LonLatProjection.js.map +1 -0
  54. package/dist/esm/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +3 -4
  55. package/dist/esm/geo/projection/MercatorProjection.js.map +1 -0
  56. package/dist/esm/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +4 -5
  57. package/dist/esm/geo/projection/SphericalMercatorProjection.js.map +1 -0
  58. package/dist/esm/geometry/Bounds.js +10 -14
  59. package/dist/esm/geometry/Bounds.js.map +1 -1
  60. package/dist/esm/geometry/LineUtil.js +2 -3
  61. package/dist/esm/geometry/LineUtil.js.map +1 -1
  62. package/dist/esm/geometry/Point.js +1 -2
  63. package/dist/esm/geometry/PolyUtil.js +17 -25
  64. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  65. package/dist/esm/geometry/Transformation.js +1 -2
  66. package/dist/esm/layer/BlanketOverlay.js +1 -2
  67. package/dist/esm/layer/Classification.js +1 -2
  68. package/dist/esm/layer/DivOverlay.js +2 -3
  69. package/dist/esm/layer/DivOverlay.js.map +1 -1
  70. package/dist/esm/layer/FeatureGroup.js +5 -4
  71. package/dist/esm/layer/FeatureGroup.js.map +1 -1
  72. package/dist/esm/layer/GeoJSON.Load.js +1 -2
  73. package/dist/esm/layer/GeoJSON.js +8 -10
  74. package/dist/esm/layer/GeoJSON.js.map +1 -1
  75. package/dist/esm/layer/GeoJSONUtil.js +1 -2
  76. package/dist/esm/layer/HeatLayer.js +2 -3
  77. package/dist/esm/layer/HeatLayer.js.map +1 -1
  78. package/dist/esm/layer/ImageOverlay.js +2 -3
  79. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  80. package/dist/esm/layer/Layer.js +1 -2
  81. package/dist/esm/layer/LayerGroup.js +2 -3
  82. package/dist/esm/layer/LayerGroup.js.map +1 -1
  83. package/dist/esm/layer/Popup.js +9 -16
  84. package/dist/esm/layer/Popup.js.map +1 -1
  85. package/dist/esm/layer/SVGOverlay.js +1 -2
  86. package/dist/esm/layer/Tooltip.js +16 -17
  87. package/dist/esm/layer/Tooltip.js.map +1 -1
  88. package/dist/esm/layer/VideoOverlay.js +1 -2
  89. package/dist/esm/layer/marker/DefaultIcon.js +29 -7
  90. package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
  91. package/dist/esm/layer/marker/DivIcon.js +1 -2
  92. package/dist/esm/layer/marker/Icon.js +2 -2
  93. package/dist/esm/layer/marker/Icon.js.map +1 -1
  94. package/dist/esm/layer/marker/Marker.Drag.js +43 -4
  95. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  96. package/dist/esm/layer/marker/Marker.Move.js +4 -6
  97. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  98. package/dist/esm/layer/marker/Marker.js +54 -14
  99. package/dist/esm/layer/marker/Marker.js.map +1 -1
  100. package/dist/esm/layer/marker/MarkerClusterGroup.js +1 -2
  101. package/dist/esm/layer/marker/SvgIcon.js +1 -2
  102. package/dist/esm/layer/tile/GridLayer.js +4 -4
  103. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  104. package/dist/esm/layer/tile/TileLayer.js +8 -8
  105. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  106. package/dist/esm/layer/tile/WMSTileLayer.js +5 -4
  107. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  108. package/dist/esm/layer/vector/Canvas.js +7 -14
  109. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  110. package/dist/esm/layer/vector/Circle.js +5 -3
  111. package/dist/esm/layer/vector/Circle.js.map +1 -1
  112. package/dist/esm/layer/vector/CircleMarker.js +2 -3
  113. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  114. package/dist/esm/layer/vector/Path.DashAnimation.js +1 -2
  115. package/dist/esm/layer/vector/Path.ZoomStyles.js +1 -2
  116. package/dist/esm/layer/vector/Path.js +1 -2
  117. package/dist/esm/layer/vector/Polygon.js +2 -3
  118. package/dist/esm/layer/vector/Polygon.js.map +1 -1
  119. package/dist/esm/layer/vector/Polyline.Decorations.js +1 -2
  120. package/dist/esm/layer/vector/Polyline.js +2 -3
  121. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  122. package/dist/esm/layer/vector/Rectangle.js +1 -2
  123. package/dist/esm/layer/vector/Renderer.getRenderer.js +4 -5
  124. package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
  125. package/dist/esm/layer/vector/Renderer.js +1 -2
  126. package/dist/esm/layer/vector/SVG.js +7 -4
  127. package/dist/esm/layer/vector/SVG.js.map +1 -1
  128. package/dist/esm/map/Hash.js +1 -2
  129. package/dist/esm/map/Map.Rotation.js +31 -16
  130. package/dist/esm/map/Map.Rotation.js.map +1 -1
  131. package/dist/esm/map/Map.js +10 -17
  132. package/dist/esm/map/Map.js.map +1 -1
  133. package/dist/esm/map/MapSync.js +1 -2
  134. package/dist/esm/map/handler/BoxZoomHandler.js +20 -40
  135. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  136. package/dist/esm/map/handler/DisplaceHandler.js +1 -2
  137. package/dist/esm/map/handler/DoubleClickZoomHandler.js +1 -2
  138. package/dist/esm/map/handler/DragHandler.js +1 -2
  139. package/dist/esm/map/handler/KeyboardHandler.js +23 -43
  140. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  141. package/dist/esm/map/handler/PinchZoomHandler.js +1 -2
  142. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +1 -2
  143. package/dist/esm/map/handler/TapDragZoomHandler.js +1 -2
  144. package/dist/esm/map/handler/TapHoldHandler.js +1 -2
  145. package/dist/esm/package.js +2 -3
  146. package/dist/maplair-global-src.js +489 -613
  147. package/dist/maplair-global-src.js.map +1 -1
  148. package/dist/maplair-global.js +2 -2
  149. package/dist/maplair-global.js.map +1 -1
  150. package/dist/maplair-src.js +485 -609
  151. package/dist/maplair-src.js.map +1 -1
  152. package/dist/maplair.css +1 -1263
  153. package/dist/maplair.js +2 -2
  154. package/dist/maplair.js.map +1 -1
  155. package/package.json +4 -8
  156. package/src/Maplair.all.js +0 -1
  157. package/src/control/LayersControl.js +39 -52
  158. package/src/control/ZoomControl.js +17 -31
  159. package/src/core/Class.js +5 -14
  160. package/src/core/Events.js +2 -0
  161. package/src/core/Handler.js +11 -1
  162. package/src/core/Util.js +1 -1
  163. package/src/dom/DomEvent.js +9 -19
  164. package/src/dom/Draggable.js +5 -1
  165. package/src/geo/LatLngBounds.js +8 -15
  166. package/src/geo/crs/EPSG3395.js +3 -3
  167. package/src/geo/crs/EPSG3857.js +3 -3
  168. package/src/geo/crs/EPSG4326.js +2 -2
  169. package/src/geo/crs/SimpleCRS.js +2 -2
  170. package/src/geo/index.js +1 -2
  171. package/src/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +1 -1
  172. package/src/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +1 -1
  173. package/src/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +1 -1
  174. package/src/geo/projection/index.js +5 -5
  175. package/src/geometry/Bounds.js +12 -17
  176. package/src/geometry/LineUtil.js +1 -1
  177. package/src/geometry/PolyUtil.js +23 -31
  178. package/src/layer/DivOverlay.js +1 -1
  179. package/src/layer/FeatureGroup.js +8 -2
  180. package/src/layer/GeoJSON.js +10 -13
  181. package/src/layer/HeatLayer.js +1 -1
  182. package/src/layer/ImageOverlay.js +2 -2
  183. package/src/layer/LayerGroup.js +1 -1
  184. package/src/layer/Popup.js +9 -19
  185. package/src/layer/Tooltip.js +19 -17
  186. package/src/layer/marker/DefaultIcon.js +33 -5
  187. package/src/layer/marker/Icon.js +2 -0
  188. package/src/layer/marker/Marker.Drag.js +53 -5
  189. package/src/layer/marker/Marker.Move.js +3 -4
  190. package/src/layer/marker/Marker.js +64 -13
  191. package/src/layer/tile/GridLayer.js +5 -2
  192. package/src/layer/tile/TileLayer.js +9 -6
  193. package/src/layer/tile/WMSTileLayer.js +5 -2
  194. package/src/layer/vector/Canvas.js +10 -14
  195. package/src/layer/vector/Circle.js +7 -1
  196. package/src/layer/vector/CircleMarker.js +2 -1
  197. package/src/layer/vector/Polygon.js +1 -1
  198. package/src/layer/vector/Polyline.js +1 -1
  199. package/src/layer/vector/Renderer.getRenderer.js +4 -3
  200. package/src/layer/vector/SVG.js +12 -2
  201. package/src/map/Map.Rotation.js +28 -4
  202. package/src/map/Map.js +17 -21
  203. package/src/map/handler/BoxZoomHandler.js +21 -42
  204. package/src/map/handler/KeyboardHandler.js +34 -53
  205. package/src/maplair.css +5 -0
  206. package/dist/esm/geo/projection/Projection.LonLat.js.map +0 -1
  207. package/dist/esm/geo/projection/Projection.Mercator.js.map +0 -1
  208. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +0 -1
  209. package/dist/esm/geo/projection/index.js +0 -14
  210. package/dist/esm/geo/projection/index.js.map +0 -1
  211. package/dist/esm/layer/marker/Marker.Rotation.js +0 -70
  212. package/dist/esm/layer/marker/Marker.Rotation.js.map +0 -1
  213. package/src/layer/marker/Marker.Rotation.js +0 -103
@@ -1,9 +1,9 @@
1
1
  /* @preserve
2
- * Maplair 4.1.0, a JS library for interactive maps. https://maplair.org
2
+ * Maplair 4.3.0, a JS library for interactive maps. https://maplair.org
3
3
  * (c) 2026 Simon Legner and Maplair contributors, (c) 2010-2026 Volodymyr Agafonkin, (c) 2010-2011 CloudMade
4
4
  */
5
5
 
6
- //#region \0rolldown/runtime.js
6
+ // \0rolldown/runtime.js
7
7
  var __defProp = Object.defineProperty;
8
8
  var __exportAll = (all, no_symbols) => {
9
9
  let target = {};
@@ -14,11 +14,9 @@ var __exportAll = (all, no_symbols) => {
14
14
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
15
  return target;
16
16
  };
17
- //#endregion
18
- //#region package.json
19
- var version$1 = "4.1.0";
20
- //#endregion
21
- //#region src/core/Util.js
17
+ // package.json
18
+ var version$1 = "4.3.0";
19
+ // src/core/Util.js
22
20
  var Util_exports = /* @__PURE__ */ __exportAll({
23
21
  falseFn: () => falseFn,
24
22
  formatNum: () => formatNum,
@@ -76,7 +74,7 @@ function throttle(fn, time, context) {
76
74
  }
77
75
  /**
78
76
  * Returns the number `x` modulo `range` in such a way so it lies within
79
- * `range[0]` and `range[1]`. The returned value will be always smaller than
77
+ * `range[0]` and `range[1]`. The returned value will always be smaller than
80
78
  * `range[1]` unless `includeMax` is set to `true`.
81
79
  * @param {number} x
82
80
  * @param {[number, number]} range
@@ -158,8 +156,7 @@ function template(str, data) {
158
156
  return value;
159
157
  });
160
158
  }
161
- //#endregion
162
- //#region src/core/Class.js
159
+ // src/core/Class.js
163
160
  /**
164
161
  * Class powers the OOP facilities of Maplair and is used to create almost all of the
165
162
  * Maplair classes documented here.
@@ -317,15 +314,9 @@ var Class = class {
317
314
  * @returns {T}
318
315
  */
319
316
  static include(props) {
320
- for (const k of getAllMethodNames(props)) if (k !== "constructor" && k !== "options") this.prototype[k] = props[k];
317
+ for (let obj = props; obj && obj !== Object.prototype; obj = Object.getPrototypeOf(obj)) for (const k of Object.getOwnPropertyNames(obj)) if (k !== "constructor" && k !== "options") this.prototype[k] = props[k];
321
318
  if (props.options) this.mergeOptions(props.options);
322
319
  return this;
323
- function* getAllMethodNames(obj) {
324
- do {
325
- if (obj === Object || obj === Object.prototype) break;
326
- for (const k of Object.getOwnPropertyNames(obj)) yield k;
327
- } while ((obj = Object.getPrototypeOf(obj)) !== null);
328
- }
329
320
  }
330
321
  /**
331
322
  * [Merges `options`](#class-options) into the `defaultOptions` of the class.
@@ -390,8 +381,7 @@ var Class = class {
390
381
  return this;
391
382
  }
392
383
  };
393
- //#endregion
394
- //#region src/geometry/Point.js
384
+ // src/geometry/Point.js
395
385
  /**
396
386
  * A point in pixels: a `Point`, an array of the form `[x, y]`, or a plain object of
397
387
  * the form `{x, y}`. Accepted by all Maplair methods and options which accept `Point`
@@ -644,8 +634,7 @@ var Point = class Point {
644
634
  return `Point(${formatNum(this.x)}, ${formatNum(this.y)})`;
645
635
  }
646
636
  };
647
- //#endregion
648
- //#region src/dom/DomEvent.DoubleTap.js
637
+ // src/dom/DomEvent.DoubleTap.js
649
638
  function makeDblclick(ev) {
650
639
  const init = {
651
640
  bubbles: ev.bubbles,
@@ -732,8 +721,7 @@ function removeDoubleTapListener(obj, handlers) {
732
721
  obj.removeEventListener("pointerdown", handlers.onPointerDown, true);
733
722
  obj.removeEventListener("click", handlers.simDblclick);
734
723
  }
735
- //#endregion
736
- //#region src/dom/DomEvent.PointerEvents.js
724
+ // src/dom/DomEvent.PointerEvents.js
737
725
  var DomEvent_PointerEvents_exports = /* @__PURE__ */ __exportAll({
738
726
  disablePointerDetection: () => disablePointerDetection,
739
727
  enablePointerDetection: () => enablePointerDetection,
@@ -784,8 +772,7 @@ function _onDelete(e) {
784
772
  function getPointers() {
785
773
  return [...activePointers.values()];
786
774
  }
787
- //#endregion
788
- //#region src/dom/DomEvent.js
775
+ // src/dom/DomEvent.js
789
776
  var DomEvent_exports = /* @__PURE__ */ __exportAll({
790
777
  PointerEvents: () => DomEvent_PointerEvents_exports,
791
778
  disableClickPropagation: () => disableClickPropagation,
@@ -811,12 +798,11 @@ var DomEvent_exports = /* @__PURE__ */ __exportAll({
811
798
  * @param {string|Record<string, (ev: any) => void>} types
812
799
  * @param {((ev: any) => void)|object} [fn]
813
800
  * @param {object} [context]
814
- * @returns {typeof import('./DomEvent.js')}
801
+ * @returns {void}
815
802
  */
816
803
  function on(obj, types, fn, context) {
817
804
  if (types && typeof types === "object") for (const [type, listener] of Object.entries(types)) addOne(obj, type, listener, fn);
818
805
  else for (const type of splitWords(types)) addOne(obj, type, fn, context);
819
- return this;
820
806
  }
821
807
  const eventsKey = "_maplair_events";
822
808
  /**
@@ -830,7 +816,7 @@ const eventsKey = "_maplair_events";
830
816
  * @param {string|Record<string, (ev: any) => void>} [types]
831
817
  * @param {((ev: any) => void)|object} [fn]
832
818
  * @param {object} [context]
833
- * @returns {typeof import('./DomEvent.js')}
819
+ * @returns {void}
834
820
  */
835
821
  function off(obj, types, fn, context) {
836
822
  if (arguments.length === 1) {
@@ -842,7 +828,6 @@ function off(obj, types, fn, context) {
842
828
  if (arguments.length === 2) batchRemove(obj, (type) => types.includes(type));
843
829
  else for (const type of types) removeOne(obj, type, fn, context);
844
830
  }
845
- return this;
846
831
  }
847
832
  const DIGIT_RE = /\d/;
848
833
  function batchRemove(obj, filterFn) {
@@ -853,7 +838,7 @@ function batchRemove(obj, filterFn) {
853
838
  }
854
839
  function addOne(obj, type, fn, context) {
855
840
  const id = type + stamp(fn) + (context ? `_${stamp(context)}` : "");
856
- if (obj[eventsKey] && obj[eventsKey][id]) return this;
841
+ if (obj[eventsKey] && obj[eventsKey][id]) return;
857
842
  let handler = function(e) {
858
843
  return fn.call(context || obj, e);
859
844
  };
@@ -865,7 +850,7 @@ function addOne(obj, type, fn, context) {
865
850
  function removeOne(obj, type, fn, context, id) {
866
851
  id ??= type + stamp(fn) + (context ? `_${stamp(context)}` : "");
867
852
  const handler = obj[eventsKey] && obj[eventsKey][id];
868
- if (!handler) return this;
853
+ if (!handler) return;
869
854
  if (type === "dblclick") removeDoubleTapListener(obj, handler);
870
855
  else obj.removeEventListener(type, handler, false);
871
856
  obj[eventsKey][id] = null;
@@ -878,22 +863,20 @@ function removeOne(obj, type, fn, context, id) {
878
863
  * ```
879
864
  * Also accepts a Maplair event with an `originalEvent`.
880
865
  * @param {Event|{originalEvent: Event}} e
881
- * @returns {typeof import('./DomEvent.js')}
866
+ * @returns {void}
882
867
  */
883
868
  function stopPropagation(e) {
884
869
  if (e.stopPropagation) e.stopPropagation();
885
870
  else if (e.originalEvent) e.originalEvent._stopped = true;
886
871
  else console.debug("Unsupported event", e);
887
- return this;
888
872
  }
889
873
  /**
890
874
  * Adds `stopPropagation` to the element's `'wheel'` events (plus browser variants).
891
875
  * @param {HTMLElement} el
892
- * @returns {typeof import('./DomEvent.js')}
876
+ * @returns {void}
893
877
  */
894
878
  function disableScrollPropagation(el) {
895
879
  addOne(el, "wheel", stopPropagation);
896
- return this;
897
880
  }
898
881
  /**
899
882
  * Adds `stopPropagation` to the element's `'dblclick'`, `'contextmenu'`
@@ -901,12 +884,11 @@ function disableScrollPropagation(el) {
901
884
  * For `'click'` events, prevents the map from handling the click
902
885
  * while still allowing the native DOM click event to propagate normally.
903
886
  * @param {HTMLElement} el
904
- * @returns {typeof import('./DomEvent.js')}
887
+ * @returns {void}
905
888
  */
906
889
  function disableClickPropagation(el) {
907
890
  on(el, "pointerdown dblclick contextmenu", stopPropagation);
908
891
  el["_maplair_disable_click"] = true;
909
- return this;
910
892
  }
911
893
  /**
912
894
  * Prevents the default action of the DOM Event `e` from happening (such as
@@ -914,21 +896,19 @@ function disableClickPropagation(el) {
914
896
  * with page reload when a `<form>` is submitted).
915
897
  * Use it inside listener functions.
916
898
  * @param {Event} e
917
- * @returns {typeof import('./DomEvent.js')}
899
+ * @returns {void}
918
900
  */
919
901
  function preventDefault(e) {
920
902
  e.preventDefault?.();
921
- return this;
922
903
  }
923
904
  /**
924
905
  * Does `stopPropagation` and `preventDefault` at the same time.
925
906
  * @param {Event} e
926
- * @returns {typeof import('./DomEvent.js')}
907
+ * @returns {void}
927
908
  */
928
909
  function stop(e) {
929
910
  preventDefault(e);
930
911
  stopPropagation(e);
931
- return this;
932
912
  }
933
913
  /**
934
914
  * Gets normalized pointer position from a DOM event relative to the
@@ -971,8 +951,7 @@ function getWheelDelta(e) {
971
951
  function isExternalTarget(el, e) {
972
952
  return !el.contains(e.relatedTarget);
973
953
  }
974
- //#endregion
975
- //#region src/dom/DomUtil.js
954
+ // src/dom/DomUtil.js
976
955
  var DomUtil_exports = /* @__PURE__ */ __exportAll({
977
956
  create: () => create,
978
957
  disableImageDrag: () => disableImageDrag,
@@ -1112,8 +1091,7 @@ function getScale(element) {
1112
1091
  boundingClientRect: rect
1113
1092
  };
1114
1093
  }
1115
- //#endregion
1116
- //#region src/control/Control.js
1094
+ // src/control/Control.js
1117
1095
  /** @import {MaplairMap} from '../map/Map.js' */
1118
1096
  /**
1119
1097
  * Options of `Control`, inherited by all controls.
@@ -1268,8 +1246,7 @@ var Control = class Control extends Class {
1268
1246
  MaplairMap.include(mapControlMethods);
1269
1247
  }
1270
1248
  };
1271
- //#endregion
1272
- //#region src/core/I18n.js
1249
+ // src/core/I18n.js
1273
1250
  /**
1274
1251
  * Utility functions to deal with translations.
1275
1252
  *
@@ -1338,8 +1315,7 @@ var I18n = class {
1338
1315
  }
1339
1316
  }
1340
1317
  };
1341
- //#endregion
1342
- //#region src/control/AttributionControl.js
1318
+ // src/control/AttributionControl.js
1343
1319
  /** @import {ControlOptions} from './Control.js' */
1344
1320
  /** @import {MaplairMap} from '../map/Map.js' */
1345
1321
  const mapleLeaf = "<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\">&#x1F341;</span>";
@@ -1492,8 +1468,7 @@ var AttributionControl = class AttributionControl extends Control {
1492
1468
  });
1493
1469
  }
1494
1470
  };
1495
- //#endregion
1496
- //#region src/control/ButtonControl.js
1471
+ // src/control/ButtonControl.js
1497
1472
  /** @import {ControlOptions} from './Control.js' */
1498
1473
  /** @import {MaplairMap} from '../map/Map.js' */
1499
1474
  /**
@@ -1705,8 +1680,7 @@ var ButtonBarControl = class ButtonBarControl extends Control {
1705
1680
  return this._buttons;
1706
1681
  }
1707
1682
  };
1708
- //#endregion
1709
- //#region src/core/Events.js
1683
+ // src/core/Events.js
1710
1684
  const warnedEvents = /* @__PURE__ */ new Set();
1711
1685
  /** @import {LatLng} from '../geo/LatLng.js' */
1712
1686
  /** @import {LatLngBounds} from '../geo/LatLngBounds.js' */
@@ -2088,13 +2062,13 @@ var Evented = class Evented extends Class {
2088
2062
  }
2089
2063
  _propagateEvent(e) {
2090
2064
  for (const p of Object.values(this._eventParents ?? {})) p.fire(e.type, {
2065
+ layer: e.target,
2091
2066
  propagatedFrom: e.target,
2092
2067
  ...e
2093
2068
  }, true);
2094
2069
  }
2095
2070
  };
2096
- //#endregion
2097
- //#region src/layer/Layer.js
2071
+ // src/layer/Layer.js
2098
2072
  /** @import {MaplairMap} from '../map/Map.js' */
2099
2073
  /** @import {LayerGroup} from './LayerGroup.js' */
2100
2074
  /** @import {EventListener, MaplairEvent, MaplairPointerEvent, LayerEvent} from '../core/Events.js' */
@@ -2415,8 +2389,7 @@ var Layer = class extends Evented {
2415
2389
  MaplairMap.include(mapLayerMethods);
2416
2390
  }
2417
2391
  };
2418
- //#endregion
2419
- //#region src/control/ContextMenu.js
2392
+ // src/control/ContextMenu.js
2420
2393
  /** @import {MaplairMap} from '../map/Map.js' */
2421
2394
  /** @import {LatLng} from '../geo/LatLng.js' */
2422
2395
  /** @import {Point} from '../geometry/Point.js' */
@@ -2578,8 +2551,7 @@ var ContextMenu = class ContextMenu extends Class {
2578
2551
  buttons.at(next % buttons.length)?.focus();
2579
2552
  }
2580
2553
  };
2581
- //#endregion
2582
- //#region src/control/FullscreenControl.js
2554
+ // src/control/FullscreenControl.js
2583
2555
  /** @import {ControlOptions} from './Control.js' */
2584
2556
  /** @import {MaplairMap} from '../map/Map.js' */
2585
2557
  /** @import {MaplairEvent} from '../core/Events.js' */
@@ -2755,8 +2727,7 @@ var FullscreenControl = class FullscreenControl extends Control {
2755
2727
  });
2756
2728
  }
2757
2729
  };
2758
- //#endregion
2759
- //#region src/control/LayersControl.js
2730
+ // src/control/LayersControl.js
2760
2731
  /** @import {ControlOptions} from './Control.js' */
2761
2732
  /** @import {MaplairMap} from '../map/Map.js' */
2762
2733
  /** @import {Layer} from '../layer/Layer.js' */
@@ -2935,6 +2906,7 @@ var LayersControl = class LayersControl extends Control {
2935
2906
  this._map.off("zoomend", this._checkDisabledLayers, this);
2936
2907
  for (const layer of this._layers) layer.layer.off("add remove", this._onLayerChange, this);
2937
2908
  this._map.off("resize", this._expandIfNotCollapsed, this);
2909
+ this._map.off("click", this.collapse, this);
2938
2910
  }
2939
2911
  /**
2940
2912
  * Adds a base layer (radio button entry) with the given name to the control.
@@ -2963,8 +2935,7 @@ var LayersControl = class LayersControl extends Control {
2963
2935
  */
2964
2936
  removeLayer(layer) {
2965
2937
  layer.off("add remove", this._onLayerChange, this);
2966
- const obj = this._getLayer(stamp(layer));
2967
- if (obj) this._layers.splice(this._layers.indexOf(obj), 1);
2938
+ this._layers = this._layers.filter((o) => o.layer !== layer);
2968
2939
  return this._map ? this._update() : this;
2969
2940
  }
2970
2941
  /**
@@ -2988,7 +2959,7 @@ var LayersControl = class LayersControl extends Control {
2988
2959
  * @returns {this}
2989
2960
  */
2990
2961
  selectLayer(layer) {
2991
- const input = this._layerControlInputs.find((input) => input.layerId === stamp(layer));
2962
+ const input = this._layerControlInputs.find((input) => input._layer === layer);
2992
2963
  if (input && !input.checked) {
2993
2964
  input.checked = true;
2994
2965
  this._onInputClick();
@@ -3013,21 +2984,14 @@ var LayersControl = class LayersControl extends Control {
3013
2984
  }
3014
2985
  /**
3015
2986
  * Collapse the control container if expanded.
3016
- * @param {Event} [ev] The event causing the collapse, if any (collapsing is skipped
3017
- * for `pointerleave` and `pointerout` of touch).
3018
2987
  * @returns {this}
3019
2988
  */
3020
- collapse(ev) {
2989
+ collapse() {
3021
2990
  if (this.options.inline) return this;
3022
- if (!ev || !((ev.type === "pointerleave" || ev.type === "pointerout") && ev.pointerType === "touch")) {
3023
- if (this.options.collapseDelay > 0) {
3024
- this._collapseDelayTimeout = setTimeout(() => {
3025
- this._container.classList.remove("maplair-control-layers-expanded");
3026
- }, this.options.collapseDelay);
3027
- return this;
3028
- }
2991
+ if (this.options.collapseDelay > 0) this._collapseDelayTimeout = setTimeout(() => {
3029
2992
  this._container.classList.remove("maplair-control-layers-expanded");
3030
- }
2993
+ }, this.options.collapseDelay);
2994
+ else this._container.classList.remove("maplair-control-layers-expanded");
3031
2995
  return this;
3032
2996
  }
3033
2997
  _initLayout() {
@@ -3041,7 +3005,9 @@ var LayersControl = class LayersControl extends Control {
3041
3005
  this._map.on("click", this.collapse, this);
3042
3006
  on(container, {
3043
3007
  pointerenter: this._expandSafely,
3044
- pointerleave: this.collapse
3008
+ pointerleave(e) {
3009
+ if (e.pointerType !== "touch") this.collapse();
3010
+ }
3045
3011
  }, this);
3046
3012
  }
3047
3013
  if (!this.options.inline) {
@@ -3068,9 +3034,6 @@ var LayersControl = class LayersControl extends Control {
3068
3034
  this._overlaysList = create("div", `${className}-overlays`, section);
3069
3035
  container.appendChild(section);
3070
3036
  }
3071
- _getLayer(id) {
3072
- for (const layer of this._layers) if (layer && stamp(layer.layer) === id) return layer;
3073
- }
3074
3037
  _addLayer(layer, name, overlay) {
3075
3038
  if (this._map) layer.on("add remove", this._onLayerChange, this);
3076
3039
  this._layers.push({
@@ -3107,7 +3070,7 @@ var LayersControl = class LayersControl extends Control {
3107
3070
  }
3108
3071
  _onLayerChange(e) {
3109
3072
  if (!this._handlingClick) this._update();
3110
- const obj = this._getLayer(stamp(e.target));
3073
+ const obj = this._layers.find((o) => o.layer === e.target);
3111
3074
  const type = obj.overlay ? e.type === "add" ? "overlayadd" : "overlayremove" : e.type === "add" ? "baselayerchange" : null;
3112
3075
  if (type) this._map.fire(type, this._clickEvent ? {
3113
3076
  ...obj,
@@ -3122,7 +3085,7 @@ var LayersControl = class LayersControl extends Control {
3122
3085
  input.defaultChecked = checked;
3123
3086
  if (!obj.overlay) input.name = `maplair-base-layers_${stamp(this)}`;
3124
3087
  this._layerControlInputs.push(input);
3125
- input.layerId = stamp(obj.layer);
3088
+ input._layer = obj.layer;
3126
3089
  on(input, "click", this._onInputClick, this);
3127
3090
  const group = this.options.groupBy?.(obj.name, obj.layer, obj.overlay);
3128
3091
  const name = document.createElement("span");
@@ -3156,24 +3119,29 @@ var LayersControl = class LayersControl extends Control {
3156
3119
  }
3157
3120
  _onInputClick(e) {
3158
3121
  if (this._preventClick) return;
3159
- const inputs = this._layerControlInputs, addedLayers = [], removedLayers = [];
3122
+ const checked = /* @__PURE__ */ new Map();
3123
+ for (const input of this._layerControlInputs) {
3124
+ const layer = input._layer;
3125
+ checked.set(layer, checked.get(layer) || input.checked);
3126
+ }
3127
+ const addedLayers = [], removedLayers = [];
3128
+ for (const [layer, on] of checked) if (on !== this._map.hasLayer(layer)) (on ? addedLayers : removedLayers).push(layer);
3160
3129
  this._handlingClick = true;
3161
3130
  this._clickEvent = e;
3162
- for (const input of inputs) {
3163
- const layer = this._getLayer(input.layerId).layer;
3164
- if (input.checked) addedLayers.push(layer);
3165
- else if (!input.checked) removedLayers.push(layer);
3166
- }
3167
- for (const layer of removedLayers) if (this._map.hasLayer(layer)) this._map.removeLayer(layer);
3168
- for (const layer of addedLayers) if (!this._map.hasLayer(layer)) this._map.addLayer(layer);
3131
+ for (const layer of removedLayers) this._map.removeLayer(layer);
3132
+ for (const layer of addedLayers) this._map.addLayer(layer);
3169
3133
  this._handlingClick = false;
3170
3134
  this._clickEvent = void 0;
3135
+ for (const [layer, on] of checked) if (on !== this._map.hasLayer(layer)) {
3136
+ this._update();
3137
+ break;
3138
+ }
3171
3139
  this._refocusOnMap(e);
3172
3140
  }
3173
3141
  _checkDisabledLayers() {
3174
3142
  const inputs = this._layerControlInputs, zoom = this._map.getZoom();
3175
3143
  for (const input of inputs) {
3176
- const layer = this._getLayer(input.layerId).layer;
3144
+ const layer = input._layer;
3177
3145
  input.disabled = layer.options.minZoom !== void 0 && zoom < layer.options.minZoom || layer.options.maxZoom !== void 0 && zoom > layer.options.maxZoom;
3178
3146
  }
3179
3147
  }
@@ -3195,8 +3163,7 @@ var LayersControl = class LayersControl extends Control {
3195
3163
  });
3196
3164
  }
3197
3165
  };
3198
- //#endregion
3199
- //#region src/geometry/Bounds.js
3166
+ // src/geometry/Bounds.js
3200
3167
  /** @import {PointExpression} from './Point.js' */
3201
3168
  /**
3202
3169
  * A rectangular area in pixel coordinates: a `Bounds`, or an array of points (usually
@@ -3273,14 +3240,12 @@ var Bounds = class Bounds {
3273
3240
  extend(obj) {
3274
3241
  let min2, max2;
3275
3242
  if (!obj) return this;
3276
- if (obj instanceof Point || typeof obj[0] === "number" || "x" in obj) min2 = max2 = Point.from(obj);
3243
+ if (isPointExpression(obj)) min2 = max2 = Point.from(obj);
3277
3244
  else {
3278
- obj = Bounds.from(obj);
3279
- min2 = obj.min;
3280
- max2 = obj.max;
3281
- if (!min2 || !max2) return this;
3245
+ ({min: min2, max: max2} = Bounds.from(obj));
3246
+ if (!min2) return this;
3282
3247
  }
3283
- if (!this.min && !this.max) {
3248
+ if (!this.min) {
3284
3249
  this.min = new Point(min2);
3285
3250
  this.max = new Point(max2);
3286
3251
  } else {
@@ -3341,12 +3306,8 @@ var Bounds = class Bounds {
3341
3306
  */
3342
3307
  contains(obj) {
3343
3308
  let min, max;
3344
- if (typeof obj[0] === "number" || obj instanceof Point) obj = Point.from(obj);
3345
- else obj = Bounds.from(obj);
3346
- if (obj instanceof Bounds) {
3347
- min = obj.min;
3348
- max = obj.max;
3349
- } else min = max = obj;
3309
+ if (isPointExpression(obj)) min = max = Point.from(obj);
3310
+ else ({min, max} = Bounds.from(obj));
3350
3311
  return min.x >= this.min.x && max.x <= this.max.x && min.y >= this.min.y && max.y <= this.max.y;
3351
3312
  }
3352
3313
  /**
@@ -3400,8 +3361,10 @@ var Bounds = class Bounds {
3400
3361
  return this.min.equals(bounds.getTopLeft()) && this.max.equals(bounds.getBottomRight());
3401
3362
  }
3402
3363
  };
3403
- //#endregion
3404
- //#region src/layer/BlanketOverlay.js
3364
+ function isPointExpression(obj) {
3365
+ return obj instanceof Point || (Array.isArray(obj) ? typeof obj[0] === "number" : "x" in obj);
3366
+ }
3367
+ // src/layer/BlanketOverlay.js
3405
3368
  /** @import {LayerOptions} from './Layer.js' */
3406
3369
  /** @import {MaplairMap} from '../map/Map.js' */
3407
3370
  /** @import {EventListener} from '../core/Events.js' */
@@ -3530,8 +3493,7 @@ var BlanketOverlay = class BlanketOverlay extends Layer {
3530
3493
  _onViewReset() {}
3531
3494
  _onSettled() {}
3532
3495
  };
3533
- //#endregion
3534
- //#region src/layer/vector/Renderer.js
3496
+ // src/layer/vector/Renderer.js
3535
3497
  /** @import {BlanketOverlayOptions} from '../BlanketOverlay.js' */
3536
3498
  /** @import {MaplairEvent} from '../../core/Events.js' */
3537
3499
  /** @import {MaplairMap} from '../../map/Map.js' */
@@ -3600,8 +3562,7 @@ var Renderer = class Renderer extends BlanketOverlay {
3600
3562
  }
3601
3563
  _update() {}
3602
3564
  };
3603
- //#endregion
3604
- //#region src/layer/vector/SVG.js
3565
+ // src/layer/vector/SVG.js
3605
3566
  /** @import {Point} from '../../geometry/Point.js' */
3606
3567
  /** @import {RendererOptions} from './Renderer.js' */
3607
3568
  /**
@@ -3725,7 +3686,7 @@ var SVG = class SVG extends Renderer {
3725
3686
  }
3726
3687
  _updateCircle(layer) {
3727
3688
  const p = layer._point, r = Math.max(Math.round(layer._pxRadius), 1), arc = `a${r},${Math.max(Math.round(layer._pxRadiusY), 1) || r} 0 1,0 `;
3728
- const d = layer._empty() ? "M0 0" : `M${p.x - r},${p.y}${arc}${r * 2},0 ${arc}${-r * 2},0 `;
3689
+ const d = layer._empty() ? "M0 0" : `M${num(p.x - r)},${num(p.y)}${arc}${r * 2},0 ${arc}${-r * 2},0 `;
3729
3690
  this._setPath(layer, d);
3730
3691
  }
3731
3692
  _setPath(layer, path) {
@@ -3755,11 +3716,14 @@ var SVG = class SVG extends Renderer {
3755
3716
  * @returns {string}
3756
3717
  */
3757
3718
  static pointsToPath(rings, closed) {
3758
- return rings.flatMap((points) => [...points.map((p, j) => `${(j ? "L" : "M") + p.x} ${p.y}`), closed ? "z" : ""]).join("") || "M0 0";
3719
+ return rings.flatMap((points) => [...points.map((p, j) => `${(j ? "L" : "M") + num(p.x)} ${num(p.y)}`), closed ? "z" : ""]).join("") || "M0 0";
3759
3720
  }
3760
3721
  };
3761
- //#endregion
3762
- //#region src/layer/vector/Path.js
3722
+ function num(v) {
3723
+ const n = Math.round(v * 10), a = n < 0 ? -n : n, i = Math.floor(a / 10), d = a - i * 10;
3724
+ return (n < 0 ? "-" : "") + (d ? `${i}.${d}` : i);
3725
+ }
3726
+ // src/layer/vector/Path.js
3763
3727
  /** @import {InteractiveLayerOptions} from '../Layer.js' */
3764
3728
  /** @import {MaplairMap} from '../../map/Map.js' */
3765
3729
  /** @import {Renderer} from './Renderer.js' */
@@ -3901,8 +3865,7 @@ var Path = class extends Layer {
3901
3865
  return (this.options.stroke ? this.options.weight / 2 : 0) + (this._renderer.options.tolerance || 0);
3902
3866
  }
3903
3867
  };
3904
- //#endregion
3905
- //#region src/geo/LatLngBounds.js
3868
+ // src/geo/LatLngBounds.js
3906
3869
  /** @import {LatLngExpression} from './LatLng.js' */
3907
3870
  /**
3908
3871
  * A geographical area: a `LatLngBounds`, or an array of geographical points (usually
@@ -3982,19 +3945,14 @@ var LatLngBounds = class LatLngBounds {
3982
3945
  extend(obj) {
3983
3946
  const sw = this._southWest, ne = this._northEast;
3984
3947
  let sw2, ne2;
3985
- if (obj instanceof LatLng) {
3986
- sw2 = obj;
3987
- ne2 = obj;
3988
- } else if (obj instanceof LatLngBounds) {
3989
- sw2 = obj._southWest;
3990
- ne2 = obj._northEast;
3991
- if (!sw2 || !ne2) return this;
3992
- } else {
3993
- if (!obj) return this;
3994
- if (LatLng.validate(obj)) return this.extend(LatLng.from(obj));
3995
- return this.extend(LatLngBounds.from(obj));
3996
- }
3997
- if (!sw && !ne) {
3948
+ if (obj instanceof LatLng) sw2 = ne2 = obj;
3949
+ else if (obj instanceof LatLngBounds) {
3950
+ ({_southWest: sw2, _northEast: ne2} = obj);
3951
+ if (!sw2) return this;
3952
+ } else if (!obj) return this;
3953
+ else if (LatLng.validate(obj)) sw2 = ne2 = LatLng.from(obj);
3954
+ else return this.extend(LatLngBounds.from(obj));
3955
+ if (!sw) {
3998
3956
  this._southWest = new LatLng(sw2.lat, sw2.lng);
3999
3957
  this._northEast = new LatLng(ne2.lat, ne2.lng);
4000
3958
  } else {
@@ -4152,8 +4110,7 @@ var LatLngBounds = class LatLngBounds {
4152
4110
  return !!(this._southWest && this._northEast);
4153
4111
  }
4154
4112
  };
4155
- //#endregion
4156
- //#region src/geo/LatLng.js
4113
+ // src/geo/LatLng.js
4157
4114
  const coordinate = String.raw`([+-]?\d+(?:\.\d+)?)\s*°?`;
4158
4115
  const separator = String.raw`(?:\s*[,;]\s*|\s+)`;
4159
4116
  const plainRe = new RegExp(`^${coordinate}${separator}${coordinate}$`);
@@ -4373,8 +4330,7 @@ function haversineDistance(latlng1, latlng2, R) {
4373
4330
  const rad = Math.PI / 180, lat1 = latlng1.lat * rad, lat2 = latlng2.lat * rad, sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2), sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2), a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon;
4374
4331
  return R * (2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)));
4375
4332
  }
4376
- //#endregion
4377
- //#region src/geometry/LineUtil.js
4333
+ // src/geometry/LineUtil.js
4378
4334
  var LineUtil_exports = /* @__PURE__ */ __exportAll({
4379
4335
  _getBitCode: () => _getBitCode,
4380
4336
  _getEdgeIntersection: () => _getEdgeIntersection,
@@ -4593,12 +4549,11 @@ function _projectRing(latlngs, crs) {
4593
4549
  if (!latlngs || latlngs.length === 0) throw new Error("latlngs not passed");
4594
4550
  if (!isFlat(latlngs)) {
4595
4551
  console.warn("latlngs are not flat! Only the first ring will be used");
4596
- latlngs = latlngs[0];
4552
+ return _projectRing(latlngs[0], crs);
4597
4553
  }
4598
4554
  return latlngs.map((latlng) => crs.project(LatLng.from(latlng)));
4599
4555
  }
4600
- //#endregion
4601
- //#region src/layer/GeoJSONUtil.js
4556
+ // src/layer/GeoJSONUtil.js
4602
4557
  /** @import {Feature, FeatureCollection, GeoJsonObject, Geometry} from 'geojson' */
4603
4558
  /** @import {Layer} from './Layer.js' */
4604
4559
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
@@ -4666,8 +4621,7 @@ function pointToGeoJSON(layer, precision) {
4666
4621
  coordinates: latLngToCoords(layer.getLatLng(), precision)
4667
4622
  });
4668
4623
  }
4669
- //#endregion
4670
- //#region src/layer/vector/CircleMarker.js
4624
+ // src/layer/vector/CircleMarker.js
4671
4625
  /** @import {Feature} from 'geojson' */
4672
4626
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
4673
4627
  /** @import {MaplairEvent} from '../../core/Events.js' */
@@ -4759,7 +4713,7 @@ var CircleMarker = class CircleMarker extends Path {
4759
4713
  return this;
4760
4714
  }
4761
4715
  _project() {
4762
- this._point = this._map.latLngToLayerPoint(this._latlng);
4716
+ this._point = this._map.latLngToLayerPoint(this._latlng)._round();
4763
4717
  this._pxRadius = this._radius;
4764
4718
  this._updateBounds();
4765
4719
  }
@@ -4790,8 +4744,7 @@ var CircleMarker = class CircleMarker extends Path {
4790
4744
  return pointToGeoJSON(this, precision);
4791
4745
  }
4792
4746
  };
4793
- //#endregion
4794
- //#region src/control/LegendControl.js
4747
+ // src/control/LegendControl.js
4795
4748
  /** @import {ControlOptions} from './Control.js' */
4796
4749
  /** @import {MaplairMap} from '../map/Map.js' */
4797
4750
  /** @import {FeatureGroup} from '../layer/FeatureGroup.js' */
@@ -5010,8 +4963,7 @@ function svgElement$1(name, attributes) {
5010
4963
  for (const [key, value] of Object.entries(attributes)) el.setAttribute(key, value);
5011
4964
  return el;
5012
4965
  }
5013
- //#endregion
5014
- //#region src/geo/crs/CRS.js
4966
+ // src/geo/crs/CRS.js
5015
4967
  /** @import {LatLngExpression} from '../LatLng.js' */
5016
4968
  /** @import {LatLngBoundsExpression} from '../LatLngBounds.js' */
5017
4969
  /** @import {Point} from '../../geometry/Point.js' */
@@ -5155,8 +5107,7 @@ var CRS = class {
5155
5107
  return new LatLngBounds(new LatLng(sw.lat - latShift, sw.lng - lngShift), new LatLng(ne.lat - latShift, ne.lng - lngShift));
5156
5108
  }
5157
5109
  };
5158
- //#endregion
5159
- //#region src/geo/crs/EarthCRS.js
5110
+ // src/geo/crs/EarthCRS.js
5160
5111
  /** @import {LatLng} from '../LatLng.js' */
5161
5112
  /**
5162
5113
  * Serves as the base for CRS that are global such that they cover the earth.
@@ -5188,8 +5139,7 @@ var EarthCRS = class extends CRS {
5188
5139
  return haversineDistance(latlng1, latlng2, this.R);
5189
5140
  }
5190
5141
  };
5191
- //#endregion
5192
- //#region src/geo/projection/Projection.SphericalMercator.js
5142
+ // src/geo/projection/SphericalMercatorProjection.js
5193
5143
  /** @import {Projection} from './index.js' */
5194
5144
  const earthRadius$1 = 6378137;
5195
5145
  /**
@@ -5198,7 +5148,7 @@ const earthRadius$1 = 6378137;
5198
5148
  * a sphere. Used by the `EPSG:3857` CRS.
5199
5149
  * @type {Projection & {R: number, MAX_LATITUDE: number}}
5200
5150
  */
5201
- const SphericalMercator = {
5151
+ const SphericalMercatorProjection = {
5202
5152
  R: earthRadius$1,
5203
5153
  MAX_LATITUDE: 85.0511287798,
5204
5154
  project(latlng) {
@@ -5216,8 +5166,7 @@ const SphericalMercator = {
5216
5166
  return new Bounds([-d, -d], [d, d]);
5217
5167
  })()
5218
5168
  };
5219
- //#endregion
5220
- //#region src/geometry/Transformation.js
5169
+ // src/geometry/Transformation.js
5221
5170
  /**
5222
5171
  * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`
5223
5172
  * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing
@@ -5281,8 +5230,7 @@ var Transformation = class {
5281
5230
  return new Point((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);
5282
5231
  }
5283
5232
  };
5284
- //#endregion
5285
- //#region src/geo/crs/EPSG3857.js
5233
+ // src/geo/crs/EPSG3857.js
5286
5234
  /** @import {Projection} from '../projection/index.js' */
5287
5235
  /**
5288
5236
  * The most common CRS for online maps, used by almost all free and commercial
@@ -5293,10 +5241,10 @@ var EPSG3857 = class extends EarthCRS {
5293
5241
  /** @type {string} */
5294
5242
  static code = "EPSG:3857";
5295
5243
  /** @type {Projection} */
5296
- static projection = SphericalMercator;
5244
+ static projection = SphericalMercatorProjection;
5297
5245
  /** @type {Transformation} */
5298
5246
  static transformation = /* @__PURE__ */ (() => {
5299
- const scale = .5 / (Math.PI * SphericalMercator.R);
5247
+ const scale = .5 / (Math.PI * SphericalMercatorProjection.R);
5300
5248
  return new Transformation(scale, .5, -scale, .5);
5301
5249
  })();
5302
5250
  };
@@ -5307,8 +5255,7 @@ var EPSG900913 = class extends EPSG3857 {
5307
5255
  /** @type {string} */
5308
5256
  static code = "EPSG:900913";
5309
5257
  };
5310
- //#endregion
5311
- //#region src/dom/PosAnimation.js
5258
+ // src/dom/PosAnimation.js
5312
5259
  /** @import {Point} from '../geometry/Point.js' */
5313
5260
  /** @import {MaplairEvent} from '../core/Events.js' */
5314
5261
  /**
@@ -5384,8 +5331,7 @@ var PosAnimation = class PosAnimation extends Evented {
5384
5331
  return 1 - (1 - t) ** this._easeOutPower;
5385
5332
  }
5386
5333
  };
5387
- //#endregion
5388
- //#region src/control/ZoomControl.js
5334
+ // src/control/ZoomControl.js
5389
5335
  /** @import {ControlOptions} from './Control.js' */
5390
5336
  /** @import {MaplairMap} from '../map/Map.js' */
5391
5337
  /**
@@ -5439,8 +5385,8 @@ var ZoomControl = class ZoomControl extends Control {
5439
5385
  */
5440
5386
  onAdd(map) {
5441
5387
  const zoomName = "maplair-control-zoom", container = create("div", `${zoomName} maplair-bar`), options = this.options;
5442
- this._zoomInButton = this._createButton(options.zoomInText, I18n.translate("Zoom in"), `${zoomName}-in`, container, this._zoomIn);
5443
- this._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate("Zoom out"), `${zoomName}-out`, container, this._zoomOut);
5388
+ this._zoomInButton = this._createButton(options.zoomInText, I18n.translate("Zoom in"), `${zoomName}-in`, container, (e) => this._zoom(e, 1));
5389
+ this._zoomOutButton = this._createButton(options.zoomOutText, I18n.translate("Zoom out"), `${zoomName}-out`, container, (e) => this._zoom(e, -1));
5444
5390
  this._updateDisabled();
5445
5391
  map.on("zoomend zoomlevelschange", this._updateDisabled, this);
5446
5392
  return container;
@@ -5470,16 +5416,11 @@ var ZoomControl = class ZoomControl extends Control {
5470
5416
  this._updateDisabled();
5471
5417
  return this;
5472
5418
  }
5473
- _zoomIn(e) {
5474
- if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
5475
- this._map._setUserEvent(e);
5476
- this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
5477
- }
5478
- }
5479
- _zoomOut(e) {
5480
- if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
5481
- this._map._setUserEvent(e);
5482
- this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
5419
+ _zoom(e, dir) {
5420
+ const map = this._map;
5421
+ if (!this._disabled && (dir > 0 ? map._zoom < map.getMaxZoom() : map._zoom > map.getMinZoom())) {
5422
+ map._setUserEvent(e);
5423
+ map.zoomIn(dir * map.options.zoomDelta * (e.shiftKey ? 3 : 1));
5483
5424
  }
5484
5425
  }
5485
5426
  _createButton(html, title, className, container, fn) {
@@ -5489,24 +5430,19 @@ var ZoomControl = class ZoomControl extends Control {
5489
5430
  link.title = title;
5490
5431
  link.setAttribute("aria-label", title);
5491
5432
  disableClickPropagation(link);
5492
- on(link, "click", stop);
5493
- on(link, "click", fn, this);
5494
- on(link, "click", this._refocusOnMap, this);
5433
+ on(link, "click", (e) => {
5434
+ stop(e);
5435
+ fn.call(this, e);
5436
+ this._refocusOnMap(e);
5437
+ });
5495
5438
  return link;
5496
5439
  }
5497
5440
  _updateDisabled() {
5498
- const map = this._map, className = "maplair-disabled";
5499
- this._zoomInButton.classList.remove(className);
5500
- this._zoomOutButton.classList.remove(className);
5501
- this._zoomInButton.setAttribute("aria-disabled", "false");
5502
- this._zoomOutButton.setAttribute("aria-disabled", "false");
5503
- if (this._disabled || map._zoom === map.getMinZoom()) {
5504
- this._zoomOutButton.classList.add(className);
5505
- this._zoomOutButton.setAttribute("aria-disabled", "true");
5506
- }
5507
- if (this._disabled || map._zoom === map.getMaxZoom()) {
5508
- this._zoomInButton.classList.add(className);
5509
- this._zoomInButton.setAttribute("aria-disabled", "true");
5441
+ const map = this._map;
5442
+ for (const [button, limit] of [[this._zoomInButton, map.getMaxZoom()], [this._zoomOutButton, map.getMinZoom()]]) {
5443
+ const disabled = this._disabled || map._zoom === limit;
5444
+ button.classList.toggle("maplair-disabled", disabled);
5445
+ button.setAttribute("aria-disabled", `${disabled}`);
5510
5446
  }
5511
5447
  }
5512
5448
  /**
@@ -5524,8 +5460,7 @@ var ZoomControl = class ZoomControl extends Control {
5524
5460
  });
5525
5461
  }
5526
5462
  };
5527
- //#endregion
5528
- //#region src/layer/LayerGroup.js
5463
+ // src/layer/LayerGroup.js
5529
5464
  /** @import {Feature, FeatureCollection} from 'geojson' */
5530
5465
  /** @import {InteractiveLayerOptions} from './Layer.js' */
5531
5466
  /** @import {MaplairMap} from '../map/Map.js' */
@@ -5572,7 +5507,7 @@ var LayerGroup = class LayerGroup extends Layer {
5572
5507
  * @returns {this}
5573
5508
  */
5574
5509
  removeLayer(layer) {
5575
- const id = layer in this._layers ? layer : this.getLayerId(layer);
5510
+ const id = typeof layer === "number" ? layer : this.getLayerId(layer);
5576
5511
  if (this._map && this._layers[id]) this._map.removeLayer(this._layers[id]);
5577
5512
  delete this._layers[id];
5578
5513
  return this;
@@ -5704,8 +5639,7 @@ var LayerGroup = class LayerGroup extends Layer {
5704
5639
  };
5705
5640
  }
5706
5641
  };
5707
- //#endregion
5708
- //#region src/layer/FeatureGroup.js
5642
+ // src/layer/FeatureGroup.js
5709
5643
  /** @import {Layer, InteractiveLayerOptions} from './Layer.js' */
5710
5644
  /** @import {LayerEvent} from '../core/Events.js' */
5711
5645
  /** @import {PathOptions} from './vector/Path.js' */
@@ -5800,17 +5734,18 @@ var FeatureGroup = class FeatureGroup extends LayerGroup {
5800
5734
  }
5801
5735
  /**
5802
5736
  * Returns the `LatLngBounds` of the feature group (created from bounds and
5803
- * coordinates of its children).
5737
+ * coordinates of its children, including the layers of nested layer groups).
5804
5738
  * @returns {LatLngBounds}
5805
5739
  */
5806
5740
  getBounds() {
5807
5741
  const bounds = new LatLngBounds();
5808
- for (const layer of Object.values(this._layers)) bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());
5742
+ for (const layer of Object.values(this._layers)) if (layer.getBounds) bounds.extend(layer.getBounds());
5743
+ else if (layer.getLatLng) bounds.extend(layer.getLatLng());
5744
+ else if (layer instanceof LayerGroup) bounds.extend(FeatureGroup.prototype.getBounds.call(layer));
5809
5745
  return bounds;
5810
5746
  }
5811
5747
  };
5812
- //#endregion
5813
- //#region src/layer/DivOverlay.js
5748
+ // src/layer/DivOverlay.js
5814
5749
  /** @import {InteractiveLayerOptions} from './Layer.js' */
5815
5750
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
5816
5751
  /** @import {PointExpression} from '../geometry/Point.js' */
@@ -6149,7 +6084,7 @@ var DivOverlay = class DivOverlay extends Layer {
6149
6084
  }
6150
6085
  _updatePosition() {
6151
6086
  if (!this._map) return;
6152
- const pos = this._map.latLngToLayerPoint(this._latlng), offset = Point.from(this.options.offset);
6087
+ const pos = this._map.latLngToLayerPoint(this._latlng)._round(), offset = Point.from(this.options.offset);
6153
6088
  this._setContainerPosition(pos.add(this._getAnchor()));
6154
6089
  const bottom = this._containerBottom = -offset.y, left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;
6155
6090
  if (this.options.overflow) {
@@ -6182,8 +6117,7 @@ var DivOverlay = class DivOverlay extends Layer {
6182
6117
  Layer.include(layerDivOverlayMethods);
6183
6118
  }
6184
6119
  };
6185
- //#endregion
6186
- //#region src/layer/Popup.js
6120
+ // src/layer/Popup.js
6187
6121
  /** @import {DivOverlayOptions, DivOverlayContent} from './DivOverlay.js' */
6188
6122
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
6189
6123
  /** @import {PointExpression} from '../geometry/Point.js' */
@@ -6389,7 +6323,7 @@ const layerPopupMethods = {
6389
6323
  },
6390
6324
  _openPopup(e) {
6391
6325
  if (!this._popup || !this._map) return;
6392
- stop(e);
6326
+ stopPropagation(e);
6393
6327
  const target = e.propagatedFrom ?? e.target;
6394
6328
  if (this._popup._source === target && !(target instanceof Path)) {
6395
6329
  if (this._map.hasLayer(this._popup)) this.closePopup();
@@ -6541,9 +6475,6 @@ var Popup = class Popup extends DivOverlay {
6541
6475
  const wrapper = this._wrapper = create("div", `${prefix}-content-wrapper`, container);
6542
6476
  this._contentNode = create("div", `${prefix}-content`, wrapper);
6543
6477
  disableClickPropagation(container);
6544
- on(container, "keydown", (e) => {
6545
- if (e.key === "Escape" && this.options.closeOnEscapeKey) this.close();
6546
- });
6547
6478
  disableScrollPropagation(this._contentNode);
6548
6479
  on(container, "contextmenu", stopPropagation);
6549
6480
  this._tipContainer = create("div", `${prefix}-tip-container`, container);
@@ -6559,14 +6490,12 @@ var Popup = class Popup extends DivOverlay {
6559
6490
  });
6560
6491
  }
6561
6492
  if (this.options.trackResize) {
6562
- this._resizeObserver = new ResizeObserver(((entries) => {
6493
+ this._resizeObserver = new ResizeObserver(() => {
6563
6494
  if (!this._map) return;
6564
- this._containerWidth = entries[0]?.contentRect?.width;
6565
- this._containerHeight = entries[0]?.contentRect?.height;
6566
6495
  this._updateLayout();
6567
6496
  this._updatePosition();
6568
6497
  this._adjustPan();
6569
- }));
6498
+ });
6570
6499
  this._resizeObserver.observe(this._contentNode);
6571
6500
  }
6572
6501
  }
@@ -6574,11 +6503,10 @@ var Popup = class Popup extends DivOverlay {
6574
6503
  const container = this._contentNode, style = container.style;
6575
6504
  style.maxWidth = `${this.options.maxWidth}px`;
6576
6505
  style.minWidth = `${this.options.minWidth}px`;
6577
- const maxHeight = this.options.maxHeight, scrolledClass = "maplair-popup-scrolled";
6578
- if (maxHeight && (this._containerHeight ?? container.offsetHeight) > maxHeight) {
6579
- style.height = `${maxHeight}px`;
6580
- container.classList.add(scrolledClass);
6581
- } else container.classList.remove(scrolledClass);
6506
+ style.height = "";
6507
+ const maxHeight = this.options.maxHeight, scrolled = !!maxHeight && container.offsetHeight > maxHeight;
6508
+ if (scrolled) style.height = `${maxHeight}px`;
6509
+ container.classList.toggle("maplair-popup-scrolled", scrolled);
6582
6510
  this._containerWidth = this._container.offsetWidth;
6583
6511
  this._containerHeight = this._container.offsetHeight;
6584
6512
  this._containerMarginBottom = parseInt(getComputedStyle(this._container).marginBottom, 10) || 0;
@@ -6622,8 +6550,7 @@ var Popup = class Popup extends DivOverlay {
6622
6550
  Layer.include(layerPopupMethods);
6623
6551
  }
6624
6552
  };
6625
- //#endregion
6626
- //#region src/layer/Tooltip.js
6553
+ // src/layer/Tooltip.js
6627
6554
  const directions = [
6628
6555
  "top",
6629
6556
  "bottom",
@@ -6730,8 +6657,9 @@ const layerTooltipMethods = {
6730
6657
  * @returns {this}
6731
6658
  */
6732
6659
  bindTooltip(content, options) {
6733
- if (this._tooltip && this.isTooltipOpen()) this.unbindTooltip();
6734
- this._tooltip = this._initOverlay(Tooltip, this._tooltip, content, options);
6660
+ const old = this.isTooltipOpen() ? null : this._tooltip;
6661
+ if (this._tooltip) this.unbindTooltip();
6662
+ this._tooltip = this._initOverlay(Tooltip, old, content, options);
6735
6663
  this._initTooltipInteractions();
6736
6664
  if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) this.openTooltip();
6737
6665
  return this;
@@ -6750,21 +6678,20 @@ const layerTooltipMethods = {
6750
6678
  return this;
6751
6679
  },
6752
6680
  _initTooltipInteractions(remove) {
6753
- if (!remove && this._tooltipHandlersAdded) return;
6754
- const onOff = remove ? "off" : "on", events = {
6681
+ const { permanent, sticky } = this._tooltip.options, events = {
6755
6682
  remove: this.closeTooltip,
6756
6683
  move: this._moveTooltip
6757
6684
  };
6758
- if (!this._tooltip.options.permanent) {
6685
+ if (permanent) events.add = this._openTooltip;
6686
+ else {
6759
6687
  events.pointerover = this._openTooltip;
6760
6688
  events.pointerout = this.closeTooltip;
6761
6689
  events.click = this._openTooltip;
6762
- if (this._map) this._addFocusListeners(remove);
6763
- else events.add = () => this._addFocusListeners(remove);
6764
- } else events.add = this._openTooltip;
6765
- if (this._tooltip.options.sticky) events.pointermove = this._moveTooltip;
6766
- this[onOff](events);
6767
- this._tooltipHandlersAdded = !remove;
6690
+ events.add = this._toggleFocusListeners;
6691
+ if (this._map) this._toggleFocusListeners(!remove);
6692
+ }
6693
+ if (sticky) events.pointermove = this._moveTooltip;
6694
+ this[remove ? "off" : "on"](events);
6768
6695
  },
6769
6696
  /**
6770
6697
  * Opens the bound tooltip at the specified `latlng` or at the default tooltip
@@ -6830,9 +6757,9 @@ const layerTooltipMethods = {
6830
6757
  getTooltip() {
6831
6758
  return this._tooltip;
6832
6759
  },
6833
- _addFocusListeners(remove) {
6834
- if (this.getElement) this._addFocusListenersOnLayer(this, remove);
6835
- else if (this.eachLayer) this.eachLayer((layer) => this._addFocusListenersOnLayer(layer, remove), this);
6760
+ _toggleFocusListeners(add) {
6761
+ if (this.getElement) this._addFocusListenersOnLayer(this, !add);
6762
+ else if (this.eachLayer) this.eachLayer((layer) => this._addFocusListenersOnLayer(layer, !add), this);
6836
6763
  },
6837
6764
  _addFocusListenersOnLayer(layer, remove) {
6838
6765
  const el = typeof layer.getElement === "function" && layer.getElement();
@@ -7065,7 +6992,7 @@ var Tooltip = class Tooltip extends DivOverlay {
7065
6992
  };
7066
6993
  }
7067
6994
  _updatePosition() {
7068
- const pos = this._map.latLngToLayerPoint(this._latlng);
6995
+ const pos = this._map.latLngToLayerPoint(this._latlng)._round();
7069
6996
  this._setPosition(pos);
7070
6997
  }
7071
6998
  /**
@@ -7094,8 +7021,7 @@ var Tooltip = class Tooltip extends DivOverlay {
7094
7021
  Layer.include(layerTooltipMethods);
7095
7022
  }
7096
7023
  };
7097
- //#endregion
7098
- //#region src/layer/vector/Renderer.getRenderer.js
7024
+ // src/layer/vector/Renderer.getRenderer.js
7099
7025
  var Renderer_getRenderer_exports = /* @__PURE__ */ __exportAll({ register: () => register });
7100
7026
  /** @import {MaplairMap} from '../../map/Map.js' */
7101
7027
  /** @import {Path} from './Path.js' */
@@ -7111,11 +7037,11 @@ const mapRendererMethods = {
7111
7037
  * are respected, and that the renderers do exist on the map.
7112
7038
  * @internal
7113
7039
  * @param {Path} layer
7114
- * @returns {Renderer}
7040
+ * @returns {Renderer|undefined}
7115
7041
  */
7116
7042
  getRenderer(layer) {
7117
- const renderer = layer.options.renderer ?? this._getPaneRenderer(layer) ?? this.options.renderer ?? (this._renderer ??= layer._createRenderer());
7118
- if (!this.hasLayer(renderer)) this.addLayer(renderer);
7043
+ const renderer = layer.options.renderer ?? this._getPaneRenderer(layer) ?? this.options.renderer ?? (this._renderer ??= layer._createRenderer?.());
7044
+ if (renderer && !this.hasLayer(renderer)) this.addLayer(renderer);
7119
7045
  return renderer;
7120
7046
  },
7121
7047
  _getPaneRenderer(layer) {
@@ -7154,15 +7080,14 @@ function register(MaplairMap) {
7154
7080
  if (this.options.preferCanvas !== void 0) console.error("MaplairMap: preferCanvas option has been removed. Use renderer: new Canvas() instead.");
7155
7081
  });
7156
7082
  }
7157
- //#endregion
7158
- //#region src/core/Handler.js
7083
+ // src/core/Handler.js
7159
7084
  /** @import {MaplairMap} from '../map/Map.js' */
7160
7085
  /**
7161
7086
  * Abstract class for map interaction handlers, the base class of the handlers that
7162
7087
  * are used internally to inject interaction features like dragging to classes like
7163
7088
  * `MaplairMap` and `Marker`.
7164
7089
  *
7165
- * Classes inheriting from `Handler` must implement the two following extension methods:
7090
+ * Classes inheriting from `Handler` implement the two following extension methods:
7166
7091
  *
7167
7092
  * * `addHooks()` is called when the handler is enabled, should add event hooks.
7168
7093
  * * `removeHooks()` is called when the handler is disabled, should remove the event
@@ -7205,6 +7130,14 @@ var Handler = class Handler extends Class {
7205
7130
  return !!this._enabled;
7206
7131
  }
7207
7132
  /**
7133
+ * Called when the handler is enabled, should add event hooks.
7134
+ */
7135
+ addHooks() {}
7136
+ /**
7137
+ * Called when the handler is disabled, should remove the event hooks added previously.
7138
+ */
7139
+ removeHooks() {}
7140
+ /**
7208
7141
  * Adds a new handler of this class to the given map with the given name, which is
7209
7142
  * then available as the property of the map with this name.
7210
7143
  * @template {typeof Handler} T
@@ -7218,8 +7151,7 @@ var Handler = class Handler extends Class {
7218
7151
  return this;
7219
7152
  }
7220
7153
  };
7221
- //#endregion
7222
- //#region src/map/handler/BoxZoomHandler.js
7154
+ // src/map/handler/BoxZoomHandler.js
7223
7155
  /** @import {MaplairMap} from '../Map.js' */
7224
7156
  /** @import {MaplairEvent} from '../../core/Events.js' */
7225
7157
  /**
@@ -7256,23 +7188,19 @@ var BoxZoomHandler = class BoxZoomHandler extends Handler {
7256
7188
  */
7257
7189
  constructor(map) {
7258
7190
  super(map);
7259
- this._container = map._container;
7260
- this._pane = map._panes.overlayPane;
7261
- this._resetStateTimeout = 0;
7262
- map.on("unload", this._destroy, this);
7263
7191
  this.callInitHooks(BoxZoomHandler);
7264
7192
  }
7265
7193
  /**
7266
7194
  * Called when the handler is enabled, adds the event hooks.
7267
7195
  */
7268
7196
  addHooks() {
7269
- on(this._container, "pointerdown", this._onPointerDown, this);
7197
+ on(this._map._container, "pointerdown", this._onPointerDown, this);
7270
7198
  }
7271
7199
  /**
7272
7200
  * Called when the handler is disabled, removes the event hooks.
7273
7201
  */
7274
7202
  removeHooks() {
7275
- off(this._container, "pointerdown", this._onPointerDown, this);
7203
+ off(this._map._container, "pointerdown", this._onPointerDown, this);
7276
7204
  }
7277
7205
  /**
7278
7206
  * Returns `true` if a box has been drawn by the current or last interaction.
@@ -7281,42 +7209,34 @@ var BoxZoomHandler = class BoxZoomHandler extends Handler {
7281
7209
  moved() {
7282
7210
  return this._moved;
7283
7211
  }
7284
- _destroy() {
7285
- this._pane.remove();
7286
- delete this._pane;
7287
- }
7288
7212
  _resetState() {
7289
- this._resetStateTimeout = 0;
7213
+ clearTimeout(this._resetStateTimeout);
7290
7214
  this._moved = false;
7291
7215
  }
7292
- _clearDeferredResetState() {
7293
- if (this._resetStateTimeout !== 0) {
7294
- clearTimeout(this._resetStateTimeout);
7295
- this._resetStateTimeout = 0;
7296
- }
7216
+ _toggleListeners(onOff) {
7217
+ onOff(this._map._container, {
7218
+ contextmenu: stop,
7219
+ pointermove: this._onPointerMove,
7220
+ pointerup: this._onPointerUp
7221
+ }, this);
7222
+ onOff(document, "keydown", this._onKeyDown, this);
7297
7223
  }
7298
7224
  _onPointerDown(e) {
7299
7225
  if (!e.shiftKey || e.button !== 0) return false;
7300
- this._clearDeferredResetState();
7301
7226
  this._resetState();
7302
7227
  preventDefault(e);
7303
7228
  this._startPoint = this._map.pointerEventToContainerPoint(e);
7304
- on(this._container, {
7305
- contextmenu: stop,
7306
- pointermove: this._onPointerMove,
7307
- pointerup: this._onPointerUp,
7308
- keydown: this._onKeyDown
7309
- }, this);
7310
- on(document, "keydown", this._onKeyDown, this);
7229
+ this._toggleListeners(on);
7311
7230
  }
7312
7231
  _onPointerMove(e) {
7232
+ const map = this._map;
7313
7233
  if (!this._moved) {
7314
7234
  this._moved = true;
7315
- this._box = create("div", "maplair-zoom-box", this._container);
7316
- this._container.classList.add("maplair-crosshair");
7317
- this._map.fire("boxzoomstart");
7235
+ this._box = create("div", "maplair-zoom-box", map._container);
7236
+ map._container.classList.add("maplair-crosshair");
7237
+ map.fire("boxzoomstart");
7318
7238
  }
7319
- this._point = this._map.pointerEventToContainerPoint(e);
7239
+ this._point = map.pointerEventToContainerPoint(e);
7320
7240
  const bounds = new Bounds(this._point, this._startPoint), size = bounds.getSize();
7321
7241
  setPosition(this._box, bounds.min);
7322
7242
  this._box.style.width = `${size.x}px`;
@@ -7325,21 +7245,15 @@ var BoxZoomHandler = class BoxZoomHandler extends Handler {
7325
7245
  _finish() {
7326
7246
  if (this._moved) {
7327
7247
  this._box.remove();
7328
- this._container.classList.remove("maplair-crosshair");
7248
+ this._map._container.classList.remove("maplair-crosshair");
7329
7249
  }
7330
- off(this._container, {
7331
- contextmenu: stop,
7332
- pointermove: this._onPointerMove,
7333
- pointerup: this._onPointerUp
7334
- }, this);
7335
- off(document, "keydown", this._onKeyDown, this);
7250
+ this._toggleListeners(off);
7336
7251
  }
7337
7252
  _onPointerUp(e) {
7338
7253
  if (e.button !== 0) return;
7339
7254
  this._finish();
7340
7255
  if (!this._moved) return;
7341
- this._clearDeferredResetState();
7342
- this._resetStateTimeout = setTimeout(this._resetState.bind(this), 0);
7256
+ this._resetStateTimeout = setTimeout(() => this._resetState(), 0);
7343
7257
  const bounds = new LatLngBounds(this._map.containerPointToLatLng(this._startPoint), this._map.containerPointToLatLng(this._point));
7344
7258
  this._map._setUserEvent(e);
7345
7259
  if (this._map.getBoundsZoom(bounds) !== Infinity) this._map.fitBounds(bounds);
@@ -7348,7 +7262,6 @@ var BoxZoomHandler = class BoxZoomHandler extends Handler {
7348
7262
  _onKeyDown(e) {
7349
7263
  if (e.code === "Escape") {
7350
7264
  this._finish();
7351
- this._clearDeferredResetState();
7352
7265
  this._resetState();
7353
7266
  }
7354
7267
  }
@@ -7362,8 +7275,7 @@ var BoxZoomHandler = class BoxZoomHandler extends Handler {
7362
7275
  MaplairMap.addInitHook("addHandler", "boxZoom", BoxZoomHandler);
7363
7276
  }
7364
7277
  };
7365
- //#endregion
7366
- //#region src/map/handler/DoubleClickZoomHandler.js
7278
+ // src/map/handler/DoubleClickZoomHandler.js
7367
7279
  /** @import {MaplairMap} from '../Map.js' */
7368
7280
  /**
7369
7281
  * Map options of `DoubleClickZoomHandler`.
@@ -7429,8 +7341,7 @@ var DoubleClickZoomHandler = class DoubleClickZoomHandler extends Handler {
7429
7341
  MaplairMap.addInitHook("addHandler", "doubleClickZoom", DoubleClickZoomHandler);
7430
7342
  }
7431
7343
  };
7432
- //#endregion
7433
- //#region src/dom/Draggable.js
7344
+ // src/dom/Draggable.js
7434
7345
  /** @import {MaplairEvent, DragEndEvent} from '../core/Events.js' */
7435
7346
  /**
7436
7347
  * Options of `Draggable`.
@@ -7503,7 +7414,8 @@ var Draggable = class Draggable extends Evented {
7503
7414
  _onDown(e) {
7504
7415
  this._moved = false;
7505
7416
  if (this._element.classList.contains("maplair-zoom-anim")) return;
7506
- if (getPointers().length !== 1) {
7417
+ const pointers = getPointers().length;
7418
+ if (pointers > 1) {
7507
7419
  if (Draggable._dragging === this) this.finishDrag();
7508
7420
  return;
7509
7421
  }
@@ -7511,6 +7423,7 @@ var Draggable = class Draggable extends Evented {
7511
7423
  Draggable._dragging = this;
7512
7424
  disableImageDrag();
7513
7425
  if (this._moving) return;
7426
+ if (!pointers && e.isTrusted) e.target.setPointerCapture(e.pointerId);
7514
7427
  this.fire("down");
7515
7428
  const sizedParent = getSizedParentNode(this._element);
7516
7429
  this._startPoint = new Point(e.clientX, e.clientY);
@@ -7580,8 +7493,7 @@ var Draggable = class Draggable extends Evented {
7580
7493
  });
7581
7494
  }
7582
7495
  };
7583
- //#endregion
7584
- //#region src/map/handler/DragHandler.js
7496
+ // src/map/handler/DragHandler.js
7585
7497
  /** @import {MaplairMap} from '../Map.js' */
7586
7498
  /** @import {MaplairEvent, DragEndEvent} from '../../core/Events.js' */
7587
7499
  /**
@@ -7768,8 +7680,7 @@ var DragHandler = class DragHandler extends Handler {
7768
7680
  MaplairMap.addInitHook("addHandler", "dragging", DragHandler);
7769
7681
  }
7770
7682
  };
7771
- //#endregion
7772
- //#region src/map/handler/KeyboardHandler.js
7683
+ // src/map/handler/KeyboardHandler.js
7773
7684
  /** @import {MaplairMap} from '../Map.js' */
7774
7685
  /** @import {MaplairEvent} from '../../core/Events.js' */
7775
7686
  /**
@@ -7819,8 +7730,6 @@ var KeyboardHandler = class KeyboardHandler extends Handler {
7819
7730
  */
7820
7731
  constructor(map) {
7821
7732
  super(map);
7822
- this._setPanDelta(map.options.keyboardPanDelta);
7823
- this._setZoomDelta(map.options.zoomDelta);
7824
7733
  this.callInitHooks(KeyboardHandler);
7825
7734
  }
7826
7735
  /**
@@ -7834,27 +7743,21 @@ var KeyboardHandler = class KeyboardHandler extends Handler {
7834
7743
  on(container, {
7835
7744
  focus: this._onFocus,
7836
7745
  blur: this._onBlur,
7837
- pointerdown: this._onPointerDown
7838
- }, this);
7839
- this._map.on({
7840
- focus: this._addHooks,
7841
- blur: this._removeHooks
7746
+ pointerdown: this._onPointerDown,
7747
+ keydown: this._onContainerKeyDown
7842
7748
  }, this);
7843
7749
  }
7844
7750
  /**
7845
7751
  * Called when the handler is disabled, removes the event hooks.
7846
7752
  */
7847
7753
  removeHooks() {
7848
- this._removeHooks();
7754
+ off(document, "keydown", this._onKeyDown, this);
7849
7755
  if (this._map.options.ariaKeyShortcuts) this._map._container.removeAttribute("aria-keyshortcuts");
7850
7756
  off(this._map._container, {
7851
7757
  focus: this._onFocus,
7852
7758
  blur: this._onBlur,
7853
- pointerdown: this._onPointerDown
7854
- }, this);
7855
- this._map.off({
7856
- focus: this._addHooks,
7857
- blur: this._removeHooks
7759
+ pointerdown: this._onPointerDown,
7760
+ keydown: this._onContainerKeyDown
7858
7761
  }, this);
7859
7762
  this._help?.remove();
7860
7763
  this._help = null;
@@ -7900,29 +7803,21 @@ var KeyboardHandler = class KeyboardHandler extends Handler {
7900
7803
  }
7901
7804
  _onFocus() {
7902
7805
  this._focused = true;
7806
+ on(document, "keydown", this._onKeyDown, this);
7903
7807
  this._map.fire("focus");
7904
7808
  }
7905
7809
  _onBlur() {
7906
7810
  this._focused = false;
7811
+ off(document, "keydown", this._onKeyDown, this);
7907
7812
  this._map.fire("blur");
7908
7813
  }
7909
- _setPanDelta(panDelta) {
7910
- const panKeys = this._panKeys = {}, { left, right, down, up } = KeyboardHandler.keys;
7911
- for (const key of left) panKeys[key] = [-panDelta, 0];
7912
- for (const key of right) panKeys[key] = [panDelta, 0];
7913
- for (const key of down) panKeys[key] = [0, panDelta];
7914
- for (const key of up) panKeys[key] = [0, -panDelta];
7915
- }
7916
- _setZoomDelta(zoomDelta) {
7917
- const zoomKeys = this._zoomKeys = {}, { zoomIn, zoomOut } = KeyboardHandler.keys;
7918
- for (const key of zoomIn) zoomKeys[key] = zoomDelta;
7919
- for (const key of zoomOut) zoomKeys[key] = -zoomDelta;
7920
- }
7921
- _addHooks() {
7922
- on(document, "keydown", this._onKeyDown, this);
7923
- }
7924
- _removeHooks() {
7925
- off(document, "keydown", this._onKeyDown, this);
7814
+ _onContainerKeyDown(e) {
7815
+ const map = this._map, popup = map._popup;
7816
+ if (e.key !== "Escape" || e.defaultPrevented || !popup?.options.closeOnEscapeKey || map._controlContainer?.contains(e.target)) return;
7817
+ const inPopup = popup._container.contains(e.target), icon = popup._source?._icon;
7818
+ map.closePopup();
7819
+ e.preventDefault();
7820
+ if (inPopup) (icon?.tabIndex >= 0 ? icon : map._container).focus();
7926
7821
  }
7927
7822
  _onKeyDown(e) {
7928
7823
  if (e.altKey || e.ctrlKey || e.metaKey) return;
@@ -7931,23 +7826,20 @@ var KeyboardHandler = class KeyboardHandler extends Handler {
7931
7826
  stop(e);
7932
7827
  return;
7933
7828
  }
7934
- const key = e.key, map = this._map;
7935
- let offset;
7936
- if (key in this._panKeys) {
7937
- if (!map._panAnim || !map._panAnim._inProgress) {
7938
- offset = this._panKeys[key];
7939
- if (e.shiftKey) offset = Point.from(offset).multiplyBy(3);
7940
- if (map.options.maxBounds) offset = map._limitOffset(Point.from(offset), map.options.maxBounds);
7829
+ const key = e.key, map = this._map, { left, right, down, up, zoomIn, zoomOut } = KeyboardHandler.keys, x = +right.includes(key) - +left.includes(key), y = +down.includes(key) - +up.includes(key), dz = +zoomIn.includes(key) - +zoomOut.includes(key), k = e.shiftKey ? 3 : 1;
7830
+ if (x || y) {
7831
+ if (!map._panAnim?._inProgress) {
7832
+ let offset = new Point(x, y).multiplyBy(k * map.options.keyboardPanDelta);
7833
+ if (map.options.maxBounds) offset = map._limitOffset(offset, map.options.maxBounds);
7941
7834
  map._setUserEvent(e);
7942
7835
  map.panBy(offset);
7943
7836
  }
7944
- } else if (key in this._zoomKeys) {
7837
+ } else if (dz) {
7945
7838
  if (!map._zoomInputBlocked()) {
7946
7839
  map._setUserEvent(e);
7947
- map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
7840
+ map.setZoom(map.getZoom() + k * dz * map.options.zoomDelta);
7948
7841
  }
7949
- } else if (key === "Escape" && map._popup && map._popup.options.closeOnEscapeKey) map.closePopup();
7950
- else return;
7842
+ } else return;
7951
7843
  stop(e);
7952
7844
  }
7953
7845
  /**
@@ -7964,8 +7856,7 @@ var KeyboardHandler = class KeyboardHandler extends Handler {
7964
7856
  MaplairMap.addInitHook("addHandler", "keyboard", KeyboardHandler);
7965
7857
  }
7966
7858
  };
7967
- //#endregion
7968
- //#region src/map/handler/PinchZoomHandler.js
7859
+ // src/map/handler/PinchZoomHandler.js
7969
7860
  /** @import {MaplairMap} from '../Map.js' */
7970
7861
  /**
7971
7862
  * Map options of `PinchZoomHandler`, touch interaction options.
@@ -8100,8 +7991,7 @@ var PinchZoomHandler = class PinchZoomHandler extends Handler {
8100
7991
  });
8101
7992
  }
8102
7993
  };
8103
- //#endregion
8104
- //#region src/map/handler/ScrollWheelZoomHandler.js
7994
+ // src/map/handler/ScrollWheelZoomHandler.js
8105
7995
  /** @import {MaplairMap} from '../Map.js' */
8106
7996
  const pinchPxPerZoomLevel = 100;
8107
7997
  const gestureEndDelay$1 = 150;
@@ -8303,8 +8193,7 @@ var ScrollWheelZoomHandler = class ScrollWheelZoomHandler extends Handler {
8303
8193
  MaplairMap.addInitHook("addHandler", "scrollWheelZoom", ScrollWheelZoomHandler);
8304
8194
  }
8305
8195
  };
8306
- //#endregion
8307
- //#region src/map/handler/TapHoldHandler.js
8196
+ // src/map/handler/TapHoldHandler.js
8308
8197
  /** @import {MaplairMap} from '../Map.js' */
8309
8198
  const tapHoldDelay = 600;
8310
8199
  /**
@@ -8415,8 +8304,7 @@ var TapHoldHandler = class TapHoldHandler extends Handler {
8415
8304
  MaplairMap.addInitHook("addHandler", "tapHold", TapHoldHandler);
8416
8305
  }
8417
8306
  };
8418
- //#endregion
8419
- //#region src/map/handler/TapDragZoomHandler.js
8307
+ // src/map/handler/TapDragZoomHandler.js
8420
8308
  /** @import {MaplairMap} from '../Map.js' */
8421
8309
  const maxTapInterval = 500;
8422
8310
  const maxTapDistance = 30;
@@ -8557,8 +8445,7 @@ var TapDragZoomHandler = class TapDragZoomHandler extends Handler {
8557
8445
  MaplairMap.addInitHook("addHandler", "tapDragZoom", TapDragZoomHandler);
8558
8446
  }
8559
8447
  };
8560
- //#endregion
8561
- //#region src/map/Map.js
8448
+ // src/map/Map.js
8562
8449
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
8563
8450
  /** @import {LatLngBoundsExpression} from '../geo/LatLngBounds.js' */
8564
8451
  /** @import {PointExpression} from '../geometry/Point.js' */
@@ -8931,7 +8818,7 @@ var MaplairMap = class MaplairMap extends Evented {
8931
8818
  * @returns {this}
8932
8819
  */
8933
8820
  setZoomAround(latlng, zoom, options) {
8934
- const scale = this.getZoomScale(zoom), viewHalf = this.getSize().divideBy(2), centerOffset = (latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng)).subtract(viewHalf).multiplyBy(1 - 1 / scale), newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
8821
+ const center = this.project(this.getCenter()), offset = latlng instanceof Point ? this.containerPointToLayerPoint(latlng).subtract(this.containerPointToLayerPoint(this.getSize().divideBy(2))) : this.project(latlng).subtract(center), newCenter = this.unproject(center.add(offset.multiplyBy(1 - 1 / this.getZoomScale(zoom))));
8935
8822
  return this.setView(newCenter, zoom, { zoom: options });
8936
8823
  }
8937
8824
  _getBoundsCenterZoom(bounds, options) {
@@ -9053,9 +8940,6 @@ var MaplairMap = class MaplairMap extends Evented {
9053
8940
  return -Math.asinh(t1 / b1);
9054
8941
  }
9055
8942
  const r0 = r(0);
9056
- function w(s) {
9057
- return w0 * (Math.cosh(r0) / Math.cosh(r0 + rho * s));
9058
- }
9059
8943
  function u(s) {
9060
8944
  return w0 * (Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2;
9061
8945
  }
@@ -9067,7 +8951,7 @@ var MaplairMap = class MaplairMap extends Evented {
9067
8951
  const t = (Date.now() - start) / duration, s = easeOut(t) * S;
9068
8952
  if (t <= 1) {
9069
8953
  this._flyToFrame = requestAnimationFrame(frame);
9070
- this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), this.getScaleZoom(w0 / w(s), startZoom), { flyTo: true });
8954
+ this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), this.getScaleZoom(Math.cosh(r0 + rho * s) / Math.cosh(r0), startZoom), { flyTo: true });
9071
8955
  } else {
9072
8956
  const zoomChanged = this._zoom !== targetZoom;
9073
8957
  this._move(targetCenter, targetZoom);
@@ -9395,7 +9279,7 @@ var MaplairMap = class MaplairMap extends Evented {
9395
9279
  */
9396
9280
  getCenter() {
9397
9281
  this._checkIfLoaded();
9398
- if (this._lastCenter && !this._moved()) return new LatLng(this._lastCenter);
9282
+ if (this._lastCenter && this._getMapPanePos().equals(this._lastCenterPanePos)) return new LatLng(this._lastCenter);
9399
9283
  return this.layerPointToLatLng(this._getCenterLayerPoint());
9400
9284
  }
9401
9285
  /**
@@ -9599,7 +9483,7 @@ var MaplairMap = class MaplairMap extends Evented {
9599
9483
  * @returns {Point}
9600
9484
  */
9601
9485
  latLngToLayerPoint(latlng) {
9602
- return this.project(LatLng.from(latlng))._round()._subtract(this.getPixelOrigin());
9486
+ return this.project(LatLng.from(latlng))._subtract(this.getPixelOrigin());
9603
9487
  }
9604
9488
  /**
9605
9489
  * Returns a `LatLng` where `lat` and `lng` has been wrapped according to the
@@ -9849,6 +9733,7 @@ var MaplairMap = class MaplairMap extends Evented {
9849
9733
  const zoomChanged = this._zoom !== zoom;
9850
9734
  this._zoom = zoom;
9851
9735
  this._lastCenter = center;
9736
+ this._lastCenterPanePos = this._getMapPanePos();
9852
9737
  this._pixelOrigin = this._getNewPixelOrigin(center);
9853
9738
  if (!suppressEvent) {
9854
9739
  if (zoomChanged || data?.pinch) this.fire("zoom", data);
@@ -9961,10 +9846,10 @@ var MaplairMap = class MaplairMap extends Evented {
9961
9846
  const target = targets[0];
9962
9847
  const data = { originalEvent: e };
9963
9848
  if (e.type !== "keydown" && e.type !== "keyup") {
9964
- const isMarker = target.getLatLng && (!target._pxRadius || target._pxRadius <= 10);
9965
- data.containerPoint = isMarker ? this.latLngToContainerPoint(target.getLatLng()) : this.pointerEventToContainerPoint(e);
9849
+ const latlng = (!target._pxRadius || target._pxRadius <= 10) && target.getLatLng?.();
9850
+ data.containerPoint = latlng ? this.latLngToContainerPoint(latlng) : this.pointerEventToContainerPoint(e);
9966
9851
  data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);
9967
- data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);
9852
+ data.latlng = latlng || this.layerPointToLatLng(data.layerPoint);
9968
9853
  }
9969
9854
  for (const t of targets) {
9970
9855
  t.fire(type, data, true);
@@ -9993,10 +9878,6 @@ var MaplairMap = class MaplairMap extends Evented {
9993
9878
  _getMapPanePos() {
9994
9879
  return getPosition(this._mapPane);
9995
9880
  }
9996
- _moved() {
9997
- const pos = this._getMapPanePos();
9998
- return pos && !pos.equals([0, 0]);
9999
- }
10000
9881
  _getTopLeftPoint(center, zoom) {
10001
9882
  return (center && zoom !== void 0 ? this._getNewPixelOrigin(center, zoom) : this.getPixelOrigin()).subtract(this._getMapPanePos());
10002
9883
  }
@@ -10012,7 +9893,7 @@ var MaplairMap = class MaplairMap extends Evented {
10012
9893
  return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
10013
9894
  }
10014
9895
  _getCenterOffset(latlng) {
10015
- return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());
9896
+ return this.latLngToLayerPoint(latlng)._round()._subtract(this._getCenterLayerPoint());
10016
9897
  }
10017
9898
  _limitCenter(center, zoom, bounds) {
10018
9899
  if (!bounds) return center;
@@ -10159,8 +10040,7 @@ for (const feature of [
10159
10040
  ZoomControl,
10160
10041
  FullscreenControl
10161
10042
  ]) feature.register(MaplairMap);
10162
- //#endregion
10163
- //#region src/layer/vector/Polyline.js
10043
+ // src/layer/vector/Polyline.js
10164
10044
  /** @import {Feature} from 'geojson' */
10165
10045
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
10166
10046
  /** @import {PointExpression} from '../../geometry/Point.js' */
@@ -10351,7 +10231,7 @@ var Polyline = class Polyline extends Path {
10351
10231
  for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
10352
10232
  points = this._rings[i];
10353
10233
  for (j = 0, len2 = points.length; j < len2 - 1; j++) {
10354
- segment = clipSegment(points[j], points[j + 1], bounds, j, true);
10234
+ segment = clipSegment(points[j], points[j + 1], bounds, j);
10355
10235
  if (!segment) continue;
10356
10236
  parts[k] ??= [];
10357
10237
  parts[k].push(segment[0]);
@@ -10405,8 +10285,7 @@ var Polyline = class Polyline extends Path {
10405
10285
  });
10406
10286
  }
10407
10287
  };
10408
- //#endregion
10409
- //#region src/geometry/PolyUtil.js
10288
+ // src/geometry/PolyUtil.js
10410
10289
  var PolyUtil_exports = /* @__PURE__ */ __exportAll({
10411
10290
  centroid: () => centroid,
10412
10291
  clipPolygon: () => clipPolygon,
@@ -10427,37 +10306,30 @@ var PolyUtil_exports = /* @__PURE__ */ __exportAll({
10427
10306
  * @returns {Point[]}
10428
10307
  */
10429
10308
  function clipPolygon(points, bounds, round) {
10430
- let clippedPoints, i, j, k, a, b, len, edge, p;
10431
- const edges = [
10309
+ for (const edge of [
10432
10310
  1,
10433
10311
  4,
10434
10312
  2,
10435
10313
  8
10436
- ];
10437
- for (i = 0, len = points.length; i < len; i++) points[i]._code = _getBitCode(points[i], bounds);
10438
- for (k = 0; k < 4; k++) {
10439
- edge = edges[k];
10440
- clippedPoints = [];
10441
- for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
10442
- a = points[i];
10443
- b = points[j];
10444
- if (!(a._code & edge)) {
10445
- if (b._code & edge) {
10446
- p = _getEdgeIntersection(b, a, edge, bounds, round);
10447
- p._code = _getBitCode(p, bounds);
10448
- clippedPoints.push(p);
10449
- }
10450
- clippedPoints.push(a);
10451
- } else if (!(b._code & edge)) {
10452
- p = _getEdgeIntersection(b, a, edge, bounds, round);
10453
- p._code = _getBitCode(p, bounds);
10454
- clippedPoints.push(p);
10455
- }
10314
+ ]) {
10315
+ if (!points.length) break;
10316
+ /** @type {Point[]} */
10317
+ const clippedPoints = [];
10318
+ let b = points[points.length - 1], bOut = isOutside(b, edge, bounds);
10319
+ for (const a of points) {
10320
+ const aOut = isOutside(a, edge, bounds);
10321
+ if (aOut !== bOut) clippedPoints.push(_getEdgeIntersection(b, a, edge, bounds, round));
10322
+ if (!aOut) clippedPoints.push(a);
10323
+ b = a;
10324
+ bOut = aOut;
10456
10325
  }
10457
10326
  points = clippedPoints;
10458
10327
  }
10459
10328
  return points;
10460
10329
  }
10330
+ function isOutside(p, edge, bounds) {
10331
+ return edge === 1 ? p.x < bounds.min.x : edge === 2 ? p.x > bounds.max.x : edge === 4 ? p.y < bounds.min.y : p.y > bounds.max.y;
10332
+ }
10461
10333
  /**
10462
10334
  * Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the passed
10463
10335
  * LatLngs (first ring) from a polygon.
@@ -10494,8 +10366,7 @@ function centroid(coords) {
10494
10366
  }
10495
10367
  return new LatLng([latSum / len, lngSum / len]);
10496
10368
  }
10497
- //#endregion
10498
- //#region src/layer/vector/Polygon.js
10369
+ // src/layer/vector/Polygon.js
10499
10370
  /** @import {Feature} from 'geojson' */
10500
10371
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
10501
10372
  /** @import {PolylineOptions} from './Polyline.js' */
@@ -10600,7 +10471,7 @@ var Polygon = class Polygon extends Polyline {
10600
10471
  return;
10601
10472
  }
10602
10473
  for (const ring of this._rings) {
10603
- const clipped = clipPolygon(ring, bounds, true);
10474
+ const clipped = clipPolygon(ring, bounds);
10604
10475
  if (clipped.length) this._parts.push(clipped);
10605
10476
  }
10606
10477
  }
@@ -10637,8 +10508,7 @@ var Polygon = class Polygon extends Polyline {
10637
10508
  });
10638
10509
  }
10639
10510
  };
10640
- //#endregion
10641
- //#region src/control/MiniMapControl.js
10511
+ // src/control/MiniMapControl.js
10642
10512
  /** @import {ControlOptions} from './Control.js' */
10643
10513
  /** @import {MaplairMapOptions} from '../map/Map.js' */
10644
10514
  /** @import {Layer} from '../layer/Layer.js' */
@@ -10808,8 +10678,7 @@ var MiniMapControl = class MiniMapControl extends Control {
10808
10678
  if (!this._miniMap.dragging?.moved()) this._map.panTo(e.latlng);
10809
10679
  }
10810
10680
  };
10811
- //#endregion
10812
- //#region src/control/ScaleControl.js
10681
+ // src/control/ScaleControl.js
10813
10682
  /** @import {ControlOptions} from './Control.js' */
10814
10683
  /** @import {MaplairMap} from '../map/Map.js' */
10815
10684
  /**
@@ -10912,8 +10781,7 @@ var ScaleControl = class ScaleControl extends Control {
10912
10781
  return pow10 * d;
10913
10782
  }
10914
10783
  };
10915
- //#endregion
10916
- //#region src/layer/marker/Icon.js
10784
+ // src/layer/marker/Icon.js
10917
10785
  /** @import {PointExpression} from '../../geometry/Point.js' */
10918
10786
  /**
10919
10787
  * Options of `Icon`.
@@ -11025,6 +10893,7 @@ var Icon = class Icon extends Class {
11025
10893
  img.style.marginLeft = `${-anchor.x}px`;
11026
10894
  img.style.marginTop = `${-anchor.y}px`;
11027
10895
  }
10896
+ img.style.transformOrigin = anchor ? `${anchor.x}px ${anchor.y}px` : "0 0";
11028
10897
  if (size) {
11029
10898
  img.style.width = `${size.x}px`;
11030
10899
  img.style.height = `${size.y}px`;
@@ -11039,14 +10908,25 @@ var Icon = class Icon extends Class {
11039
10908
  return window.devicePixelRatio > 1 && this.options[`${name}RetinaUrl`] || this.options[`${name}Url`];
11040
10909
  }
11041
10910
  };
11042
- //#endregion
11043
- //#region src/layer/marker/DefaultIcon.js
10911
+ // src/layer/marker/DefaultIcon.js
11044
10912
  /** @import {IconOptions} from './Icon.js' */
11045
10913
  /** @import {PointExpression} from '../../geometry/Point.js' */
11046
10914
  /**
10915
+ * @param {string} fill
10916
+ * @param {string} fillTop
10917
+ * @param {number} fillTopOpacity
10918
+ * @param {string} stroke
10919
+ * @param {string} strokeTop
10920
+ * @param {string} [outline]
10921
+ * @returns {string}
10922
+ */
10923
+ const marker = (fill, fillTop, fillTopOpacity, stroke, strokeTop, outline = "") => `data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round" viewBox="0 0 500 820"><defs><linearGradient id="a" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 478.727 62.272)scale(37.566)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${fill}"/><stop offset="1" stop-color="${fillTop}" stop-opacity="${fillTopOpacity}"/></linearGradient><linearGradient id="b" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 468.484 54.002)scale(19.053)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="${stroke}"/><stop offset="1" stop-color="${strokeTop}"/></linearGradient></defs><g fill="%23FFF"><path id="p" d="M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z" transform="translate(-7889.1 -9807.44)scale(19.5417)"/></g><use href="%23p" fill="url(%23a)" stroke="url(%23b)" stroke-width="1.1" stroke-linejoin="miter" stroke-miterlimit="10"/>${outline}<path fill="%23FFF" d="m-90 2030 45-863a95 95 0 0 0-111-98l-859 151 116-320a65 65 0 0 0-20-73l-941-762 212-99a65 65 0 0 0 34-79l-186-572 542 115a65 65 0 0 0 73-38l105-247 423 454a65 65 0 0 0 111-57l-204-1052 327 189a65 65 0 0 0 91-27l332-652 332 652a65 65 0 0 0 91 27l327-189-204 1052a65 65 0 0 0 111 57l423-454 105 247a65 65 0 0 0 73 38l542-115-186 572a65 65 0 0 0 34 79l212 99-941 762a65 65 0 0 0-20 73l116 320-859-151a95 95 0 0 0-111 98l45 863z" transform="translate(250 258)scale(.068)"/></svg>`;
10924
+ /**
11047
10925
  * Options of `DefaultIcon`.
11048
10926
  * @typedef {object} DefaultIconOptions
11049
10927
  * @property {string} [iconUrl] The maple leaf marker, inlined as an SVG data URI.
10928
+ * @property {string|null} [color=null] Paints the pin in the given CSS color instead of
10929
+ * the default red, overriding `iconUrl`, e.g. `new DefaultIcon({color: 'teal'})`.
11050
10930
  * @property {string} [shadowUrl] Its shadow, inlined as an SVG data URI.
11051
10931
  * @property {PointExpression|number} [iconSize=[25, 41]]
11052
10932
  * @property {PointExpression} [iconAnchor=[12, 41]]
@@ -11056,9 +10936,9 @@ var Icon = class Icon extends Class {
11056
10936
  * @extends IconOptions
11057
10937
  */
11058
10938
  /**
11059
- * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when
11060
- * no icon is specified. The maple leaf marker and its shadow are inlined as SVG data
11061
- * URIs, so they work with any bundler and need no image files.
10939
+ * A subclass of `Icon`, represents the icon to use in `Marker`s when no icon is
10940
+ * specified, optionally in another `color`. The maple leaf marker and its shadow are
10941
+ * inlined as SVG data URIs, so they work with any bundler and need no image files.
11062
10942
  *
11063
10943
  * In order to customize the default icon, just change the properties of
11064
10944
  * `DefaultIcon.defaultOptions` (which is a set of `Icon options`).
@@ -11068,13 +10948,14 @@ var Icon = class Icon extends Class {
11068
10948
  */
11069
10949
  var DefaultIcon = class DefaultIcon extends Icon {
11070
10950
  static defaultOptions = {
11071
- iconUrl: "data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" style=\"fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round\" viewBox=\"0 0 500 820\"><defs><linearGradient id=\"a\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\" gradientTransform=\"rotate(-90 478.727 62.272)scale(37.566)\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0\" stop-color=\"%23C2331B\"/><stop offset=\"1\" stop-color=\"%23E2603F\"/></linearGradient><linearGradient id=\"b\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\" gradientTransform=\"rotate(-90 468.484 54.002)scale(19.053)\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0\" stop-color=\"%238F2D20\"/><stop offset=\"1\" stop-color=\"%23B23A27\"/></linearGradient></defs><path fill=\"url(%23a)\" stroke=\"url(%23b)\" stroke-width=\"1.1\" stroke-linejoin=\"miter\" stroke-miterlimit=\"10\" d=\"M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z\" transform=\"translate(-7889.1 -9807.44)scale(19.5417)\"/><path fill=\"%23FFF\" d=\"m-90 2030 45-863a95 95 0 0 0-111-98l-859 151 116-320a65 65 0 0 0-20-73l-941-762 212-99a65 65 0 0 0 34-79l-186-572 542 115a65 65 0 0 0 73-38l105-247 423 454a65 65 0 0 0 111-57l-204-1052 327 189a65 65 0 0 0 91-27l332-652 332 652a65 65 0 0 0 91 27l327-189-204 1052a65 65 0 0 0 111 57l423-454 105 247a65 65 0 0 0 73 38l542-115-186 572a65 65 0 0 0 34 79l212 99-941 762a65 65 0 0 0-20 73l116 320-859-151a95 95 0 0 0-111 98l45 863z\" transform=\"translate(250 258)scale(.068)\"/></svg>",
10951
+ iconUrl: /* @__PURE__ */ marker("%23C2331B", "%23E2603F", 1, "%238F2D20", "%23B23A27"),
11072
10952
  shadowUrl: "data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" viewBox=\"0 0 817.2 820\"><radialGradient id=\"a\" cx=\"526.6\" cy=\"486.836\" r=\"478.154\" fx=\"275.876\" fy=\"893.983\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0\" style=\"stop-color:%235c5c5c;stop-opacity:.9477\"/><stop offset=\".112\" style=\"stop-color:%23474747;stop-opacity:.7805\"/><stop offset=\".34\" style=\"stop-color:%23202020;stop-opacity:.4413\"/><stop offset=\".523\" style=\"stop-color:%23090909;stop-opacity:.1692\"/><stop offset=\".637\" style=\"stop-color:%23000;stop-opacity:0\"/></radialGradient><path d=\"M254.7 820.0L430.1 664.9L473.9 626.1L541.3 599.9L561.5 548.6L629.0 522.4L648.1 470.5L715.4 440.2L726.3 388.9L789.2 347.6L774.9 302.4L817.1 250.3L775.4 221.8L792.3 168.8L732.1 159.3L721.8 112.9L651.7 124.5L614.0 92.7L545.0 124.7L486.2 113.3L430.2 159.7L360.8 169.0L325.1 222.0L255.1 250.3L245.6 302.4L186.6 347.8L209.1 388.9L169.0 440.0L205.6 470.8L173.5 522.7L215.1 548.9L184.8 600.2L226.4 626.3L232.1 665.1Z\" style=\"fill-rule:evenodd;clip-rule:evenodd;fill:url(%23a);fill-opacity:.7;filter:blur(15px)\"/></svg>",
11073
10953
  iconSize: [25, 41],
11074
10954
  iconAnchor: [12, 41],
11075
10955
  popupAnchor: [1, -34],
11076
10956
  tooltipAnchor: [16, -28],
11077
- shadowSize: [41, 41]
10957
+ shadowSize: [41, 41],
10958
+ color: null
11078
10959
  };
11079
10960
  /**
11080
10961
  * Creates the default icon, optionally with changed options.
@@ -11084,11 +10965,27 @@ var DefaultIcon = class DefaultIcon extends Icon {
11084
10965
  super(...args);
11085
10966
  this.callInitHooks(DefaultIcon);
11086
10967
  }
10968
+ /**
10969
+ * @param {'icon'|'shadow'} name
10970
+ * @returns {string|undefined}
10971
+ */
10972
+ _getIconUrl(name) {
10973
+ const { color } = this.options;
10974
+ if (!color || name !== "icon") return super._getIconUrl(name);
10975
+ const c = encodeURIComponent(color);
10976
+ return marker(c, c, .75, c, c, "<use href=\"%23p\" fill=\"none\" stroke=\"%23666\" stroke-opacity=\".4\"/>");
10977
+ }
11087
10978
  };
11088
- //#endregion
11089
- //#region src/layer/marker/Marker.Drag.js
10979
+ // src/layer/marker/Marker.Drag.js
11090
10980
  /** @import {Marker, MarkerMoveEvent} from './Marker.js' */
11091
10981
  /** @import {MaplairEvent, DragEndEvent} from '../../core/Events.js' */
10982
+ /** @type {Record<string, [number, number]>} */
10983
+ const arrows = {
10984
+ ArrowLeft: [-1, 0],
10985
+ ArrowRight: [1, 0],
10986
+ ArrowUp: [0, -1],
10987
+ ArrowDown: [0, 1]
10988
+ };
11092
10989
  /**
11093
10990
  * The handler of `Marker` which makes the markers draggable, see the
11094
10991
  * [`dragging`](#marker-dragging) property of markers and its `draggable` option.
@@ -11123,18 +11020,21 @@ var MarkerDrag = class MarkerDrag extends Handler {
11123
11020
  drag: this._onDrag,
11124
11021
  dragend: this._onDragEnd
11125
11022
  }, this).enable();
11023
+ on(icon, "keydown keyup blur", this._onKey, this);
11126
11024
  icon.classList.add("maplair-marker-draggable");
11127
11025
  }
11128
11026
  /**
11129
11027
  * Makes the icon of the marker undraggable, called by `disable()`.
11130
11028
  */
11131
11029
  removeHooks() {
11030
+ this._keyOffset = null;
11132
11031
  this._draggable.off({
11133
11032
  dragstart: this._onDragStart,
11134
11033
  predrag: this._onPreDrag,
11135
11034
  drag: this._onDrag,
11136
11035
  dragend: this._onDragEnd
11137
11036
  }, this).disable();
11037
+ off(this._draggable._element, "keydown keyup blur", this._onKey, this);
11138
11038
  this._marker._icon?.classList.remove("maplair-marker-draggable");
11139
11039
  }
11140
11040
  /**
@@ -11169,8 +11069,8 @@ var MarkerDrag = class MarkerDrag extends Handler {
11169
11069
  }
11170
11070
  }
11171
11071
  _onDrag(e) {
11172
- const marker = this._marker, shadow = marker._shadow, iconPos = getPosition(marker._icon), latlng = marker._map.layerPointToLatLng(iconPos);
11173
- if (shadow) setPosition(shadow, iconPos);
11072
+ const marker = this._marker, iconPos = getPosition(marker._icon), latlng = marker._map.layerPointToLatLng(iconPos);
11073
+ marker._positionElements(iconPos);
11174
11074
  marker._latlng = latlng;
11175
11075
  e.latlng = latlng;
11176
11076
  e.oldLatLng = this._oldLatLng;
@@ -11181,9 +11081,37 @@ var MarkerDrag = class MarkerDrag extends Handler {
11181
11081
  delete this._oldLatLng;
11182
11082
  this._marker.fire("moveend").fire("dragend", e);
11183
11083
  }
11084
+ /** @param {KeyboardEvent|FocusEvent} e */
11085
+ _onKey(e) {
11086
+ const k = e, dir = arrows[k.key], draggable = this._draggable, { options, _map: map } = this._marker;
11087
+ if (e.type !== "keydown") {
11088
+ if (this._keyOffset) {
11089
+ this._keyOffset = null;
11090
+ draggable.finishDrag();
11091
+ }
11092
+ } else if (dir && k.target === draggable._element && !(k.altKey || k.ctrlKey || k.metaKey)) {
11093
+ e.preventDefault();
11094
+ if (!this._keyOffset) {
11095
+ if (Draggable._dragging) return;
11096
+ Draggable._dragging = draggable;
11097
+ draggable._startPos = getPosition(draggable._element);
11098
+ draggable._moved = draggable._moving = true;
11099
+ this._keyOffset = new Point(0, 0);
11100
+ draggable.fire("dragstart");
11101
+ }
11102
+ const offset = new Point(...dir).multiplyBy(k.shiftKey ? 30 : 10);
11103
+ this._keyOffset = this._keyOffset.add(map._rotateToPane?.(offset) ?? offset);
11104
+ draggable._newPos = draggable._startPos.add(this._keyOffset);
11105
+ setPosition(draggable._element, draggable._newPos);
11106
+ draggable.fire("drag", { originalEvent: k });
11107
+ if (options.autoPan) map.panInside(this._marker._latlng, {
11108
+ padding: options.autoPanPadding,
11109
+ animate: false
11110
+ });
11111
+ }
11112
+ }
11184
11113
  };
11185
- //#endregion
11186
- //#region src/layer/marker/Marker.js
11114
+ // src/layer/marker/Marker.js
11187
11115
  /** @import {Feature} from 'geojson' */
11188
11116
  /** @import {Icon} from './Icon.js' */
11189
11117
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
@@ -11209,6 +11137,10 @@ var MarkerDrag = class MarkerDrag extends Handler {
11209
11137
  * top of all others (or below), specifying a high value like `1000` (or high negative
11210
11138
  * value, respectively).
11211
11139
  * @property {number} [opacity=1] The opacity of the marker.
11140
+ * @property {number|null} [rotation=null] Rotation of the marker icon in degrees,
11141
+ * clockwise, around the icon anchor, e.g. for the heading of a vehicle. A rotated
11142
+ * marker, even at 0°, has no shadow, since the shadow of an upright pin looks wrong
11143
+ * under a tilted one. `null` means no rotation.
11212
11144
  * @property {boolean} [riseOnHover=false] If `true`, the marker will get on top of
11213
11145
  * others when you hover the pointer over it.
11214
11146
  * @property {number} [riseOffset=250] The z-index offset used for the `riseOnHover`
@@ -11228,7 +11160,8 @@ var MarkerDrag = class MarkerDrag extends Handler {
11228
11160
  * marker is focused (via e.g. pressing `tab` on the keyboard) to ensure the marker is
11229
11161
  * visible within the map's bounds.
11230
11162
  * @property {boolean} [draggable=false] Whether the marker is draggable with pointer or
11231
- * not.
11163
+ * not. A focused draggable marker can also be moved with the arrow keys, by 10 pixels
11164
+ * or 30 with Shift.
11232
11165
  * @property {boolean} [autoPan=false] Whether to pan the map when dragging this marker
11233
11166
  * near its edge or not.
11234
11167
  * @property {PointExpression} [autoPanPadding=[50, 50]] Distance (in pixels to the
@@ -11267,6 +11200,7 @@ var Marker = class Marker extends Layer {
11267
11200
  alt: "Marker",
11268
11201
  zIndexOffset: 0,
11269
11202
  opacity: 1,
11203
+ rotation: null,
11270
11204
  riseOnHover: false,
11271
11205
  riseOffset: 250,
11272
11206
  pane: "markerPane",
@@ -11394,7 +11328,7 @@ var Marker = class Marker extends Layer {
11394
11328
  */
11395
11329
  update() {
11396
11330
  if (this._icon && this._map && !this._culled) {
11397
- const pos = this._map.latLngToLayerPoint(this._latlng).round();
11331
+ const pos = this._map.latLngToLayerPoint(this._latlng)._round();
11398
11332
  this._setPos(pos);
11399
11333
  }
11400
11334
  return this;
@@ -11421,7 +11355,7 @@ var Marker = class Marker extends Layer {
11421
11355
  pointerout: this._resetZIndex
11422
11356
  });
11423
11357
  if (this.options.autoPanOnFocus) on(icon, "focus", this._panOnFocus, this);
11424
- const newShadow = options.shadow ? options.icon.createShadow(this._shadow) : null;
11358
+ const newShadow = options.shadow ? options.icon.createShadow?.(this._shadow) ?? null : null;
11425
11359
  let addShadow = false;
11426
11360
  if (newShadow !== this._shadow) {
11427
11361
  this._removeShadow();
@@ -11467,18 +11401,28 @@ var Marker = class Marker extends Layer {
11467
11401
  this._shadow = null;
11468
11402
  }
11469
11403
  _setPos(pos) {
11470
- if (this._icon) setPosition(this._icon, pos);
11471
- if (this._shadow) setPosition(this._shadow, pos);
11404
+ this._positionElements(pos);
11472
11405
  this._zIndex = pos.y + this.options.zIndexOffset;
11473
11406
  this._resetZIndex();
11474
11407
  }
11408
+ _positionElements(pos) {
11409
+ const rotation = this.options.rotation;
11410
+ if (this._icon) {
11411
+ setPosition(this._icon, pos);
11412
+ if (rotation != null) this._icon.style.transform += ` rotate(${rotation}deg)`;
11413
+ }
11414
+ if (this._shadow) {
11415
+ setPosition(this._shadow, pos);
11416
+ this._shadow.style.display = rotation == null ? "" : "none";
11417
+ }
11418
+ }
11475
11419
  _updateZIndex(offset) {
11476
11420
  const zIndex = String(this._zIndex + offset);
11477
11421
  if (this._icon && this._icon.style.zIndex !== zIndex) this._icon.style.zIndex = zIndex;
11478
11422
  }
11479
11423
  _animateZoom(opt) {
11480
11424
  if (this._culled) return;
11481
- const pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
11425
+ const pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center)._round();
11482
11426
  this._setPos(pos);
11483
11427
  }
11484
11428
  _updateInteractive() {
@@ -11530,6 +11474,27 @@ var Marker = class Marker extends Layer {
11530
11474
  }
11531
11475
  }
11532
11476
  /**
11477
+ * Returns the current [rotation](#markeroptions-rotation) of the marker in degrees.
11478
+ * @returns {number|null}
11479
+ */
11480
+ getRotation() {
11481
+ return this.options.rotation;
11482
+ }
11483
+ /**
11484
+ * Changes the [rotation](#markeroptions-rotation) of the marker; `null` removes it.
11485
+ * @param {number|null} rotation
11486
+ * @returns {this}
11487
+ */
11488
+ setRotation(rotation) {
11489
+ this.options.rotation = rotation;
11490
+ if (this._icon && !this._map._animatingZoom) {
11491
+ this._positionElements(getPosition(this._icon));
11492
+ this._popup?._updatePosition();
11493
+ this._tooltip?._updatePosition();
11494
+ }
11495
+ return this;
11496
+ }
11497
+ /**
11533
11498
  * Changes the opacity of the marker.
11534
11499
  * @param {number} opacity
11535
11500
  * @returns {this}
@@ -11561,19 +11526,23 @@ var Marker = class Marker extends Layer {
11561
11526
  _panOnFocus() {
11562
11527
  const map = this._map;
11563
11528
  if (!map) return;
11564
- const iconOpts = this.options.icon.options;
11565
- const size = iconOpts.iconSize ? Point.from(iconOpts.iconSize) : new Point(0, 0);
11566
- const anchor = iconOpts.iconAnchor ? Point.from(iconOpts.iconAnchor) : new Point(0, 0);
11529
+ const icon = this._icon, style = getComputedStyle(icon), anchor = new Point(-parseFloat(style.marginLeft) || 0, -parseFloat(style.marginTop) || 0), size = new Point(icon.offsetWidth, icon.offsetHeight);
11567
11530
  map.panInside(this._latlng, {
11568
11531
  paddingTopLeft: anchor,
11569
11532
  paddingBottomRight: size.subtract(anchor)
11570
11533
  });
11571
11534
  }
11572
11535
  _getPopupAnchor() {
11573
- return this.options.icon.options.popupAnchor;
11536
+ return this._rotateAnchor(this.options.icon.options.popupAnchor);
11574
11537
  }
11575
11538
  _getTooltipAnchor() {
11576
- return this.options.icon.options.tooltipAnchor;
11539
+ return this._rotateAnchor(this.options.icon.options.tooltipAnchor);
11540
+ }
11541
+ _rotateAnchor(anchor) {
11542
+ const angle = this.options.rotation * Math.PI / 180;
11543
+ if (!angle || !anchor) return anchor;
11544
+ const { x, y } = Point.from(anchor), cos = Math.cos(angle), sin = Math.sin(angle);
11545
+ return new Point(x * cos - y * sin, x * sin + y * cos);
11577
11546
  }
11578
11547
  /**
11579
11548
  * Coordinates values are rounded with [`formatNum`](#util-formatnum) to the
@@ -11587,8 +11556,7 @@ var Marker = class Marker extends Layer {
11587
11556
  return pointToGeoJSON(this, precision);
11588
11557
  }
11589
11558
  };
11590
- //#endregion
11591
- //#region src/control/SearchControl.js
11559
+ // src/control/SearchControl.js
11592
11560
  /** @import {ControlOptions} from './Control.js' */
11593
11561
  /** @import {MaplairMap} from '../map/Map.js' */
11594
11562
  /** @import {MaplairEvent} from '../core/Events.js' */
@@ -12100,8 +12068,7 @@ var SearchControl = class SearchControl extends Control {
12100
12068
  else this.collapse();
12101
12069
  }
12102
12070
  };
12103
- //#endregion
12104
- //#region src/control/SideBySideControl.js
12071
+ // src/control/SideBySideControl.js
12105
12072
  /** @import {ControlOptions} from './Control.js' */
12106
12073
  /** @import {MaplairMap} from '../map/Map.js' */
12107
12074
  /** @import {Layer} from '../layer/Layer.js' */
@@ -12299,8 +12266,7 @@ var SideBySideControl = class SideBySideControl extends Control {
12299
12266
  function getElement(layer) {
12300
12267
  return layer.getContainer?.() ?? layer.getElement?.();
12301
12268
  }
12302
- //#endregion
12303
- //#region src/control/TextControl.js
12269
+ // src/control/TextControl.js
12304
12270
  /** @import {ControlOptions} from './Control.js' */
12305
12271
  /**
12306
12272
  * Options of `TextControl`.
@@ -12374,8 +12340,7 @@ var TextControl = class TextControl extends Control {
12374
12340
  container.hidden = !content;
12375
12341
  }
12376
12342
  };
12377
- //#endregion
12378
- //#region src/control/TimeControl.js
12343
+ // src/control/TimeControl.js
12379
12344
  /** @import {ControlOptions} from './Control.js' */
12380
12345
  /** @import {MaplairMap} from '../map/Map.js' */
12381
12346
  /** @import {Layer} from '../layer/Layer.js' */
@@ -12774,8 +12739,7 @@ var TimeControl = class TimeControl extends Control {
12774
12739
  return this;
12775
12740
  }
12776
12741
  };
12777
- //#endregion
12778
- //#region src/geo/projection/Projection.LonLat.js
12742
+ // src/geo/projection/LonLatProjection.js
12779
12743
  /** @import {Projection} from './index.js' */
12780
12744
  /**
12781
12745
  * Equirectangular, or Plate Carree projection — the most simple projection,
@@ -12784,7 +12748,7 @@ var TimeControl = class TimeControl extends Control {
12784
12748
  * `EPSG4326` and `SimpleCRS` CRS.
12785
12749
  * @type {Projection}
12786
12750
  */
12787
- const LonLat = {
12751
+ const LonLatProjection = {
12788
12752
  project(latlng) {
12789
12753
  latlng = LatLng.from(latlng);
12790
12754
  return new Point(latlng.lng, latlng.lat);
@@ -12800,7 +12764,7 @@ const LonLat = {
12800
12764
  * Earth is an ellipsoid. Used by the EPSG:3395 CRS.
12801
12765
  * @type {Projection & {R: number, R_MINOR: number}}
12802
12766
  */
12803
- const Mercator = {
12767
+ const MercatorProjection = {
12804
12768
  R: 6378137,
12805
12769
  R_MINOR: 6356752.314245179,
12806
12770
  bounds: /* @__PURE__ */ new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),
@@ -12826,15 +12790,7 @@ const Mercator = {
12826
12790
  return new LatLng(phi * d, point.x * d / r);
12827
12791
  }
12828
12792
  };
12829
- //#endregion
12830
- //#region src/geo/projection/index.js
12831
- var projection_exports = /* @__PURE__ */ __exportAll({
12832
- LonLat: () => LonLat,
12833
- Mercator: () => Mercator,
12834
- SphericalMercator: () => SphericalMercator
12835
- });
12836
- //#endregion
12837
- //#region src/geo/crs/EPSG3395.js
12793
+ // src/geo/crs/EPSG3395.js
12838
12794
  /** @import {Projection} from '../projection/index.js' */
12839
12795
  /**
12840
12796
  * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
@@ -12843,15 +12799,14 @@ var EPSG3395 = class extends EarthCRS {
12843
12799
  /** @type {string} */
12844
12800
  static code = "EPSG:3395";
12845
12801
  /** @type {Projection} */
12846
- static projection = Mercator;
12802
+ static projection = MercatorProjection;
12847
12803
  /** @type {Transformation} */
12848
12804
  static transformation = /* @__PURE__ */ (() => {
12849
- const scale = .5 / (Math.PI * Mercator.R);
12805
+ const scale = .5 / (Math.PI * MercatorProjection.R);
12850
12806
  return new Transformation(scale, .5, -scale, .5);
12851
12807
  })();
12852
12808
  };
12853
- //#endregion
12854
- //#region src/geo/crs/EPSG4326.js
12809
+ // src/geo/crs/EPSG4326.js
12855
12810
  /** @import {Projection} from '../projection/index.js' */
12856
12811
  /**
12857
12812
  * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
@@ -12867,12 +12822,11 @@ var EPSG4326 = class extends EarthCRS {
12867
12822
  /** @type {string} */
12868
12823
  static code = "EPSG:4326";
12869
12824
  /** @type {Projection} */
12870
- static projection = LonLat;
12825
+ static projection = LonLatProjection;
12871
12826
  /** @type {Transformation} */
12872
12827
  static transformation = /* @__PURE__ */ new Transformation(1 / 180, 1, -1 / 180, .5);
12873
12828
  };
12874
- //#endregion
12875
- //#region src/geo/crs/SimpleCRS.js
12829
+ // src/geo/crs/SimpleCRS.js
12876
12830
  /** @import {LatLng} from '../LatLng.js' */
12877
12831
  /** @import {Projection} from '../projection/index.js' */
12878
12832
  /**
@@ -12883,7 +12837,7 @@ var EPSG4326 = class extends EarthCRS {
12883
12837
  */
12884
12838
  var SimpleCRS = class extends CRS {
12885
12839
  /** @type {Projection} */
12886
- static projection = LonLat;
12840
+ static projection = LonLatProjection;
12887
12841
  /** @type {Transformation} */
12888
12842
  static transformation = /* @__PURE__ */ new Transformation(1, 0, -1, 0);
12889
12843
  /**
@@ -12915,8 +12869,7 @@ var SimpleCRS = class extends CRS {
12915
12869
  /** @type {boolean} */
12916
12870
  static infinite = true;
12917
12871
  };
12918
- //#endregion
12919
- //#region src/layer/GeoJSON.js
12872
+ // src/layer/GeoJSON.js
12920
12873
  /** @import {Feature, FeatureCollection, GeoJSON as GeoJSONData, GeoJsonObject, Geometry} from 'geojson' */
12921
12874
  /** @import {Layer, InteractiveLayerOptions} from './Layer.js' */
12922
12875
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
@@ -13012,19 +12965,18 @@ var GeoJSON = class GeoJSON extends FeatureGroup {
13012
12965
  * @returns {this}
13013
12966
  */
13014
12967
  addData(geojson) {
13015
- const features = Array.isArray(geojson) ? geojson : geojson.features;
13016
- if (features) {
13017
- for (const feature of features) if (feature.geometries || feature.geometry || feature.features || feature.coordinates) this.addData(feature);
12968
+ if (Array.isArray(geojson) || "features" in geojson) {
12969
+ for (const data of Array.isArray(geojson) ? geojson : geojson.features) this.addData(data);
13018
12970
  return this;
13019
12971
  }
13020
- const options = this.options;
13021
- if (options.filter && !options.filter(geojson)) return this;
13022
- const layer = GeoJSON.geometryToLayer(geojson, options);
12972
+ const options = this.options, feature = GeoJSON.asFeature(geojson);
12973
+ if (!feature.geometry || options.filter && !options.filter(feature)) return this;
12974
+ const layer = GeoJSON.geometryToLayer(feature, options);
13023
12975
  if (!layer) return this;
13024
- layer.feature = GeoJSON.asFeature(geojson);
12976
+ layer.feature = feature;
13025
12977
  layer.defaultOptions = layer.options;
13026
12978
  this.resetStyle(layer);
13027
- if (options.onEachFeature) options.onEachFeature(geojson, layer);
12979
+ if (options.onEachFeature) options.onEachFeature(feature, layer);
13028
12980
  return this.addLayer(layer);
13029
12981
  }
13030
12982
  /**
@@ -13173,8 +13125,7 @@ var GeoJSON = class GeoJSON extends FeatureGroup {
13173
13125
  return asFeature(geojson);
13174
13126
  }
13175
13127
  };
13176
- //#endregion
13177
- //#region src/layer/Classification.js
13128
+ // src/layer/Classification.js
13178
13129
  /** @import {PathOptions} from './vector/Path.js' */
13179
13130
  /**
13180
13131
  * A class of a `Classification`, given by value or by range.
@@ -13442,8 +13393,7 @@ function rangesOf(breaks) {
13442
13393
  return range;
13443
13394
  });
13444
13395
  }
13445
- //#endregion
13446
- //#region src/layer/HeatLayer.js
13396
+ // src/layer/HeatLayer.js
13447
13397
  /** @import {BlanketOverlayOptions} from './BlanketOverlay.js' */
13448
13398
  /** @import {LatLngExpression} from '../geo/LatLng.js' */
13449
13399
  /**
@@ -13599,7 +13549,7 @@ var HeatLayer = class HeatLayer extends BlanketOverlay {
13599
13549
  if (!map || !this._bounds) return;
13600
13550
  const ctx = this._ctx, { width, height } = this._container, offset = this._bounds.min, { radius, blur, max, minOpacity } = this.options, r = radius + blur, maxZoom = this.options.maxZoom ?? map.getMaxZoom(), zoomFactor = 1 / 2 ** Math.max(0, Math.min(maxZoom - map.getZoom(), 12)), cellSize = radius / 2, grid = /* @__PURE__ */ new Map();
13601
13551
  for (const latlng of this._latlngs) {
13602
- const point = map.latLngToLayerPoint(latlng).subtract(offset);
13552
+ const point = map.latLngToLayerPoint(latlng)._round()._subtract(offset);
13603
13553
  if (point.x < -r || point.y < -r || point.x > width + r || point.y > height + r) continue;
13604
13554
  const intensity = (latlng.alt ?? latlng[2] ?? 1) * zoomFactor, key = `${Math.floor(point.x / cellSize)}:${Math.floor(point.y / cellSize)}`, cell = grid.get(key);
13605
13555
  if (cell) {
@@ -13633,8 +13583,7 @@ var HeatLayer = class HeatLayer extends BlanketOverlay {
13633
13583
  ctx.putImageData(image, 0, 0);
13634
13584
  }
13635
13585
  };
13636
- //#endregion
13637
- //#region src/layer/ImageOverlay.js
13586
+ // src/layer/ImageOverlay.js
13638
13587
  /** @import {InteractiveLayerOptions} from './Layer.js' */
13639
13588
  /** @import {LatLng} from '../geo/LatLng.js' */
13640
13589
  /** @import {LatLngBoundsExpression} from '../geo/LatLngBounds.js' */
@@ -13857,7 +13806,7 @@ var ImageOverlay = class ImageOverlay extends Layer {
13857
13806
  setTransform(this._image, offset, scale);
13858
13807
  }
13859
13808
  _reset() {
13860
- const image = this._image, bounds = new Bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest()), this._map.latLngToLayerPoint(this._bounds.getSouthEast())), size = bounds.getSize();
13809
+ const image = this._image, bounds = new Bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest())._round(), this._map.latLngToLayerPoint(this._bounds.getSouthEast())._round()), size = bounds.getSize();
13861
13810
  setPosition(image, bounds.min);
13862
13811
  image.style.width = `${size.x}px`;
13863
13812
  image.style.height = `${size.y}px`;
@@ -13884,8 +13833,7 @@ var ImageOverlay = class ImageOverlay extends Layer {
13884
13833
  return this._bounds.getCenter();
13885
13834
  }
13886
13835
  };
13887
- //#endregion
13888
- //#region src/layer/VideoOverlay.js
13836
+ // src/layer/VideoOverlay.js
13889
13837
  /** @import {ImageOverlayOptions} from './ImageOverlay.js' */
13890
13838
  /** @import {LatLngBoundsExpression} from '../geo/LatLngBounds.js' */
13891
13839
  /** @import {MaplairEvent} from '../core/Events.js' */
@@ -13977,8 +13925,7 @@ var VideoOverlay = class VideoOverlay extends ImageOverlay {
13977
13925
  }
13978
13926
  }
13979
13927
  };
13980
- //#endregion
13981
- //#region src/layer/SVGOverlay.js
13928
+ // src/layer/SVGOverlay.js
13982
13929
  /** @import {ImageOverlayOptions} from './ImageOverlay.js' */
13983
13930
  /** @import {LatLngBoundsExpression} from '../geo/LatLngBounds.js' */
13984
13931
  /**
@@ -14023,8 +13970,7 @@ var SVGOverlay = class SVGOverlay extends ImageOverlay {
14023
13970
  if (this.options.className) el.classList.add(...splitWords(this.options.className));
14024
13971
  }
14025
13972
  };
14026
- //#endregion
14027
- //#region src/layer/marker/DivIcon.js
13973
+ // src/layer/marker/DivIcon.js
14028
13974
  /** @import {IconOptions} from './Icon.js' */
14029
13975
  /** @import {PointExpression} from '../../geometry/Point.js' */
14030
13976
  /**
@@ -14097,8 +14043,7 @@ var DivIcon = class DivIcon extends Icon {
14097
14043
  return null;
14098
14044
  }
14099
14045
  };
14100
- //#endregion
14101
- //#region src/layer/marker/SvgIcon.js
14046
+ // src/layer/marker/SvgIcon.js
14102
14047
  /** @import {DefaultIconOptions} from './DefaultIcon.js' */
14103
14048
  const svgNS = "http://www.w3.org/2000/svg";
14104
14049
  const markerPath = "M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z";
@@ -14207,8 +14152,7 @@ var SvgIcon = class SvgIcon extends DefaultIcon {
14207
14152
  return div;
14208
14153
  }
14209
14154
  };
14210
- //#endregion
14211
- //#region src/layer/marker/MarkerClusterGroup.js
14155
+ // src/layer/marker/MarkerClusterGroup.js
14212
14156
  /** @import {Layer, LayerOptions} from '../Layer.js' */
14213
14157
  /** @import {MaplairEvent} from '../../core/Events.js' */
14214
14158
  /**
@@ -14498,8 +14442,7 @@ var MarkerClusterGroup = class MarkerClusterGroup extends FeatureGroup {
14498
14442
  if (map && this._shown.has(spider.clusterMarker)) map.addLayer(spider.clusterMarker);
14499
14443
  }
14500
14444
  };
14501
- //#endregion
14502
- //#region src/layer/tile/GridLayer.js
14445
+ // src/layer/tile/GridLayer.js
14503
14446
  /** @import {LatLngBoundsExpression} from '../../geo/LatLngBounds.js' */
14504
14447
  /** @import {MaplairMap} from '../../map/Map.js' */
14505
14448
  /** @import {MaplairEvent, TileEvent, TileErrorEvent} from '../../core/Events.js' */
@@ -14748,7 +14691,7 @@ var GridLayer = class GridLayer extends Layer {
14748
14691
  * @returns {boolean}
14749
14692
  */
14750
14693
  isLoading() {
14751
- return this._loading;
14694
+ return !!this._loading;
14752
14695
  }
14753
14696
  /**
14754
14697
  * Causes the layer to clear all the tiles and request them again.
@@ -15138,9 +15081,10 @@ var GridLayer = class GridLayer extends Layer {
15138
15081
  coords
15139
15082
  });
15140
15083
  }
15141
- if (this._noTilesToLoad()) {
15084
+ if (this._map && this._noTilesToLoad()) {
15142
15085
  this._loading = false;
15143
15086
  this.fire("load");
15087
+ if (!this._map) return;
15144
15088
  this._map._scheduleIdleCheck();
15145
15089
  if (!this._map._fadeAnimated) requestAnimationFrame(this._pruneTiles.bind(this));
15146
15090
  else this._pruneTimeout = setTimeout(this._pruneTiles.bind(this), 250);
@@ -15173,9 +15117,7 @@ var GridLayer = class GridLayer extends Layer {
15173
15117
  return Object.values(this._tiles).every((t) => t.loaded);
15174
15118
  }
15175
15119
  };
15176
- //#endregion
15177
- //#region src/layer/tile/TileLayer.js
15178
- /** @import {Point} from '../../geometry/Point.js' */
15120
+ // src/layer/tile/TileLayer.js
15179
15121
  /** @import {GridLayerOptions, TileDoneCallback} from './GridLayer.js' */
15180
15122
  /** @import {TileEvent} from '../../core/Events.js' */
15181
15123
  const osmHosts = ["tile.openstreetmap.org", "tile.osm.org"];
@@ -15308,7 +15250,8 @@ var TileLayer = class TileLayer extends GridLayer {
15308
15250
  Object.assign(this.options, this._nonRetinaOptions);
15309
15251
  this._retina = window.devicePixelRatio > 1;
15310
15252
  if (this.options.detectRetina && this._retina && this.options.maxZoom > 0) {
15311
- this.options.tileSize = Math.floor(this.options.tileSize / 2);
15253
+ const tileSize = this.options.tileSize;
15254
+ this.options.tileSize = tileSize instanceof Point ? tileSize.divideBy(2).floor() : Math.floor(tileSize / 2);
15312
15255
  if (!this.options.zoomReverse) {
15313
15256
  this.options.zoomOffset++;
15314
15257
  this.options.maxZoom = Math.max(this.options.minZoom, this.options.maxZoom - 1);
@@ -15434,8 +15377,8 @@ var TileLayer = class TileLayer extends GridLayer {
15434
15377
  done(null, tile);
15435
15378
  }
15436
15379
  _tileOnError(done, tile, e) {
15437
- const errorUrl = this.options.errorTileUrl;
15438
- if (errorUrl && tile.getAttribute("src") !== errorUrl) tile.src = errorUrl;
15380
+ const errorUrl = this.options.errorTileUrl, src = tile.getAttribute("src");
15381
+ if (errorUrl && src !== errorUrl && (src || tile.isConnected)) tile.src = errorUrl;
15439
15382
  done(e, tile);
15440
15383
  }
15441
15384
  _getZoomForUrl() {
@@ -15445,8 +15388,8 @@ var TileLayer = class TileLayer extends GridLayer {
15445
15388
  return zoom + zoomOffset;
15446
15389
  }
15447
15390
  _getSubdomain(tilePoint) {
15448
- const index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;
15449
- return this.options.subdomains[index];
15391
+ const { subdomains } = this.options;
15392
+ return subdomains?.[Math.abs(tilePoint.x + tilePoint.y) % subdomains.length];
15450
15393
  }
15451
15394
  _abortLoading() {
15452
15395
  let i, tile;
@@ -15479,8 +15422,7 @@ var TileLayer = class TileLayer extends GridLayer {
15479
15422
  return Math.round(super._clampZoom(zoom));
15480
15423
  }
15481
15424
  };
15482
- //#endregion
15483
- //#region src/layer/tile/WMSTileLayer.js
15425
+ // src/layer/tile/WMSTileLayer.js
15484
15426
  /** @import {CRS} from '../../geo/crs/CRS.js' */
15485
15427
  /** @import {Point} from '../../geometry/Point.js' */
15486
15428
  /** @import {MaplairMap} from '../../map/Map.js' */
@@ -15577,8 +15519,9 @@ var WMSTileLayer = class WMSTileLayer extends TileLayer {
15577
15519
  _updateCrs() {
15578
15520
  this._crs = this.options.crs ?? this._map.options.crs;
15579
15521
  this._wmsVersion = parseFloat(this.wmsParams.version);
15580
- const projectionKey = this._wmsVersion >= 1.3 ? "crs" : "srs";
15581
- this.wmsParams[projectionKey] = this._crs.code;
15522
+ delete this.wmsParams.srs;
15523
+ delete this.wmsParams.crs;
15524
+ this.wmsParams[this._wmsVersion >= 1.3 ? "crs" : "srs"] = this._crs.code;
15582
15525
  }
15583
15526
  /**
15584
15527
  * Returns the map events the layer listens to, see `Layer`.
@@ -15647,6 +15590,7 @@ var WMSTileLayer = class WMSTileLayer extends TileLayer {
15647
15590
  */
15648
15591
  setParams(params, noRedraw) {
15649
15592
  Object.assign(this.wmsParams, params);
15593
+ if (this._map) this._updateCrs();
15650
15594
  if (!noRedraw) {
15651
15595
  this._keepCurrentTiles();
15652
15596
  this.redraw();
@@ -15654,8 +15598,7 @@ var WMSTileLayer = class WMSTileLayer extends TileLayer {
15654
15598
  return this;
15655
15599
  }
15656
15600
  };
15657
- //#endregion
15658
- //#region src/layer/vector/Canvas.js
15601
+ // src/layer/vector/Canvas.js
15659
15602
  /** @import {MaplairMap} from '../../map/Map.js' */
15660
15603
  /** @import {EventListener} from '../../core/Events.js' */
15661
15604
  /** @import {RendererOptions} from './Renderer.js' */
@@ -15812,10 +15755,8 @@ var Canvas = class Canvas extends Renderer {
15812
15755
  this._requestRedraw(layer);
15813
15756
  }
15814
15757
  _updateDashArray(layer) {
15815
- if (typeof layer.options.dashArray === "string") {
15816
- const parts = layer.options.dashArray.split(DASH_SEPARATOR_RE$1);
15817
- layer.options._dashArray = parts.map((n) => Number(n)).filter((n) => !isNaN(n));
15818
- } else layer.options._dashArray = layer.options.dashArray;
15758
+ if (typeof layer.options.dashArray === "string") layer._dashArray = layer.options.dashArray.split(DASH_SEPARATOR_RE$1).map((n) => Number(n)).filter((n) => !isNaN(n));
15759
+ else layer._dashArray = layer.options.dashArray;
15819
15760
  }
15820
15761
  _requestRedraw(layer) {
15821
15762
  if (!this._map) return;
@@ -15886,14 +15827,10 @@ var Canvas = class Canvas extends Renderer {
15886
15827
  }
15887
15828
  _updateCircle(layer) {
15888
15829
  if (!this._drawing || layer._empty()) return;
15889
- const p = layer._point, ctx = this._ctx, r = Math.max(Math.round(layer._pxRadius), 1), s = (Math.max(Math.round(layer._pxRadiusY), 1) || r) / r;
15890
- if (s !== 1) {
15891
- ctx.save();
15892
- ctx.scale(1, s);
15893
- }
15830
+ const { x, y } = layer._point, ctx = this._ctx, r = Math.max(Math.round(layer._pxRadius), 1), ry = Math.max(Math.round(layer._pxRadiusY), 1) || r;
15894
15831
  ctx.beginPath();
15895
- ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false);
15896
- if (s !== 1) ctx.restore();
15832
+ if (ry === r) ctx.arc(x, y, r, 0, Math.PI * 2);
15833
+ else ctx.ellipse(x, y, r, ry, 0, 0, Math.PI * 2);
15897
15834
  this._fillStroke(ctx, layer);
15898
15835
  }
15899
15836
  _fillStroke(ctx, layer) {
@@ -15905,7 +15842,7 @@ var Canvas = class Canvas extends Renderer {
15905
15842
  }
15906
15843
  if (options.stroke && options.weight !== 0) {
15907
15844
  ctx.lineDashOffset = Number(options.dashOffset ?? 0);
15908
- ctx.setLineDash(options._dashArray ?? []);
15845
+ ctx.setLineDash(layer._dashArray ?? []);
15909
15846
  ctx.globalAlpha = options.opacity;
15910
15847
  ctx.lineWidth = options.weight;
15911
15848
  ctx.strokeStyle = options.color;
@@ -15995,8 +15932,7 @@ var Canvas = class Canvas extends Renderer {
15995
15932
  this._requestRedraw(layer);
15996
15933
  }
15997
15934
  };
15998
- //#endregion
15999
- //#region src/layer/vector/Circle.js
15935
+ // src/layer/vector/Circle.js
16000
15936
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
16001
15937
  /** @import {CircleMarkerOptions} from './CircleMarker.js' */
16002
15938
  /**
@@ -16025,15 +15961,18 @@ var Circle = class Circle extends CircleMarker {
16025
15961
  * @param {CircleOptions} [options]
16026
15962
  */
16027
15963
  constructor(latlng, options) {
15964
+ if (typeof options === "number") throw new Error("Circle: the radius is an option in Maplair. Use new Circle(latlng, {radius}).");
16028
15965
  super(latlng, options);
16029
15966
  if (isNaN(this.options.radius)) throw new Error("Circle radius cannot be NaN");
16030
15967
  this.callInitHooks(Circle);
16031
15968
  }
16032
15969
  /**
16033
- * Returns the `LatLngBounds` of the path.
15970
+ * Returns the `LatLngBounds` of the path. When the circle isn't on a map, they're
15971
+ * approximated on a sphere.
16034
15972
  * @returns {LatLngBounds}
16035
15973
  */
16036
15974
  getBounds() {
15975
+ if (!this._map) return this._latlng.toBounds(this._radius * 2);
16037
15976
  const half = [this._pxRadius, this._pxRadiusY ?? this._pxRadius];
16038
15977
  return new LatLngBounds(this._map.layerPointToLatLng(this._point.subtract(half)), this._map.layerPointToLatLng(this._point.add(half)));
16039
15978
  }
@@ -16054,8 +15993,7 @@ var Circle = class Circle extends CircleMarker {
16054
15993
  this._updateBounds();
16055
15994
  }
16056
15995
  };
16057
- //#endregion
16058
- //#region src/layer/vector/Rectangle.js
15996
+ // src/layer/vector/Rectangle.js
16059
15997
  /** @import {LatLngBoundsExpression} from '../../geo/LatLngBounds.js' */
16060
15998
  /** @import {PolygonOptions} from './Polygon.js' */
16061
15999
  /**
@@ -16102,8 +16040,7 @@ var Rectangle = class Rectangle extends Polygon {
16102
16040
  ];
16103
16041
  }
16104
16042
  };
16105
- //#endregion
16106
- //#region src/map/Hash.js
16043
+ // src/map/Hash.js
16107
16044
  /** @import {MaplairMap} from './Map.js' */
16108
16045
  /** @import {Layer} from '../layer/Layer.js' */
16109
16046
  const leadingHashRe = /^#/;
@@ -16335,8 +16272,7 @@ var Hash = class Hash {
16335
16272
  ].filter(Boolean).join("&")}`;
16336
16273
  }
16337
16274
  };
16338
- //#endregion
16339
- //#region src/map/MapSync.js
16275
+ // src/map/MapSync.js
16340
16276
  /** @import {MaplairMap} from './Map.js' */
16341
16277
  /**
16342
16278
  * Options of `MapSync`.
@@ -16500,8 +16436,7 @@ var MapSync = class {
16500
16436
  }
16501
16437
  }
16502
16438
  };
16503
- //#endregion
16504
- //#region src/map/handler/DisplaceHandler.js
16439
+ // src/map/handler/DisplaceHandler.js
16505
16440
  /** @import {MaplairMap} from '../Map.js' */
16506
16441
  /** @import {Layer} from '../../layer/Layer.js' */
16507
16442
  /** @import {LayerEvent} from '../../core/Events.js' */
@@ -16840,81 +16775,13 @@ function displace(points, minSeparation, { iterations = DisplaceHandler.defaultO
16840
16775
  }
16841
16776
  return points;
16842
16777
  }
16843
- //#endregion
16844
- //#region src/Maplair.js
16778
+ // src/Maplair.js
16845
16779
  /**
16846
16780
  * A constant that represents the Maplair version in use.
16847
16781
  * @type {string}
16848
16782
  */
16849
16783
  const version = version$1;
16850
- //#endregion
16851
- //#region src/layer/marker/Marker.Rotation.js
16852
- const { _setPos: setPos } = Marker.prototype, { _onDrag: onDrag } = MarkerDrag.prototype;
16853
- /**
16854
- * Options of `Marker` for the rotation of marker icons, see the
16855
- * [marker rotation](#marker-setrotationangle).
16856
- * @typedef {object} MarkerRotationOptions
16857
- * @lends MarkerOptions
16858
- * @property {number} [rotationAngle=0] Rotation of the icon in degrees, clockwise, e.g.
16859
- * for the heading of a vehicle. On a rotated map, the angle is relative to the screen,
16860
- * or to north with `rotateWithView`. The shadow is not rotated.
16861
- * @property {string} [rotationOrigin] The CSS
16862
- * [`transform-origin`](https://developer.mozilla.org/docs/Web/CSS/transform-origin) to
16863
- * rotate the icon around, e.g. `'center'`. By default the anchor of the icon.
16864
- * @property {boolean} [rotateWithView=false] On a rotated map (see
16865
- * `MaplairMap.setBearing()`), whether the icon rotates with the map (e.g. for arrows
16866
- * pointing in a geographic direction) instead of staying upright.
16867
- */
16868
- Marker.include({ options: {
16869
- rotationAngle: 0,
16870
- rotationOrigin: void 0,
16871
- rotateWithView: false
16872
- } });
16873
- /** @typedef {typeof markerRotationMethods} MarkerRotationMethods */
16874
- Marker.include({
16875
- /**
16876
- * Changes the [`rotationAngle`](#markeroptions-rotationangle) of the icon.
16877
- * @group Marker rotation
16878
- * @param {number} angle
16879
- * @returns {this}
16880
- */
16881
- setRotationAngle(angle) {
16882
- this.options.rotationAngle = angle;
16883
- return this.update();
16884
- },
16885
- /**
16886
- * Changes the [`rotationOrigin`](#markeroptions-rotationorigin) of the icon.
16887
- * @group Marker rotation
16888
- * @param {string} origin
16889
- * @returns {this}
16890
- */
16891
- setRotationOrigin(origin) {
16892
- this.options.rotationOrigin = origin;
16893
- return this.update();
16894
- },
16895
- _setPos(pos) {
16896
- setPos.call(this, pos);
16897
- this._rotateIcon();
16898
- },
16899
- _rotateIcon() {
16900
- const bearing = this.options.rotateWithView ? 0 : this._map?.getBearing?.() ?? 0;
16901
- this._rotateElement(this._icon, bearing + (this.options.rotationAngle || 0), this.options.rotationOrigin);
16902
- this._rotateElement(this._shadow, bearing);
16903
- },
16904
- _rotateElement(el, angle, origin) {
16905
- if (!el) return;
16906
- if (angle % 360) {
16907
- el.style.transform += ` rotate(${angle}deg)`;
16908
- el.style.transformOrigin = origin ?? `${-parseFloat(el.style.marginLeft) || 0}px ${-parseFloat(el.style.marginTop) || 0}px`;
16909
- } else if (el.style.transformOrigin) el.style.transformOrigin = "";
16910
- }
16911
- });
16912
- MarkerDrag.include({ _onDrag(e) {
16913
- onDrag.call(this, e);
16914
- this._marker._rotateIcon();
16915
- } });
16916
- //#endregion
16917
- //#region src/control/RotateControl.js
16784
+ // src/control/RotateControl.js
16918
16785
  /** @import {ControlOptions} from './Control.js' */
16919
16786
  /** @import {MaplairMap} from '../map/Map.js' */
16920
16787
  const compass = "<svg aria-hidden=\"true\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M8 1 11 8H5z\" fill=\"#d22\"/><path d=\"M8 15 5 8h6z\" fill=\"#999\"/></svg>";
@@ -17008,8 +16875,7 @@ var RotateControl = class RotateControl extends Control {
17008
16875
  });
17009
16876
  }
17010
16877
  };
17011
- //#endregion
17012
- //#region src/map/Map.Rotation.js
16878
+ // src/map/Map.Rotation.js
17013
16879
  function normalizeBearing(bearing) {
17014
16880
  return (Number(bearing) % 360 + 360) % 360;
17015
16881
  }
@@ -17018,7 +16884,7 @@ function rotatePoint(point, degrees) {
17018
16884
  return new Point(point.x * cos - point.y * sin, point.x * sin + point.y * cos);
17019
16885
  }
17020
16886
  const rotatedMaps = /* @__PURE__ */ new WeakMap();
17021
- const { panBy } = MaplairMap.prototype, { getEvents: getDivOverlayEvents } = DivOverlay.prototype, { _setPosition: setTooltipPosition } = Tooltip.prototype, { getEvents: getMarkerEvents } = Marker.prototype, { _onDown: onDraggableDown, _updatePosition: updateDraggablePosition } = Draggable.prototype, { _onPointerStart: onPinchStart } = PinchZoomHandler.prototype, { _onDown: onTapDragDown } = TapDragZoomHandler.prototype, { _pinchTo: pinchTo } = ScrollWheelZoomHandler.prototype;
16887
+ const { panBy } = MaplairMap.prototype, { getEvents: getDivOverlayEvents } = DivOverlay.prototype, { _setPosition: setTooltipPosition } = Tooltip.prototype, { getEvents: getMarkerEvents, _positionElements: positionMarkerElements } = Marker.prototype, { _onDown: onDraggableDown, _updatePosition: updateDraggablePosition } = Draggable.prototype, { _onPointerStart: onPinchStart } = PinchZoomHandler.prototype, { _onDown: onTapDragDown } = TapDragZoomHandler.prototype, { _pinchTo: pinchTo } = ScrollWheelZoomHandler.prototype;
17022
16888
  /**
17023
16889
  * Map options of the map rotation (`maplair/map-rotation`).
17024
16890
  * @typedef {object} RotationMapOptions
@@ -17264,7 +17130,7 @@ DivOverlay.include({
17264
17130
  },
17265
17131
  _updatePosition() {
17266
17132
  if (!this._map) return;
17267
- const map = this._map, pos = map.latLngToLayerPoint(this._latlng), anchor = map._rotateToPane(new Point(this._getAnchor()));
17133
+ const map = this._map, pos = map.latLngToLayerPoint(this._latlng)._round(), anchor = map._rotateToPane(new Point(this._getAnchor()));
17268
17134
  let offset = Point.from(this.options.offset);
17269
17135
  const transformed = this._zoomAnimated || this.options.overflow || map._bearing;
17270
17136
  if (!transformed) offset = offset.add(pos).add(anchor);
@@ -17332,19 +17198,36 @@ Tooltip.include({ _setPosition(pos) {
17332
17198
  container.style.top = `${delta.y}px`;
17333
17199
  this._setContainerPosition(pos, `${-delta.x - margin[0]}px ${-delta.y - margin[1]}px`);
17334
17200
  } });
17335
- /** @typedef {typeof markerRotationMethods} MarkerMapRotationMethods */
17336
- Marker.include({
17337
17201
  /**
17338
- * Overrides `getEvents()` of `Marker` to update the marker on rotation.
17339
- * @internal
17340
- * @returns {Record<string, Function>}
17202
+ * Options of `Marker` for the map rotation.
17203
+ * @typedef {object} MarkerMapRotationOptions
17204
+ * @lends MarkerOptions
17205
+ * @property {boolean} [rotateWithView=false] On a rotated map (see
17206
+ * `MaplairMap.setBearing()`), whether the icon rotates with the map (e.g. for arrows
17207
+ * pointing in a geographic direction) instead of staying upright. The `rotation` of
17208
+ * the marker is relative to the screen, or to north with `rotateWithView`.
17341
17209
  */
17342
- getEvents() {
17343
- return {
17344
- ...getMarkerEvents.call(this),
17345
- rotate: this.update
17346
- };
17347
- } });
17210
+ Marker.include({ options: { rotateWithView: false } });
17211
+ /** @typedef {typeof markerRotationMethods} MarkerMapRotationMethods */
17212
+ Marker.include({
17213
+ /**
17214
+ * Overrides `getEvents()` of `Marker` to update the marker on rotation.
17215
+ * @internal
17216
+ * @returns {Record<string, Function>}
17217
+ */
17218
+ getEvents() {
17219
+ return {
17220
+ ...getMarkerEvents.call(this),
17221
+ rotate: this.update
17222
+ };
17223
+ },
17224
+ _positionElements(pos) {
17225
+ positionMarkerElements.call(this, pos);
17226
+ const bearing = this.options.rotateWithView ? 0 : this._map?.getBearing() ?? 0;
17227
+ if (!bearing) return;
17228
+ for (const el of [this._icon, this._shadow]) if (el) el.style.transform += ` rotate(${bearing}deg)`;
17229
+ }
17230
+ });
17348
17231
  /** @typedef {typeof markerDragRotationMethods} MarkerDragMapRotationMethods */
17349
17232
  MarkerDrag.include({ _adjustPan(e) {
17350
17233
  const marker = this._marker, map = marker._map, speed = this._marker.options.autoPanSpeed, padding = this._marker.options.autoPanPadding, iconPos = getPosition(marker._icon), bounds = map.getPixelBounds(), origin = map.getPixelOrigin();
@@ -17489,8 +17372,7 @@ ScrollWheelZoomHandler.include({
17489
17372
  this._panTimer = setTimeout(this._endPan.bind(this), gestureEndDelay);
17490
17373
  }
17491
17374
  });
17492
- //#endregion
17493
- //#region src/layer/marker/Marker.Move.js
17375
+ // src/layer/marker/Marker.Move.js
17494
17376
  /** @import {LatLngExpression} from '../../geo/LatLng.js' */
17495
17377
  /** @import {MaplairMap} from '../../map/Map.js' */
17496
17378
  /** @import {MaplairEvent} from '../../core/Events.js' */
@@ -17500,9 +17382,8 @@ ScrollWheelZoomHandler.include({
17500
17382
  * @property {number} [duration=1000] The duration of the movement in milliseconds.
17501
17383
  * @property {number} [speed] The speed in meters (or units of the CRS) per second
17502
17384
  * instead of the `duration`.
17503
- * @property {boolean} [rotate=false] Whether to set the `rotationAngle` of the icon to
17504
- * the heading of the movement (for icons pointing up; needs the marker rotation, see
17505
- * `rotationAngle`).
17385
+ * @property {boolean} [rotate=false] Whether to set the `rotation` of the marker to
17386
+ * the heading of the movement (for icons pointing up).
17506
17387
  */
17507
17388
  const { onRemove } = Marker.prototype;
17508
17389
  /** @typedef {typeof markerMoveMethods} MarkerMoveMethods */
@@ -17541,7 +17422,7 @@ Marker.include({
17541
17422
  i++;
17542
17423
  }
17543
17424
  const from = points[i], to = points[i + 1];
17544
- if (options.rotate && !from.equals(to)) this.options.rotationAngle = this._heading(from, to);
17425
+ if (options.rotate && !from.equals(to)) this.options.rotation = this._heading(from, to);
17545
17426
  this.setLatLng(this._interpolate(from, to, lengths[i] ? Math.min(1, distance / lengths[i]) : 1));
17546
17427
  if (moved < total) this._moveFrame = requestAnimationFrame(frame);
17547
17428
  else {
@@ -17590,8 +17471,7 @@ Marker.include({
17590
17471
  return onRemove.call(this, map);
17591
17472
  }
17592
17473
  });
17593
- //#endregion
17594
- //#region src/layer/vector/Path.DashAnimation.js
17474
+ // src/layer/vector/Path.DashAnimation.js
17595
17475
  const DASH_SEPARATOR_RE = /[ ,]+/;
17596
17476
  const { _updateStyle: updateSvgStyle$1 } = SVG.prototype, { _fillStroke: fillStroke, _destroyContainer: destroyCanvasContainer } = Canvas.prototype;
17597
17477
  /**
@@ -17661,8 +17541,7 @@ Canvas.include({
17661
17541
  return performance.now() / 1e3 * speed % length;
17662
17542
  }
17663
17543
  });
17664
- //#endregion
17665
- //#region src/layer/vector/Polyline.Decorations.js
17544
+ // src/layer/vector/Polyline.Decorations.js
17666
17545
  /**
17667
17546
  * Options of `Path` for arrowheads and text along lines (for `Polyline`s and
17668
17547
  * `Polygon`s). They are an optional feature: import this module to add the
@@ -17897,8 +17776,7 @@ Canvas.include({
17897
17776
  }
17898
17777
  }
17899
17778
  });
17900
- //#endregion
17901
- //#region src/layer/GeoJSON.Load.js
17779
+ // src/layer/GeoJSON.Load.js
17902
17780
  /** @import {GeoJsonObject} from 'geojson' */
17903
17781
  /** @import {MaplairEvent} from '../core/Events.js' */
17904
17782
  /**
@@ -17955,8 +17833,7 @@ load(source, fetchOptions = this.options.fetchOptions) {
17955
17833
  GeoJSON.addInitHook(function() {
17956
17834
  if (this.options.url) this.load(this.options.url).catch(() => {});
17957
17835
  });
17958
- //#endregion
17959
- //#region src/layer/vector/Path.ZoomStyles.js
17836
+ // src/layer/vector/Path.ZoomStyles.js
17960
17837
  /**
17961
17838
  * A zoom-dependent style value, of the `weight` option of paths and the `radius` of
17962
17839
  * circle markers: either a function of the zoom or an object of zoom stops
@@ -18028,7 +17905,6 @@ CircleMarker.include({ setRadius(radius) {
18028
17905
  Path.addInitHook(function() {
18029
17906
  this._takeZoomStyles(this.options);
18030
17907
  });
18031
- //#endregion
18032
- export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler, ButtonBarControl, ButtonControl, CRS, Canvas, Circle, CircleMarker, Class, Classification, ContextMenu, Control, DefaultIcon, DisplaceHandler, DivIcon, DivOverlay, DomEvent_exports as DomEvent, DomUtil_exports as DomUtil, DoubleClickZoomHandler, DragHandler, Draggable, EPSG3395, EPSG3857, EPSG4326, EPSG900913, EarthCRS, Evented, FeatureGroup, FullscreenControl, GeoJSON, GridLayer, Handler, Hash, HeatLayer, I18n, Icon, ImageOverlay, KeyboardHandler, LatLng, LatLngBounds, Layer, LayerGroup, LayersControl, MaplairMap as LeafletMap, MaplairMap as Map, MaplairMap, LegendControl, LineUtil_exports as LineUtil, MapSync, Marker, MarkerClusterGroup, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, projection_exports as Projection, Rectangle, Renderer, RotateControl, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, TimeControl, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
17908
+ export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler, ButtonBarControl, ButtonControl, CRS, Canvas, Circle, CircleMarker, Class, Classification, ContextMenu, Control, DefaultIcon, DisplaceHandler, DivIcon, DivOverlay, DomEvent_exports as DomEvent, DomUtil_exports as DomUtil, DoubleClickZoomHandler, DragHandler, Draggable, EPSG3395, EPSG3857, EPSG4326, EPSG900913, EarthCRS, Evented, FeatureGroup, FullscreenControl, GeoJSON, GridLayer, Handler, Hash, HeatLayer, I18n, Icon, ImageOverlay, KeyboardHandler, LatLng, LatLngBounds, Layer, LayerGroup, LayersControl, MaplairMap as LeafletMap, MaplairMap as Map, MaplairMap, LegendControl, LineUtil_exports as LineUtil, LonLatProjection, MapSync, Marker, MarkerClusterGroup, MercatorProjection, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, Rectangle, Renderer, RotateControl, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SphericalMercatorProjection, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, TimeControl, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
18033
17909
 
18034
17910
  //# sourceMappingURL=maplair-src.js.map