maplair 4.0.0 → 4.2.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.
- package/CHANGELOG.md +178 -0
- package/dist/esm/Maplair.js +18 -17
- package/dist/esm/Maplair.js.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.js +1 -2
- package/dist/esm/control/AttributionControl.js +25 -16
- package/dist/esm/control/AttributionControl.js.map +1 -1
- package/dist/esm/control/ButtonControl.js +10 -13
- package/dist/esm/control/ButtonControl.js.map +1 -1
- package/dist/esm/control/ContextMenu.js +2 -5
- package/dist/esm/control/ContextMenu.js.map +1 -1
- package/dist/esm/control/Control.js +10 -18
- package/dist/esm/control/Control.js.map +1 -1
- package/dist/esm/control/FullscreenControl.js +6 -9
- package/dist/esm/control/FullscreenControl.js.map +1 -1
- package/dist/esm/control/LayersControl.js +170 -65
- package/dist/esm/control/LayersControl.js.map +1 -1
- package/dist/esm/control/LegendControl.js +8 -11
- package/dist/esm/control/LegendControl.js.map +1 -1
- package/dist/esm/control/MiniMapControl.js +15 -18
- package/dist/esm/control/MiniMapControl.js.map +1 -1
- package/dist/esm/control/RotateControl.js +2 -5
- package/dist/esm/control/RotateControl.js.map +1 -1
- package/dist/esm/control/ScaleControl.js +8 -11
- package/dist/esm/control/ScaleControl.js.map +1 -1
- package/dist/esm/control/SearchControl.js +100 -19
- package/dist/esm/control/SearchControl.js.map +1 -1
- package/dist/esm/control/SideBySideControl.js +2 -5
- package/dist/esm/control/SideBySideControl.js.map +1 -1
- package/dist/esm/control/TextControl.js +6 -9
- package/dist/esm/control/TextControl.js.map +1 -1
- package/dist/esm/control/TimeControl.js +407 -0
- package/dist/esm/control/TimeControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +23 -36
- package/dist/esm/control/ZoomControl.js.map +1 -1
- package/dist/esm/core/Class.js +28 -44
- package/dist/esm/core/Class.js.map +1 -1
- package/dist/esm/core/Events.js +22 -10
- package/dist/esm/core/Events.js.map +1 -1
- package/dist/esm/core/Handler.js +23 -14
- package/dist/esm/core/Handler.js.map +1 -1
- package/dist/esm/core/I18n.js +1 -2
- package/dist/esm/core/Util.js +15 -4
- package/dist/esm/core/Util.js.map +1 -1
- package/dist/esm/dom/DomEvent.DoubleTap.js +26 -24
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
- package/dist/esm/dom/DomEvent.PointerEvents.js +3 -18
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
- package/dist/esm/dom/DomEvent.js +18 -60
- package/dist/esm/dom/DomEvent.js.map +1 -1
- package/dist/esm/dom/DomUtil.js +15 -70
- package/dist/esm/dom/DomUtil.js.map +1 -1
- package/dist/esm/dom/Draggable.js +21 -21
- package/dist/esm/dom/Draggable.js.map +1 -1
- package/dist/esm/dom/PosAnimation.js +4 -27
- package/dist/esm/dom/PosAnimation.js.map +1 -1
- package/dist/esm/geo/LatLng.js +16 -7
- package/dist/esm/geo/LatLng.js.map +1 -1
- package/dist/esm/geo/LatLngBounds.js +9 -15
- package/dist/esm/geo/LatLngBounds.js.map +1 -1
- package/dist/esm/geo/crs/CRS.js +1 -2
- package/dist/esm/geo/crs/EPSG3395.js +5 -6
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
- package/dist/esm/geo/crs/EPSG3857.js +5 -6
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
- package/dist/esm/geo/crs/EPSG4326.js +4 -5
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
- package/dist/esm/geo/crs/EarthCRS.js +3 -4
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
- package/dist/esm/geo/crs/SimpleCRS.js +4 -5
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
- package/dist/esm/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +5 -6
- package/dist/esm/geo/projection/LonLatProjection.js.map +1 -0
- package/dist/esm/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +4 -5
- package/dist/esm/geo/projection/MercatorProjection.js.map +1 -0
- package/dist/esm/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +5 -6
- package/dist/esm/geo/projection/SphericalMercatorProjection.js.map +1 -0
- package/dist/esm/geometry/Bounds.js +10 -14
- package/dist/esm/geometry/Bounds.js.map +1 -1
- package/dist/esm/geometry/LineUtil.js +37 -32
- package/dist/esm/geometry/LineUtil.js.map +1 -1
- package/dist/esm/geometry/Point.js +1 -2
- package/dist/esm/geometry/PolyUtil.js +24 -51
- package/dist/esm/geometry/PolyUtil.js.map +1 -1
- package/dist/esm/geometry/Transformation.js +1 -2
- package/dist/esm/layer/BlanketOverlay.js +7 -10
- package/dist/esm/layer/BlanketOverlay.js.map +1 -1
- package/dist/esm/layer/Classification.js +1 -2
- package/dist/esm/layer/DivOverlay.js +16 -22
- package/dist/esm/layer/DivOverlay.js.map +1 -1
- package/dist/esm/layer/FeatureGroup.js +5 -4
- package/dist/esm/layer/FeatureGroup.js.map +1 -1
- package/dist/esm/layer/GeoJSON.Load.js +1 -2
- package/dist/esm/layer/GeoJSON.js +17 -155
- package/dist/esm/layer/GeoJSON.js.map +1 -1
- package/dist/esm/layer/GeoJSONUtil.js +74 -0
- package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
- package/dist/esm/layer/HeatLayer.js +17 -20
- package/dist/esm/layer/HeatLayer.js.map +1 -1
- package/dist/esm/layer/ImageOverlay.js +22 -29
- package/dist/esm/layer/ImageOverlay.js.map +1 -1
- package/dist/esm/layer/Layer.js +9 -12
- package/dist/esm/layer/Layer.js.map +1 -1
- package/dist/esm/layer/LayerGroup.js +53 -3
- package/dist/esm/layer/LayerGroup.js.map +1 -1
- package/dist/esm/layer/Popup.js +35 -58
- package/dist/esm/layer/Popup.js.map +1 -1
- package/dist/esm/layer/SVGOverlay.js +3 -7
- package/dist/esm/layer/SVGOverlay.js.map +1 -1
- package/dist/esm/layer/Tooltip.js +31 -34
- package/dist/esm/layer/Tooltip.js.map +1 -1
- package/dist/esm/layer/VideoOverlay.js +13 -17
- package/dist/esm/layer/VideoOverlay.js.map +1 -1
- package/dist/esm/layer/marker/DefaultIcon.js +38 -49
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
- package/dist/esm/layer/marker/DivIcon.js +8 -11
- package/dist/esm/layer/marker/DivIcon.js.map +1 -1
- package/dist/esm/layer/marker/Icon.js +9 -12
- package/dist/esm/layer/marker/Icon.js.map +1 -1
- package/dist/esm/layer/marker/Marker.Drag.js +44 -5
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
- package/dist/esm/layer/marker/Marker.Move.js +5 -8
- package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
- package/dist/esm/layer/marker/Marker.js +115 -47
- package/dist/esm/layer/marker/Marker.js.map +1 -1
- package/dist/esm/layer/marker/MarkerClusterGroup.js +301 -0
- package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
- package/dist/esm/layer/marker/SvgIcon.js +7 -10
- package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
- package/dist/esm/layer/tile/GridLayer.js +89 -101
- package/dist/esm/layer/tile/GridLayer.js.map +1 -1
- package/dist/esm/layer/tile/TileLayer.js +36 -44
- package/dist/esm/layer/tile/TileLayer.js.map +1 -1
- package/dist/esm/layer/tile/WMSTileLayer.js +33 -27
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
- package/dist/esm/layer/vector/Canvas.js +8 -17
- package/dist/esm/layer/vector/Canvas.js.map +1 -1
- package/dist/esm/layer/vector/Circle.js +6 -5
- package/dist/esm/layer/vector/Circle.js.map +1 -1
- package/dist/esm/layer/vector/CircleMarker.js +19 -10
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
- package/dist/esm/layer/vector/Path.DashAnimation.js +3 -5
- package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
- package/dist/esm/layer/vector/Path.ZoomStyles.js +1 -2
- package/dist/esm/layer/vector/Path.js +28 -22
- package/dist/esm/layer/vector/Path.js.map +1 -1
- package/dist/esm/layer/vector/Polygon.js +22 -7
- package/dist/esm/layer/vector/Polygon.js.map +1 -1
- package/dist/esm/layer/vector/Polyline.Decorations.js +3 -4
- package/dist/esm/layer/vector/Polyline.js +25 -10
- package/dist/esm/layer/vector/Polyline.js.map +1 -1
- package/dist/esm/layer/vector/Rectangle.js +1 -2
- package/dist/esm/layer/vector/Renderer.getRenderer.js +17 -17
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
- package/dist/esm/layer/vector/Renderer.js +1 -2
- package/dist/esm/layer/vector/SVG.js +12 -9
- package/dist/esm/layer/vector/SVG.js.map +1 -1
- package/dist/esm/map/Hash.js +1 -2
- package/dist/esm/map/Map.Rotation.js +41 -22
- package/dist/esm/map/Map.Rotation.js.map +1 -1
- package/dist/esm/map/Map.js +125 -126
- package/dist/esm/map/Map.js.map +1 -1
- package/dist/esm/map/MapSync.js +1 -2
- package/dist/esm/map/handler/BoxZoomHandler.js +25 -47
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/DisplaceHandler.js +7 -10
- package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
- package/dist/esm/map/handler/DoubleClickZoomHandler.js +1 -2
- package/dist/esm/map/handler/DragHandler.js +20 -21
- package/dist/esm/map/handler/DragHandler.js.map +1 -1
- package/dist/esm/map/handler/KeyboardHandler.js +48 -68
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
- package/dist/esm/map/handler/PinchZoomHandler.js +13 -5
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +4 -6
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/TapDragZoomHandler.js +1 -2
- package/dist/esm/map/handler/TapHoldHandler.js +13 -7
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
- package/dist/esm/package.js +2 -3
- package/dist/maplair-global-src.js +6495 -5981
- package/dist/maplair-global-src.js.map +1 -1
- package/dist/maplair-global.js +2 -2
- package/dist/maplair-global.js.map +1 -1
- package/dist/maplair-src.js +6206 -5673
- package/dist/maplair-src.js.map +1 -1
- package/dist/maplair.css +1 -1213
- package/dist/maplair.js +2 -2
- package/dist/maplair.js.map +1 -1
- package/i18n/cs.json +6 -0
- package/i18n/de.json +6 -0
- package/i18n/en.json +6 -0
- package/i18n/es.json +6 -0
- package/i18n/fr.json +6 -0
- package/i18n/hu.json +6 -0
- package/i18n/it.json +6 -0
- package/i18n/rm.json +6 -0
- package/i18n/sk.json +6 -0
- package/i18n/sl.json +6 -0
- package/package.json +11 -18
- package/src/Maplair.all.js +0 -1
- package/src/control/AttributionControl.js +25 -18
- package/src/control/ButtonControl.js +9 -11
- package/src/control/ContextMenu.js +3 -5
- package/src/control/Control.js +9 -19
- package/src/control/FullscreenControl.js +5 -7
- package/src/control/LayersControl.js +196 -86
- package/src/control/LegendControl.js +7 -9
- package/src/control/MiniMapControl.js +9 -11
- package/src/control/RotateControl.js +3 -5
- package/src/control/ScaleControl.js +7 -9
- package/src/control/SearchControl.js +102 -19
- package/src/control/SideBySideControl.js +3 -5
- package/src/control/TextControl.js +5 -7
- package/src/control/TimeControl.js +471 -0
- package/src/control/ZoomControl.js +22 -38
- package/src/control/index.js +1 -0
- package/src/core/Class.js +37 -45
- package/src/core/Events.js +22 -3
- package/src/core/Handler.js +25 -13
- package/src/core/Util.js +20 -2
- package/src/core/index.js +0 -1
- package/src/dom/DomEvent.DoubleTap.js +18 -10
- package/src/dom/DomEvent.PointerEvents.js +3 -26
- package/src/dom/DomEvent.js +17 -85
- package/src/dom/DomUtil.js +22 -78
- package/src/dom/Draggable.js +32 -23
- package/src/dom/PosAnimation.js +3 -25
- package/src/dom/index.js +0 -1
- package/src/geo/LatLng.js +20 -3
- package/src/geo/LatLngBounds.js +8 -15
- package/src/geo/crs/EPSG3395.js +4 -4
- package/src/geo/crs/EPSG3857.js +4 -4
- package/src/geo/crs/EPSG4326.js +3 -3
- package/src/geo/crs/EarthCRS.js +2 -8
- package/src/geo/crs/SimpleCRS.js +3 -3
- package/src/geo/index.js +1 -2
- package/src/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +2 -2
- package/src/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +2 -2
- package/src/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +2 -2
- package/src/geo/projection/index.js +5 -5
- package/src/geometry/Bounds.js +12 -17
- package/src/geometry/LineUtil.js +48 -49
- package/src/geometry/PolyUtil.js +39 -76
- package/src/layer/BlanketOverlay.js +6 -10
- package/src/layer/DivOverlay.js +16 -27
- package/src/layer/FeatureGroup.js +8 -2
- package/src/layer/GeoJSON.js +17 -218
- package/src/layer/GeoJSONUtil.js +85 -0
- package/src/layer/HeatLayer.js +10 -12
- package/src/layer/ImageOverlay.js +21 -32
- package/src/layer/Layer.js +8 -10
- package/src/layer/LayerGroup.js +72 -1
- package/src/layer/Popup.js +37 -62
- package/src/layer/SVGOverlay.js +1 -5
- package/src/layer/Tooltip.js +34 -36
- package/src/layer/VideoOverlay.js +12 -15
- package/src/layer/marker/DefaultIcon.js +40 -58
- package/src/layer/marker/DivIcon.js +9 -11
- package/src/layer/marker/Icon.js +9 -10
- package/src/layer/marker/Marker.Drag.js +54 -6
- package/src/layer/marker/Marker.Move.js +4 -6
- package/src/layer/marker/Marker.js +145 -52
- package/src/layer/marker/MarkerClusterGroup.js +370 -0
- package/src/layer/marker/SvgIcon.js +7 -9
- package/src/layer/marker/index.js +1 -0
- package/src/layer/tile/GridLayer.js +108 -135
- package/src/layer/tile/TileLayer.js +44 -49
- package/src/layer/tile/WMSTileLayer.js +31 -26
- package/src/layer/vector/Canvas.js +13 -19
- package/src/layer/vector/Circle.js +9 -3
- package/src/layer/vector/CircleMarker.js +19 -7
- package/src/layer/vector/Path.DashAnimation.js +1 -2
- package/src/layer/vector/Path.js +30 -21
- package/src/layer/vector/Polygon.js +29 -6
- package/src/layer/vector/Polyline.js +26 -7
- package/src/layer/vector/Renderer.getRenderer.js +20 -19
- package/src/layer/vector/SVG.js +17 -7
- package/src/map/Map.Rotation.js +40 -8
- package/src/map/Map.js +158 -153
- package/src/map/handler/BoxZoomHandler.js +30 -50
- package/src/map/handler/DisplaceHandler.js +6 -8
- package/src/map/handler/DragHandler.js +25 -28
- package/src/map/handler/KeyboardHandler.js +65 -90
- package/src/map/handler/PinchZoomHandler.js +16 -5
- package/src/map/handler/ScrollWheelZoomHandler.js +6 -4
- package/src/map/handler/TapHoldHandler.js +15 -4
- package/src/map/index.js +1 -1
- package/src/maplair.css +153 -98
- package/dist/esm/core/Browser.js +0 -100
- package/dist/esm/core/Browser.js.map +0 -1
- package/dist/esm/geo/projection/Projection.LonLat.js.map +0 -1
- package/dist/esm/geo/projection/Projection.Mercator.js.map +0 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +0 -1
- package/dist/esm/geo/projection/index.js +0 -14
- package/dist/esm/geo/projection/index.js.map +0 -1
- package/dist/esm/layer/marker/Marker.Rotation.js +0 -70
- package/dist/esm/layer/marker/Marker.Rotation.js.map +0 -1
- package/dist/images/layers.svg +0 -1
- package/dist/images/marker-icon.svg +0 -1
- package/dist/images/marker-shadow.svg +0 -1
- package/src/core/Browser.js +0 -110
- package/src/images/layers.svg +0 -1
- package/src/images/marker-icon.svg +0 -1
- package/src/images/marker-shadow.svg +0 -1
- package/src/layer/marker/Marker.Rotation.js +0 -103
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,184 @@ Maplair Changelog
|
|
|
3
3
|
|
|
4
4
|
(all changes of Leaflet without author notice are by [@mourner](https://github.com/mourner))
|
|
5
5
|
|
|
6
|
+
## 4.2.0 (2026-10-31)
|
|
7
|
+
|
|
8
|
+
⚠️ Despite the minor version, this release contains breaking changes ported from Leaflet, see the refactorings below; e.g. the optional module `maplair/marker-rotation` is replaced by the Marker option `rotation`.
|
|
9
|
+
|
|
10
|
+
### Leaflet, since 4.1.0
|
|
11
|
+
|
|
12
|
+
Ported from Leaflet (changes without author notice are by [@mourner](https://github.com/mourner))
|
|
13
|
+
|
|
14
|
+
#### ❇️ New Features
|
|
15
|
+
|
|
16
|
+
* DefaultIcon: the option `color` paints the (maple leaf) pin in any CSS color in https://github.com/Leaflet/Leaflet/pull/10489
|
|
17
|
+
* Move focused draggable markers with the arrow keys, by 10 pixels or 30 with Shift, by [@Enfiladeguide](https://github.com/Enfiladeguide) in https://github.com/Leaflet/Leaflet/pull/10513
|
|
18
|
+
|
|
19
|
+
#### ✨ Refactorings (⚠️ Breaking Changes)
|
|
20
|
+
|
|
21
|
+
* Replace the `Projection` namespace with `LonLatProjection`, `MercatorProjection` and `SphericalMercatorProjection` in https://github.com/Leaflet/Leaflet/commit/98dd20eef949b238c7cef74fba5716a18b912fa9
|
|
22
|
+
* `DomEvent` functions no longer return the module for chaining in https://github.com/Leaflet/Leaflet/commit/6806a7b39e730a30fc46f20734f463cf848d68aa
|
|
23
|
+
* GeoJSON passes the feature (not a bare geometry) to `filter` and `onEachFeature`; LayersControl `collapse()` takes no event; Handler has empty default `addHooks()` and `removeHooks()` in https://github.com/Leaflet/Leaflet/commit/1dc1b4ea0ffd779e15f8a5aeeb27dd15e597cd1f and https://github.com/Leaflet/Leaflet/commit/f9b31ae1e89c5f80bfecc862753873b5b72736eb
|
|
24
|
+
|
|
25
|
+
* Marker: the option `rotation` (in degrees, `null` for none) with `setRotation()` and `getRotation()` rotates the icon around its anchor, rotates the popup and tooltip anchors and hides the shadow; it replaces the optional module `maplair/marker-rotation` with `rotationAngle`, `rotationOrigin`, `setRotationAngle()` and `setRotationOrigin()`, `rotateWithView` is part of `maplair/map-rotation`, in https://github.com/Leaflet/Leaflet/pull/10489
|
|
26
|
+
* `latLngToLayerPoint()` and `latLngToContainerPoint()` keep subpixel precision instead of rounding, so polylines and polygons don't zigzag along whole pixels, in https://github.com/Leaflet/Leaflet/pull/10494
|
|
27
|
+
* Various small cleanups, e.g. KeyboardHandler reads `keyboardPanDelta` and `zoomDelta` on each key, Canvas draws ellipses with `ellipse()`, in https://github.com/Leaflet/Leaflet/pull/10490
|
|
28
|
+
* Only stop the propagation of clicks opening a popup in https://github.com/Leaflet/Leaflet/commit/{prop}
|
|
29
|
+
|
|
30
|
+
#### 🐞 Bugfixes
|
|
31
|
+
|
|
32
|
+
* Fix Popup `maxHeight` not scrolling or resizing with the content by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10487
|
|
33
|
+
* Fix invalid WMSTileLayer URLs after changing the WMS version by [@osiandhammaloka](https://github.com/osiandhammaloka) in https://github.com/Leaflet/Leaflet/pull/10482
|
|
34
|
+
* Fix focusing a marker whose icon has an `'auto'` size by [@A350xt](https://github.com/A350xt) in https://github.com/Leaflet/Leaflet/pull/10375, and auto-sized marker icons stretching to the full map width in https://github.com/Leaflet/Leaflet/commit/779c7fd5492d36b7738e8bd2b8cdac804754c41d
|
|
35
|
+
* Respect layers added or removed by LayersControl event handlers by [@A350xt](https://github.com/A350xt) in https://github.com/Leaflet/Leaflet/pull/10374
|
|
36
|
+
* Fix Circle `getBounds()` throwing when not added to a map (with [@Schleuse](https://github.com/Schleuse)) in https://github.com/Leaflet/Leaflet/commit/4c7958990cfe586dfc05eede518694b81fe9f32c
|
|
37
|
+
* Fix FeatureGroup `getBounds()` throwing for layers without a position, include nested layer groups (with [@rafaelgallani](https://github.com/rafaelgallani)) in https://github.com/Leaflet/Leaflet/commit/ee37d374222822139af43580906a966186bccebf
|
|
38
|
+
* Fix an error when removing the map or a GridLayer on tile load (with [@pierreeurope](https://github.com/pierreeurope)) in https://github.com/Leaflet/Leaflet/commit/62c5f52791c5055ef4c94e508525b554ab158d15
|
|
39
|
+
* Fix an error with empty `subdomains` in https://github.com/Leaflet/Leaflet/commit/{sub}
|
|
40
|
+
* Switch the tooltip handlers when rebinding a tooltip with different options, open it on focus after the layer is added again, don't fire `tileerror` for tiles pruned with `errorTileUrl` in https://github.com/Leaflet/Leaflet/pull/10490
|
|
41
|
+
* Fix the map drifting under the cursor on zoom in https://github.com/Leaflet/Leaflet/commit/{drift}
|
|
42
|
+
* Close popups on Escape more reliably, e.g. with the focus on a marker in https://github.com/Leaflet/Leaflet/commit/{esc}
|
|
43
|
+
* Isolate the stacking context of the map container in https://github.com/Leaflet/Leaflet/commit/{iso}
|
|
44
|
+
* Accept marker icons without `createShadow()` in https://github.com/Leaflet/Leaflet/pull/10489
|
|
45
|
+
* Make Draggable work outside a map in https://github.com/Leaflet/Leaflet/commit/2e770eb84bafca2368eef611922497cd0b3a81de
|
|
46
|
+
* LayersControl stops listening to map clicks when removed, TileLayer halves a `Point` tileSize with `detectRetina`, `isLoading()` returns a boolean in https://github.com/Leaflet/Leaflet/commit/1dc1b4ea0ffd779e15f8a5aeeb27dd15e597cd1f
|
|
47
|
+
* Tolerate `getRenderer()` for layers without a renderer, e.g. of Leaflet.markercluster, in https://github.com/Leaflet/Leaflet/issues/10515
|
|
48
|
+
* LayerGroup ignores an unknown layer id in `removeLayer()`, Bounds `contains()` accepts a point literal, `LineUtil._projectRing()` handles deeper nested latlngs in https://github.com/Leaflet/Leaflet/commit/4ab4c3a966cfd04e22d330546a357cbdbd15ab09, https://github.com/Leaflet/Leaflet/commit/a54d6d7f954374df5a3486a9e26ca2a60cc01b05 and https://github.com/Leaflet/Leaflet/commit/ac22233103a4fd3351ed82f0e99a8c6b9dfdcc80
|
|
49
|
+
* Simplify and speed up polygon clipping in https://github.com/Leaflet/Leaflet/commit/2c5d1f038fb8d065b18312b2d653fc5e64ce2af0
|
|
50
|
+
|
|
51
|
+
#### 📝 Docs
|
|
52
|
+
|
|
53
|
+
* Fix doc typos and outdated links (with [@Kumar007-7](https://github.com/Kumar007-7)) in https://github.com/Leaflet/Leaflet/commit/ff2715f95cd8542eaf8706b9459620bedb3baec7
|
|
54
|
+
* Use viewport units in the mobile example by [@pierreeurope](https://github.com/pierreeurope) in https://github.com/Leaflet/Leaflet/pull/10120
|
|
55
|
+
* Fix a few stale things in the plugin guide in https://github.com/Leaflet/Leaflet/commit/{guide}
|
|
56
|
+
|
|
57
|
+
#### 🔧 Workflow
|
|
58
|
+
|
|
59
|
+
* Minify `maplair.css` with lightningcss in https://github.com/Leaflet/Leaflet/pull/10493
|
|
60
|
+
* Reduce Dependabot noise with a better config in https://github.com/Leaflet/Leaflet/commit/{dep}
|
|
61
|
+
|
|
62
|
+
#### 🧪 Tests
|
|
63
|
+
|
|
64
|
+
* Fix test flakiness on slow runners in https://github.com/Leaflet/Leaflet/commit/{flaky}
|
|
65
|
+
|
|
66
|
+
## 4.1.0 (2026-10-28)
|
|
67
|
+
|
|
68
|
+
⚠️ Despite the minor version, this release contains breaking changes ported from Leaflet, see the refactorings below.
|
|
69
|
+
|
|
70
|
+
### Maplair
|
|
71
|
+
|
|
72
|
+
(changes without author notice are by [@simon04](https://github.com/simon04))
|
|
73
|
+
|
|
74
|
+
#### ❇️ New Features
|
|
75
|
+
|
|
76
|
+
* LayersControl: add the options `inline`, `groupBy` and `toggleContent`, the methods `getLayers()` and `selectLayer()`, and `originalEvent` to `baselayerchange`, `overlayadd` and `overlayremove` for changes by the user
|
|
77
|
+
* SearchControl: new static method `SearchControl.layers()` to search the layers of a layer group (e.g. GeoJSON features) by a property or a label function, the results contain the found `layer`
|
|
78
|
+
* Add `MarkerClusterGroup` clustering nearby markers, with zooming to and spiderfying clusters on click
|
|
79
|
+
* Add `TimeControl` to step through or play the times of time-dependent layers, e.g. a WMS with a `TIME` dimension, with ISO 8601 intervals and periods
|
|
80
|
+
* WMSTileLayer: swap the tiles without flickering on `setParams()`
|
|
81
|
+
* SearchControl: the option `marker` accepts a function returning the layer to show at the selected result, new options `clearOnMapClick` and `noResultsText`
|
|
82
|
+
* Export `LeafletMap` as an alias of `MaplairMap`, like `Map`, for compatibility with code written for Leaflet 2
|
|
83
|
+
|
|
84
|
+
### Leaflet, since the fork
|
|
85
|
+
|
|
86
|
+
Ported from Leaflet (changes without author notice are by [@mourner](https://github.com/mourner))
|
|
87
|
+
|
|
88
|
+
#### ✨ Refactorings (⚠️ Breaking Changes)
|
|
89
|
+
|
|
90
|
+
* Replace static blocks with `static defaultOptions`; `setDefaultOptions()` is a deprecated alias of `mergeOptions()` in https://github.com/Leaflet/Leaflet/pull/10432
|
|
91
|
+
* Throw on classes still defining `initialize()` (from https://github.com/Leaflet/Leaflet/pull/10433)
|
|
92
|
+
* Drop the `preferCanvas` option, use `renderer: new Canvas()`; custom panes get a renderer of the same kind as the map's in https://github.com/Leaflet/Leaflet/pull/10438
|
|
93
|
+
* Move `toGeoJSON()` into each layer class, available without importing `GeoJSON` in https://github.com/Leaflet/Leaflet/pull/10439
|
|
94
|
+
* Make `PosAnimation` internal in https://github.com/Leaflet/Leaflet/pull/10446
|
|
95
|
+
* Remove browser sniffing and the `Browser` namespace (`Browser.reducedMotion` is `DomUtil.reducedMotion`), enable `tapHold` everywhere in https://github.com/Leaflet/Leaflet/pull/10447
|
|
96
|
+
* Inline the built-in SVG icons, dropping the option `imagePath` of `DefaultIcon` and the images in `dist` in https://github.com/Leaflet/Leaflet/pull/10450
|
|
97
|
+
* Remove `DomUtil.preventOutline()` and `restoreOutline()`, `Draggable` takes options as its third argument in https://github.com/Leaflet/Leaflet/pull/10455
|
|
98
|
+
* Remove dead legacy DOM event and CSS code, including `DomEvent.getPropagationPath()` and `--maplair-size-control-touch` (the touch styles are the default) in https://github.com/Leaflet/Leaflet/pull/10431
|
|
99
|
+
* Remove `DomEvent.PointerEvents.cleanupPointers()` in https://github.com/Leaflet/Leaflet/commit/cfae2c15eb66833f9260820e2d692e10f4a6c263
|
|
100
|
+
* Fix remaining side effects and import cycles in https://github.com/Leaflet/Leaflet/pull/10442
|
|
101
|
+
* Simplify some core code for a smaller bundle in https://github.com/Leaflet/Leaflet/pull/10452
|
|
102
|
+
* Simplify the center calculation of polylines and polygons in https://github.com/Leaflet/Leaflet/pull/10451
|
|
103
|
+
* Simplify `flyTo()` in https://github.com/Leaflet/Leaflet/commit/3dc172b57175994f152d6fe512b0131869ee30cb
|
|
104
|
+
* The global build has plain, patchable namespaces (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
105
|
+
* Zoom by the typed character for non-US keyboard layouts, `KeyboardHandler.keyCodes` is replaced by `KeyboardHandler.keys`, `aria-keyshortcuts` is opt-in with the new map option `ariaKeyShortcuts` (with [@babielmam](https://github.com/babielmam)) in https://github.com/Leaflet/Leaflet/pull/10469
|
|
106
|
+
* Stop restyling the whole page on map and marker drags, remove `DomUtil.disableTextSelection()` and `enableTextSelection()` in https://github.com/Leaflet/Leaflet/pull/10470
|
|
107
|
+
* Respect reduced motion through options instead of overrides, replacing `DomUtil.reducedMotion`, in https://github.com/Leaflet/Leaflet/pull/10466, and reduce rather than remove motion in https://github.com/Leaflet/Leaflet/pull/10479; the default `inertiaMaxSpeed` is 1400
|
|
108
|
+
* Improve the keyboard accessibility of markers (Enter and Space click interactive markers), remove the `keypress` event in https://github.com/Leaflet/Leaflet/pull/10473
|
|
109
|
+
* Export `Map` as an alias of `MaplairMap` more idiomatically in https://github.com/Leaflet/Leaflet/commit/4bc93b605f043cb2ff6bbe0615c03109fd0b6723
|
|
110
|
+
|
|
111
|
+
#### 🐞 Bugfixes
|
|
112
|
+
|
|
113
|
+
* Load tiles during panning unless reduced motion is preferred in https://github.com/Leaflet/Leaflet/commit/2550ebfa7513ed65e8b6febb4be8d68992b847ec
|
|
114
|
+
* Fix the http to https upgrade of OSM URLs in https://github.com/Leaflet/Leaflet/pull/10444
|
|
115
|
+
* Read the Leaflet 1 option `bubblingMouseEvents`, log removed `mouse*` events once in https://github.com/Leaflet/Leaflet/commit/2cac72a01fe1b43eb158156bf10158877a9be716
|
|
116
|
+
* Fix seams between tiles when dragging the map in https://github.com/Leaflet/Leaflet/pull/10445
|
|
117
|
+
* Fix Popup autoPan crash when stopping the pan removes the popup by [@DeanNorman](https://github.com/DeanNorman) in https://github.com/Leaflet/Leaflet/pull/10416
|
|
118
|
+
* Wrap non-square tile columns by the tile width, not the tile height by [@Jaybhade](https://github.com/Jaybhade) in https://github.com/Leaflet/Leaflet/pull/10333
|
|
119
|
+
* Fix infinite loop in `clipSegment()` with fractional clip bounds by [@spokodev](https://github.com/spokodev) in https://github.com/Leaflet/Leaflet/pull/10284
|
|
120
|
+
* Keep GridLayer tiles during worldCopyJump by [@leijurv](https://github.com/leijurv) in https://github.com/Leaflet/Leaflet/pull/10353 and https://github.com/Leaflet/Leaflet/commit/39d5b54331dc96e8ac30de2c610e28003bb21901
|
|
121
|
+
* Fix map jumping when dragging after pointerdown during inertia by [@Yahiro025](https://github.com/Yahiro025) in https://github.com/Leaflet/Leaflet/pull/10386
|
|
122
|
+
* Fix small Circle radii coming out as ellipses by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10454
|
|
123
|
+
* Fix worldCopyJump throwing with an infinite CRS by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10453
|
|
124
|
+
* Fix attribution control keeping the credits of its initial layers by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10458, and make the attribution handling more robust in https://github.com/Leaflet/Leaflet/commit/6de8f8a9ec5702642d8bfff2eb59e448668df588
|
|
125
|
+
* Keep dragging switched off when a marker is removed and added again by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10456
|
|
126
|
+
* Keep dragging a marker when its icon is changed by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10457
|
|
127
|
+
* Fix DOM API misuse in https://github.com/Leaflet/Leaflet/pull/10460
|
|
128
|
+
* Fix tiles, markers and tooltips being selectable in Safari in https://github.com/Leaflet/Leaflet/pull/10462
|
|
129
|
+
* Fix a small `flyTo()` glitch in https://github.com/Leaflet/Leaflet/commit/3a809320007a3cad0efd920c8216bdb11ff1988a
|
|
130
|
+
* Fix hover breaking on `bringToFront()` in Chrome in https://github.com/Leaflet/Leaflet/commit/0609413eb7f5d12e8dc59a15fd3058657c3897a0
|
|
131
|
+
* Fix page scrolling on map refocus in https://github.com/Leaflet/Leaflet/commit/dd71a7849294265140d5d32aebbb8e1ddc7de199
|
|
132
|
+
* Fix an edge case with a tiny box zoom in https://github.com/Leaflet/Leaflet/commit/a82d3832c9b803fdc74029ed6093c2dd924a64f6
|
|
133
|
+
* Fix VideoOverlay throwing when created from a video element by [@Enesuygurs](https://github.com/Enesuygurs) in https://github.com/Leaflet/Leaflet/pull/10464
|
|
134
|
+
* Fix the global build throwing without `navigator` (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
135
|
+
* Fix usability on maps with `zoomAnimation` disabled in https://github.com/Leaflet/Leaflet/pull/10465
|
|
136
|
+
* Avoid relayouts on wheel zoom and pinch zoom in https://github.com/Leaflet/Leaflet/commit/9c0cef035e695650964786af63f3222f42f15f1f and https://github.com/Leaflet/Leaflet/commit/0f8f2fb008900f05b5b614b6e76a2ea7a426eb9f
|
|
137
|
+
* Fix `toGeoJSON()` dropping MultiPoint members of a GeometryCollection by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10468
|
|
138
|
+
* Fix WMSTileLayer throwing on relative service URLs by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10474
|
|
139
|
+
* Fix VideoOverlay ignoring `keepAspectRatio: false` in Firefox and Safari by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10475
|
|
140
|
+
* Limit the destination of `flyTo()` to `maxBounds` by [@Don-Yin](https://github.com/Don-Yin) in https://github.com/Leaflet/Leaflet/pull/10477
|
|
141
|
+
* Fix a drag sometimes getting stuck after a quick pan outside the window in https://github.com/Leaflet/Leaflet/commit/cdff2a590004f604db7ef44f69b0ea02073cfea6
|
|
142
|
+
* Fix the tile zoom of GridLayer `redraw()` on a fractional map zoom (with [@adamnson](https://github.com/adamnson)) in https://github.com/Leaflet/Leaflet/commit/199eae85af7534f17ab119f4c830c500b6b9e49f
|
|
143
|
+
* Fix light seams between tiles during a zoom animation in Chrome, tiles fade in with the Web Animations API in https://github.com/Leaflet/Leaflet/pull/10471
|
|
144
|
+
* Return the layer from `closeTooltip()`, fix `isTooltipOpen()` throwing without a bound tooltip in https://github.com/Leaflet/Leaflet/commit/7f89a0681e6e33e25edfefb1586cae7b42948e35
|
|
145
|
+
|
|
146
|
+
#### 📝 Docs
|
|
147
|
+
|
|
148
|
+
* Update leaflet.sidepanel plugin links by [@m-altaifi](https://github.com/m-altaifi) in https://github.com/Leaflet/Leaflet/pull/10389
|
|
149
|
+
* Fix accuracy radius in the mobile geolocation example by [@xvodddwannaG](https://github.com/xvodddwannaG) in https://github.com/Leaflet/Leaflet/pull/10332
|
|
150
|
+
* Evergreen language on zoom-levels and handlers tutorials by [@SatvikMishra08](https://github.com/SatvikMishra08) in https://github.com/Leaflet/Leaflet/pull/10398
|
|
151
|
+
* Note that `setStyle()` does not update `className` by [@lux-in-tenebris-lucet](https://github.com/lux-in-tenebris-lucet) in https://github.com/Leaflet/Leaflet/pull/10327
|
|
152
|
+
* Fix missing front matter delimiter in city-autocomplete-usa.md by [@slbarriosdev](https://github.com/slbarriosdev) in https://github.com/Leaflet/Leaflet/pull/10258
|
|
153
|
+
* Fix spelling errors in Joomla plugin documentation by [@Fran-cruz](https://github.com/Fran-cruz) in https://github.com/Leaflet/Leaflet/pull/10298
|
|
154
|
+
* Remove `!important` in the CSS of the website in https://github.com/Leaflet/Leaflet/commit/e2036455408de5b6dc1e6c60f10888c1f34af49b
|
|
155
|
+
* Clarify the stacking of layers within a pane by [@VisakanM-bit](https://github.com/VisakanM-bit) in https://github.com/Leaflet/Leaflet/pull/10297
|
|
156
|
+
* Add the Leaflet WebGL Markers plugin by [@tang-tc](https://github.com/tang-tc) in https://github.com/Leaflet/Leaflet/pull/10349
|
|
157
|
+
* Add the PartiallyEditablePolyline plugin by [@hiroaki](https://github.com/hiroaki) in https://github.com/Leaflet/Leaflet/pull/10395
|
|
158
|
+
* Add the @s57-parser/leaflet plugin by [@devladpopov](https://github.com/devladpopov) in https://github.com/Leaflet/Leaflet/pull/10394
|
|
159
|
+
* Add the leaflet-daynight plugin by [@LoganD900](https://github.com/LoganD900) in https://github.com/Leaflet/Leaflet/pull/10388
|
|
160
|
+
* Add the Leaflet.GridLayer.Relief plugin by [@glandais](https://github.com/glandais) in https://github.com/Leaflet/Leaflet/pull/10348
|
|
161
|
+
* Update the maptiler-geocoding-control plugin for v2 by [@katemihalikova](https://github.com/katemihalikova) in https://github.com/Leaflet/Leaflet/pull/10195
|
|
162
|
+
* Add the Leaflet.WorldWrap plugin by [@EricDalnas](https://github.com/EricDalnas) in https://github.com/Leaflet/Leaflet/pull/10188
|
|
163
|
+
* Add the leaflet-draggable-tooltips plugin by [@georiv](https://github.com/georiv) in https://github.com/Leaflet/Leaflet/pull/10243 and https://github.com/Leaflet/Leaflet/pull/10481
|
|
164
|
+
* Add the leaflet-india-boundary plugin by [@lux-in-tenebris-lucet](https://github.com/lux-in-tenebris-lucet) in https://github.com/Leaflet/Leaflet/pull/10328
|
|
165
|
+
* Add the leaflet-floating-measure plugin by [@ringraham](https://github.com/ringraham) in https://github.com/Leaflet/Leaflet/pull/10345
|
|
166
|
+
|
|
167
|
+
#### 🔧 Workflow
|
|
168
|
+
|
|
169
|
+
* Consolidate CI jobs in https://github.com/Leaflet/Leaflet/commit/43f310b53c2632699f6a6a3679d14a3f717aacf8
|
|
170
|
+
* Report the bundle size in a tiny CI job in https://github.com/Leaflet/Leaflet/pull/10430
|
|
171
|
+
* Check the global build and the self-contained CSS in CI (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
172
|
+
* Name the test jobs, publish the development snapshot with `gh` in https://github.com/Leaflet/Leaflet/commit/40c052b0d0fe1d7159f55d87089f24e2ed422e0d and https://github.com/Leaflet/Leaflet/commit/ac7b690b1b5d727c219fd4ef6c347b4f38fe26dd
|
|
173
|
+
* Remove the stale AMD debug page in https://github.com/Leaflet/Leaflet/commit/9adfc0ac0d3a62a5b4af292f637fcb15c5e534dd
|
|
174
|
+
* Remove CSS fallbacks and leftovers, explain the `!important` in https://github.com/Leaflet/Leaflet/pull/10462
|
|
175
|
+
* Build the website with a small Node script instead of Jekyll in https://github.com/Leaflet/Leaflet/pull/10484
|
|
176
|
+
|
|
177
|
+
#### 🧪 Tests
|
|
178
|
+
|
|
179
|
+
* Simplify, improve and speed up the test setup in https://github.com/Leaflet/Leaflet/pull/10463
|
|
180
|
+
* Add specs of the layer lifecycle and of extending layers (from https://github.com/Leaflet/Leaflet/pull/10441)
|
|
181
|
+
* Speed up a slow `flyTo()` test and fix a flaky DragHandler test in https://github.com/Leaflet/Leaflet/commit/051c4a65082dd3259858f9000189faf7d351522a and https://github.com/Leaflet/Leaflet/commit/a8a1904c390540735d7906f152e628971df0e0b6
|
|
182
|
+
* Replace prosthetic-hand with a small built-in `Finger` helper in https://github.com/Leaflet/Leaflet/pull/10476
|
|
183
|
+
|
|
6
184
|
## 4.0.0 (2026-10-19) 🍁 Maplair, a fork of Leaflet
|
|
7
185
|
|
|
8
186
|
The first release of Maplair, a fork of Leaflet. It contains all changes since Leaflet 1.9.4: those of Leaflet 2.0.0-alpha and 2.0.0-alpha.1 (see below), the unreleased changes of Leaflet until the fork, and Maplair's own changes.
|
package/dist/esm/Maplair.js
CHANGED
|
@@ -2,7 +2,6 @@ import { version as version$1 } from "./package.js";
|
|
|
2
2
|
import { Util_exports } from "./core/Util.js";
|
|
3
3
|
import { Class } from "./core/Class.js";
|
|
4
4
|
import { Point } from "./geometry/Point.js";
|
|
5
|
-
import Browser_default from "./core/Browser.js";
|
|
6
5
|
import { DomEvent_exports } from "./dom/DomEvent.js";
|
|
7
6
|
import { DomUtil_exports } from "./dom/DomUtil.js";
|
|
8
7
|
import { Control } from "./control/Control.js";
|
|
@@ -14,27 +13,27 @@ import { Layer } from "./layer/Layer.js";
|
|
|
14
13
|
import { ContextMenu } from "./control/ContextMenu.js";
|
|
15
14
|
import { FullscreenControl } from "./control/FullscreenControl.js";
|
|
16
15
|
import { LayersControl } from "./control/LayersControl.js";
|
|
17
|
-
import { Path } from "./layer/vector/Path.js";
|
|
18
16
|
import { Bounds } from "./geometry/Bounds.js";
|
|
17
|
+
import { BlanketOverlay } from "./layer/BlanketOverlay.js";
|
|
18
|
+
import { Renderer } from "./layer/vector/Renderer.js";
|
|
19
|
+
import { SVG } from "./layer/vector/SVG.js";
|
|
20
|
+
import { Path } from "./layer/vector/Path.js";
|
|
19
21
|
import { LatLngBounds } from "./geo/LatLngBounds.js";
|
|
20
|
-
import { CRS } from "./geo/crs/CRS.js";
|
|
21
|
-
import { EarthCRS } from "./geo/crs/EarthCRS.js";
|
|
22
22
|
import { LatLng } from "./geo/LatLng.js";
|
|
23
|
+
import { LineUtil_exports } from "./geometry/LineUtil.js";
|
|
23
24
|
import { CircleMarker } from "./layer/vector/CircleMarker.js";
|
|
24
25
|
import { LegendControl } from "./control/LegendControl.js";
|
|
26
|
+
import { CRS } from "./geo/crs/CRS.js";
|
|
27
|
+
import { EarthCRS } from "./geo/crs/EarthCRS.js";
|
|
28
|
+
import { SphericalMercatorProjection } from "./geo/projection/SphericalMercatorProjection.js";
|
|
25
29
|
import { Transformation } from "./geometry/Transformation.js";
|
|
26
30
|
import { EPSG3857, EPSG900913 } from "./geo/crs/EPSG3857.js";
|
|
27
|
-
import { PosAnimation } from "./dom/PosAnimation.js";
|
|
28
31
|
import { ZoomControl } from "./control/ZoomControl.js";
|
|
29
32
|
import { LayerGroup } from "./layer/LayerGroup.js";
|
|
30
33
|
import { FeatureGroup } from "./layer/FeatureGroup.js";
|
|
31
34
|
import { DivOverlay } from "./layer/DivOverlay.js";
|
|
32
35
|
import { Popup } from "./layer/Popup.js";
|
|
33
36
|
import { Tooltip } from "./layer/Tooltip.js";
|
|
34
|
-
import { BlanketOverlay } from "./layer/BlanketOverlay.js";
|
|
35
|
-
import { Renderer } from "./layer/vector/Renderer.js";
|
|
36
|
-
import { Canvas } from "./layer/vector/Canvas.js";
|
|
37
|
-
import { SVG } from "./layer/vector/SVG.js";
|
|
38
37
|
import { Handler } from "./core/Handler.js";
|
|
39
38
|
import { BoxZoomHandler } from "./map/handler/BoxZoomHandler.js";
|
|
40
39
|
import { DoubleClickZoomHandler } from "./map/handler/DoubleClickZoomHandler.js";
|
|
@@ -45,10 +44,9 @@ import { PinchZoomHandler } from "./map/handler/PinchZoomHandler.js";
|
|
|
45
44
|
import { ScrollWheelZoomHandler } from "./map/handler/ScrollWheelZoomHandler.js";
|
|
46
45
|
import { TapHoldHandler } from "./map/handler/TapHoldHandler.js";
|
|
47
46
|
import { TapDragZoomHandler } from "./map/handler/TapDragZoomHandler.js";
|
|
48
|
-
import {
|
|
49
|
-
import { PolyUtil_exports } from "./geometry/PolyUtil.js";
|
|
50
|
-
import { LineUtil_exports } from "./geometry/LineUtil.js";
|
|
47
|
+
import { LeafletMap as MaplairMap } from "./map/Map.js";
|
|
51
48
|
import { Polyline } from "./layer/vector/Polyline.js";
|
|
49
|
+
import { PolyUtil_exports } from "./geometry/PolyUtil.js";
|
|
52
50
|
import { Polygon } from "./layer/vector/Polygon.js";
|
|
53
51
|
import { MiniMapControl } from "./control/MiniMapControl.js";
|
|
54
52
|
import { ScaleControl } from "./control/ScaleControl.js";
|
|
@@ -58,11 +56,12 @@ import { Marker } from "./layer/marker/Marker.js";
|
|
|
58
56
|
import { SearchControl } from "./control/SearchControl.js";
|
|
59
57
|
import { SideBySideControl } from "./control/SideBySideControl.js";
|
|
60
58
|
import { TextControl } from "./control/TextControl.js";
|
|
61
|
-
import {
|
|
59
|
+
import { TimeControl } from "./control/TimeControl.js";
|
|
60
|
+
import { LonLatProjection } from "./geo/projection/LonLatProjection.js";
|
|
61
|
+
import { MercatorProjection } from "./geo/projection/MercatorProjection.js";
|
|
62
62
|
import { EPSG3395 } from "./geo/crs/EPSG3395.js";
|
|
63
63
|
import { EPSG4326 } from "./geo/crs/EPSG4326.js";
|
|
64
64
|
import { SimpleCRS } from "./geo/crs/SimpleCRS.js";
|
|
65
|
-
import { Circle } from "./layer/vector/Circle.js";
|
|
66
65
|
import { GeoJSON } from "./layer/GeoJSON.js";
|
|
67
66
|
import { Classification } from "./layer/Classification.js";
|
|
68
67
|
import { HeatLayer } from "./layer/HeatLayer.js";
|
|
@@ -71,20 +70,22 @@ import { VideoOverlay } from "./layer/VideoOverlay.js";
|
|
|
71
70
|
import { SVGOverlay } from "./layer/SVGOverlay.js";
|
|
72
71
|
import { DivIcon } from "./layer/marker/DivIcon.js";
|
|
73
72
|
import { SvgIcon } from "./layer/marker/SvgIcon.js";
|
|
73
|
+
import { MarkerClusterGroup } from "./layer/marker/MarkerClusterGroup.js";
|
|
74
74
|
import { GridLayer } from "./layer/tile/GridLayer.js";
|
|
75
75
|
import { TileLayer } from "./layer/tile/TileLayer.js";
|
|
76
76
|
import { WMSTileLayer } from "./layer/tile/WMSTileLayer.js";
|
|
77
|
+
import { Canvas } from "./layer/vector/Canvas.js";
|
|
78
|
+
import { Circle } from "./layer/vector/Circle.js";
|
|
77
79
|
import { Rectangle } from "./layer/vector/Rectangle.js";
|
|
78
80
|
import { Hash } from "./map/Hash.js";
|
|
79
81
|
import { MapSync } from "./map/MapSync.js";
|
|
80
82
|
import { DisplaceHandler, displace } from "./map/handler/DisplaceHandler.js";
|
|
81
|
-
|
|
83
|
+
// src/Maplair.js
|
|
82
84
|
/**
|
|
83
85
|
* A constant that represents the Maplair version in use.
|
|
84
86
|
* @type {string}
|
|
85
87
|
*/
|
|
86
88
|
const version = version$1;
|
|
87
|
-
|
|
88
|
-
export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler, Browser_default as Browser, 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, LegendControl, LineUtil_exports as LineUtil, Map, MapSync, MaplairMap, Marker, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, PosAnimation, projection_exports as Projection, Rectangle, Renderer, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
|
|
89
|
+
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, LegendControl, LineUtil_exports as LineUtil, LonLatProjection, MaplairMap as Map, MapSync, MaplairMap, Marker, MarkerClusterGroup, MercatorProjection, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, Rectangle, Renderer, 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 };
|
|
89
90
|
|
|
90
91
|
//# sourceMappingURL=Maplair.js.map
|
package/dist/esm/Maplair.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Maplair.js","names":["pkg.version"],"sources":["../../src/Maplair.js"],"sourcesContent":["import pkg from '../package.json' with {type: 'json'};\n/**\n * A constant that represents the Maplair version in use.\n * @type {string}\n */\nexport const version = pkg.version;\n\n// control\nexport * from './control/index.js';\n\n// core\nexport * from './core/index.js';\n\n// dom\nexport * from './dom/index.js';\n\n// geometry\nexport * from './geometry/index.js';\n\n// geo\nexport * from './geo/index.js';\n\n// layer\nexport * from './layer/index.js';\n\n// map\nexport * from './map/index.js';\n\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Maplair.js","names":["pkg.version"],"sources":["../../src/Maplair.js"],"sourcesContent":["import pkg from '../package.json' with {type: 'json'};\n/**\n * A constant that represents the Maplair version in use.\n * @type {string}\n */\nexport const version = pkg.version;\n\n// control\nexport * from './control/index.js';\n\n// core\nexport * from './core/index.js';\n\n// dom\nexport * from './dom/index.js';\n\n// geometry\nexport * from './geometry/index.js';\n\n// geo\nexport * from './geo/index.js';\n\n// layer\nexport * from './layer/index.js';\n\n// map\nexport * from './map/index.js';\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAa,UAAUA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
@@ -9,5 +9,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
9
9
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
10
|
return target;
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { __exportAll };
|
|
@@ -2,7 +2,7 @@ import { disableClickPropagation } from "../dom/DomEvent.js";
|
|
|
2
2
|
import { create } from "../dom/DomUtil.js";
|
|
3
3
|
import { Control } from "./Control.js";
|
|
4
4
|
import { I18n } from "../core/I18n.js";
|
|
5
|
-
|
|
5
|
+
// src/control/AttributionControl.js
|
|
6
6
|
/** @import {ControlOptions} from './Control.js' */
|
|
7
7
|
/** @import {MaplairMap} from '../map/Map.js' */
|
|
8
8
|
const mapleLeaf = "<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\">🍁</span>";
|
|
@@ -39,12 +39,10 @@ const mapleLeaf = "<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\"
|
|
|
39
39
|
* automatically.
|
|
40
40
|
*/
|
|
41
41
|
var AttributionControl = class AttributionControl extends Control {
|
|
42
|
-
static {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
}
|
|
42
|
+
static defaultOptions = {
|
|
43
|
+
position: "bottomright",
|
|
44
|
+
prefix: null
|
|
45
|
+
};
|
|
48
46
|
/**
|
|
49
47
|
* Creates an attribution control.
|
|
50
48
|
* @param {AttributionControlOptions} [options]
|
|
@@ -57,6 +55,7 @@ var AttributionControl = class AttributionControl extends Control {
|
|
|
57
55
|
}
|
|
58
56
|
this._attributions = {};
|
|
59
57
|
this._orders = {};
|
|
58
|
+
this._layerAttributions = /* @__PURE__ */ new Map();
|
|
60
59
|
this.callInitHooks(AttributionControl);
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
@@ -68,9 +67,12 @@ var AttributionControl = class AttributionControl extends Control {
|
|
|
68
67
|
map.attributionControl = this;
|
|
69
68
|
this._container = create("div", "maplair-control-attribution");
|
|
70
69
|
disableClickPropagation(this._container);
|
|
71
|
-
|
|
70
|
+
if (map._loaded) map.eachLayer((layer) => this._addLayer({ layer }));
|
|
72
71
|
this._update();
|
|
73
|
-
map.on(
|
|
72
|
+
map.on({
|
|
73
|
+
layeradd: this._addLayer,
|
|
74
|
+
layerremove: this._removeLayer
|
|
75
|
+
}, this);
|
|
74
76
|
return this._container;
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
@@ -78,13 +80,21 @@ var AttributionControl = class AttributionControl extends Control {
|
|
|
78
80
|
* @param {MaplairMap} map
|
|
79
81
|
*/
|
|
80
82
|
onRemove(map) {
|
|
81
|
-
map.off(
|
|
83
|
+
map.off({
|
|
84
|
+
layeradd: this._addLayer,
|
|
85
|
+
layerremove: this._removeLayer
|
|
86
|
+
}, this);
|
|
87
|
+
for (const layer of this._layerAttributions.keys()) this._removeLayer({ layer });
|
|
82
88
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
_addLayer({ layer }) {
|
|
90
|
+
const text = layer.getAttribution?.();
|
|
91
|
+
if (!text || this._layerAttributions.has(layer)) return;
|
|
92
|
+
this._layerAttributions.set(layer, text);
|
|
93
|
+
this.addAttribution(text, layer.options?.attributionOrder);
|
|
94
|
+
}
|
|
95
|
+
_removeLayer({ layer }) {
|
|
96
|
+
this.removeAttribution(this._layerAttributions.get(layer));
|
|
97
|
+
this._layerAttributions.delete(layer);
|
|
88
98
|
}
|
|
89
99
|
/**
|
|
90
100
|
* The HTML text shown before the attributions. Pass `false` to disable.
|
|
@@ -145,7 +155,6 @@ var AttributionControl = class AttributionControl extends Control {
|
|
|
145
155
|
});
|
|
146
156
|
}
|
|
147
157
|
};
|
|
148
|
-
//#endregion
|
|
149
158
|
export { AttributionControl };
|
|
150
159
|
|
|
151
160
|
//# sourceMappingURL=AttributionControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributionControl.js","names":["DomUtil.create"],"sources":["../../../src/control/AttributionControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\nconst mapleLeaf = '<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\">🍁</span>';\n\n/**\n * Options of `AttributionControl`.\n * @typedef {object} AttributionControlOptions\n * @property {string} [position='bottomright'] The position of the control (one of the\n * map corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string|false|null} [prefix=null] The HTML text shown before the\n * attributions. Pass `false` to disable. By default (`null`), a link to Maplair.\n * @extends ControlOptions\n */\n\n/**\n * Map options of `AttributionControl`.\n * @typedef {object} AttributionControlMapOptions\n * @lends MaplairMapOptions\n * @property {boolean} [attributionControl=true] Whether a\n * [attribution control](#control-attribution) is added to the map by default.\n */\n\n/**\n * Properties of `MaplairMap` set by `AttributionControl`.\n * @typedef {object} AttributionControlMapProperties\n * @lends MaplairMap\n * @property {AttributionControl} attributionControl The attribution control of the map,\n * the default one (if the [`attributionControl` option](#map-attributioncontrol) was\n * `true` when creating the map) or the one added last.\n */\n\n/**\n * The attribution control allows you to display attribution data in a small text box\n * on a map. It is put on the map by default unless you set its\n * [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches\n * attribution texts from layers with the [`getAttribution` method](#layer-getattribution)\n * automatically.\n */\nexport class AttributionControl extends Control {\n\n\tstatic {\n\t\
|
|
1
|
+
{"version":3,"file":"AttributionControl.js","names":["DomUtil.create"],"sources":["../../../src/control/AttributionControl.js"],"sourcesContent":["\nimport {Control} from './Control.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport {I18n} from '../core/I18n.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\nconst mapleLeaf = '<span aria-hidden=\"true\" class=\"maplair-attribution-leaf\">🍁</span>';\n\n/**\n * Options of `AttributionControl`.\n * @typedef {object} AttributionControlOptions\n * @property {string} [position='bottomright'] The position of the control (one of the\n * map corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string|false|null} [prefix=null] The HTML text shown before the\n * attributions. Pass `false` to disable. By default (`null`), a link to Maplair.\n * @extends ControlOptions\n */\n\n/**\n * Map options of `AttributionControl`.\n * @typedef {object} AttributionControlMapOptions\n * @lends MaplairMapOptions\n * @property {boolean} [attributionControl=true] Whether a\n * [attribution control](#control-attribution) is added to the map by default.\n */\n\n/**\n * Properties of `MaplairMap` set by `AttributionControl`.\n * @typedef {object} AttributionControlMapProperties\n * @lends MaplairMap\n * @property {AttributionControl} attributionControl The attribution control of the map,\n * the default one (if the [`attributionControl` option](#map-attributioncontrol) was\n * `true` when creating the map) or the one added last.\n */\n\n/**\n * The attribution control allows you to display attribution data in a small text box\n * on a map. It is put on the map by default unless you set its\n * [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches\n * attribution texts from layers with the [`getAttribution` method](#layer-getattribution)\n * automatically.\n */\nexport class AttributionControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tposition: 'bottomright',\n\t\tprefix: null\n\t};\n\n\t/**\n\t * Creates an attribution control.\n\t * @param {AttributionControlOptions} [options]\n\t */\n\tconstructor(options) {\n\t\tsuper(options);\n\t\tif (this.options.prefix === null) {\n\t\t\tconst title = I18n.translate('A JavaScript library for interactive maps');\n\t\t\tthis.options.prefix = `<a target=\"_blank\" href=\"https://maplair.org\" title=\"${title}\">${mapleLeaf}Maplair</a>`;\n\t\t}\n\n\t\tthis._attributions = {};\n\t\tthis._orders = {};\n\t\tthis._layerAttributions = new Map();\n\n\t\tthis.callInitHooks(AttributionControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tmap.attributionControl = this;\n\t\tthis._container = DomUtil.create('div', 'maplair-control-attribution');\n\t\tDomEvent.disableClickPropagation(this._container);\n\n\t\t// before the map is loaded, layers already added to it will still fire layeradd once it loads\n\t\tif (map._loaded) {\n\t\t\tmap.eachLayer(layer => this._addLayer({layer}));\n\t\t}\n\n\t\tthis._update();\n\n\t\tmap.on({layeradd: this._addLayer, layerremove: this._removeLayer}, this);\n\n\t\treturn this._container;\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tmap.off({layeradd: this._addLayer, layerremove: this._removeLayer}, this);\n\n\t\tfor (const layer of this._layerAttributions.keys()) {\n\t\t\tthis._removeLayer({layer});\n\t\t}\n\t}\n\n\t_addLayer({layer}) {\n\t\tconst text = layer.getAttribution?.();\n\t\tif (!text || this._layerAttributions.has(layer)) { return; }\n\n\t\tthis._layerAttributions.set(layer, text);\n\t\tthis.addAttribution(text, layer.options?.attributionOrder);\n\t}\n\n\t_removeLayer({layer}) {\n\t\tthis.removeAttribution(this._layerAttributions.get(layer));\n\t\tthis._layerAttributions.delete(layer);\n\t}\n\n\t/**\n\t * The HTML text shown before the attributions. Pass `false` to disable.\n\t * @param {string|false} prefix\n\t * @returns {this}\n\t */\n\tsetPrefix(prefix) {\n\t\tthis.options.prefix = prefix;\n\t\tthis._update();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds an attribution text (e.g. `'© OpenStreetMap contributors'`). Attributions\n\t * are sorted by `order` (see the layer option `attributionOrder`), then by the order\n\t * of adding.\n\t * @param {string} text\n\t * @param {number} [order=0]\n\t * @returns {this}\n\t */\n\taddAttribution(text, order = 0) {\n\t\tif (!text) { return this; }\n\n\t\tthis._orders[text] = order;\n\t\tif (!this._attributions[text]) {\n\t\t\tthis._attributions[text] = 0;\n\t\t}\n\t\tthis._attributions[text]++;\n\n\t\tthis._update();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes an attribution text.\n\t * @param {string} text\n\t * @returns {this}\n\t */\n\tremoveAttribution(text) {\n\t\tif (!text) { return this; }\n\n\t\tif (this._attributions[text]) {\n\t\t\tthis._attributions[text]--;\n\t\t\tthis._update();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t_update() {\n\t\tif (!this._map) { return; }\n\n\t\tconst attribs = Object.keys(this._attributions).filter(i => this._attributions[i])\n\t\t\t.sort((a, b) => this._orders[a] - this._orders[b]);\n\n\t\tconst prefixAndAttribs = [];\n\n\t\tif (this.options.prefix) {\n\t\t\tprefixAndAttribs.push(this.options.prefix);\n\t\t}\n\t\tif (attribs.length) {\n\t\t\tprefixAndAttribs.push(attribs.join(', '));\n\t\t}\n\n\t\tthis._container.innerHTML = prefixAndAttribs.join(' <span aria-hidden=\"true\">|</span> ');\n\t}\n\n\t/**\n\t * Registers this default feature on the map class, called by `MaplairMap` itself.\n\t * @internal\n\t * @param {typeof MaplairMap} MaplairMap\n\t */\n\tstatic register(MaplairMap) {\n\t\tMaplairMap.mergeOptions({\n\t\t\tattributionControl: true\n\t\t});\n\n\t\tMaplairMap.addInitHook(function () {\n\t\t\tif (this.options.attributionControl) {\n\t\t\t\tnew AttributionControl().addTo(this);\n\t\t\t}\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;AAQA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqClB,IAAa,qBAAb,MAAa,2BAA2B,QAAQ;CAE/C,OAAO,iBAAiB;EACvB,UAAU;EACV,QAAQ;CACT;;;;;CAMA,YAAY,SAAS;EACpB,MAAM,OAAO;EACb,IAAI,KAAK,QAAQ,WAAW,MAAM;GACjC,MAAM,QAAQ,KAAK,UAAU,2CAA2C;GACxE,KAAK,QAAQ,SAAS,wDAAwD,MAAM,IAAI,UAAU;EACnG;EAEA,KAAK,gBAAgB,CAAC;EACtB,KAAK,UAAU,CAAC;EAChB,KAAK,qCAAqB,IAAI,IAAI;EAElC,KAAK,cAAc,kBAAkB;CACtC;;;;;;CAOA,MAAM,KAAK;EACV,IAAI,qBAAqB;EACzB,KAAK,aAAaA,OAAe,OAAO,6BAA6B;EACrE,wBAAiC,KAAK,UAAU;EAGhD,IAAI,IAAI,SACP,IAAI,WAAU,UAAS,KAAK,UAAU,EAAC,MAAK,CAAC,CAAC;EAG/C,KAAK,QAAQ;EAEb,IAAI,GAAG;GAAC,UAAU,KAAK;GAAW,aAAa,KAAK;EAAY,GAAG,IAAI;EAEvE,OAAO,KAAK;CACb;;;;;CAMA,SAAS,KAAK;EACb,IAAI,IAAI;GAAC,UAAU,KAAK;GAAW,aAAa,KAAK;EAAY,GAAG,IAAI;EAExE,KAAK,MAAM,SAAS,KAAK,mBAAmB,KAAK,GAChD,KAAK,aAAa,EAAC,MAAK,CAAC;CAE3B;CAEA,UAAU,EAAC,SAAQ;EAClB,MAAM,OAAO,MAAM,iBAAiB;EACpC,IAAI,CAAC,QAAQ,KAAK,mBAAmB,IAAI,KAAK,GAAK;EAEnD,KAAK,mBAAmB,IAAI,OAAO,IAAI;EACvC,KAAK,eAAe,MAAM,MAAM,SAAS,gBAAgB;CAC1D;CAEA,aAAa,EAAC,SAAQ;EACrB,KAAK,kBAAkB,KAAK,mBAAmB,IAAI,KAAK,CAAC;EACzD,KAAK,mBAAmB,OAAO,KAAK;CACrC;;;;;;CAOA,UAAU,QAAQ;EACjB,KAAK,QAAQ,SAAS;EACtB,KAAK,QAAQ;EACb,OAAO;CACR;;;;;;;;;CAUA,eAAe,MAAM,QAAQ,GAAG;EAC/B,IAAI,CAAC,MAAQ,OAAO;EAEpB,KAAK,QAAQ,QAAQ;EACrB,IAAI,CAAC,KAAK,cAAc,OACvB,KAAK,cAAc,QAAQ;EAE5B,KAAK,cAAc,KAAK;EAExB,KAAK,QAAQ;EAEb,OAAO;CACR;;;;;;CAOA,kBAAkB,MAAM;EACvB,IAAI,CAAC,MAAQ,OAAO;EAEpB,IAAI,KAAK,cAAc,OAAO;GAC7B,KAAK,cAAc,KAAK;GACxB,KAAK,QAAQ;EACd;EAEA,OAAO;CACR;CAEA,UAAU;EACT,IAAI,CAAC,KAAK,MAAQ;EAElB,MAAM,UAAU,OAAO,KAAK,KAAK,aAAa,CAAC,CAAC,QAAO,MAAK,KAAK,cAAc,EAAE,CAAC,CAChF,MAAM,GAAG,MAAM,KAAK,QAAQ,KAAK,KAAK,QAAQ,EAAE;EAElD,MAAM,mBAAmB,CAAC;EAE1B,IAAI,KAAK,QAAQ,QAChB,iBAAiB,KAAK,KAAK,QAAQ,MAAM;EAE1C,IAAI,QAAQ,QACX,iBAAiB,KAAK,QAAQ,KAAK,IAAI,CAAC;EAGzC,KAAK,WAAW,YAAY,iBAAiB,KAAK,uCAAqC;CACxF;;;;;;CAOA,OAAO,SAAS,YAAY;EAC3B,WAAW,aAAa,EACvB,oBAAoB,KACrB,CAAC;EAED,WAAW,YAAY,WAAY;GAClC,IAAI,KAAK,QAAQ,oBAChB,IAAI,mBAAmB,CAAC,CAAC,MAAM,IAAI;EAErC,CAAC;CACF;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { disableClickPropagation, on, stop } from "../dom/DomEvent.js";
|
|
2
2
|
import { create } from "../dom/DomUtil.js";
|
|
3
3
|
import { Control } from "./Control.js";
|
|
4
|
-
|
|
4
|
+
// src/control/ButtonControl.js
|
|
5
5
|
/** @import {ControlOptions} from './Control.js' */
|
|
6
6
|
/** @import {MaplairMap} from '../map/Map.js' */
|
|
7
7
|
/**
|
|
@@ -65,17 +65,15 @@ import { Control } from "./Control.js";
|
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
67
|
var ButtonControl = class ButtonControl extends Control {
|
|
68
|
-
static {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
}
|
|
68
|
+
static defaultOptions = {
|
|
69
|
+
position: "topleft",
|
|
70
|
+
content: "",
|
|
71
|
+
title: "",
|
|
72
|
+
onClick: void 0,
|
|
73
|
+
states: void 0,
|
|
74
|
+
className: "",
|
|
75
|
+
accessKey: ""
|
|
76
|
+
};
|
|
79
77
|
/**
|
|
80
78
|
* Creates a button control.
|
|
81
79
|
* @param {...ButtonControlOptions} args The options.
|
|
@@ -215,7 +213,6 @@ var ButtonBarControl = class ButtonBarControl extends Control {
|
|
|
215
213
|
return this._buttons;
|
|
216
214
|
}
|
|
217
215
|
};
|
|
218
|
-
//#endregion
|
|
219
216
|
export { ButtonBarControl, ButtonControl };
|
|
220
217
|
|
|
221
218
|
//# sourceMappingURL=ButtonControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonControl.js","names":["DomUtil.create","DomEvent.stop"],"sources":["../../../src/control/ButtonControl.js"],"sourcesContent":["import {Control} from './Control.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\n/**\n * A state of a `ButtonControl`, see its `states` option.\n * @typedef {object} ButtonControlState\n * @property {string} name The name of the state, see `setState()`.\n * @property {string|HTMLElement} [content] The content of the button in this state.\n * @property {string} [title] The title of the button in this state.\n * @property {(this: ButtonControl, e: MouseEvent, button: ButtonControl, map: MaplairMap) => void} [onClick]\n * Called when clicking the button in this state.\n */\n\n/**\n * Options of `ButtonControl`.\n * @typedef {object} ButtonControlOptions\n * @property {string} [position='topleft'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string|HTMLElement} [content=''] The content of the button: HTML (e.g. an\n * icon or a character) or an element. String content is rendered as HTML; do not pass\n * untrusted input.\n * @property {string} [title=''] The title (tooltip) and accessible name of the button.\n * @property {(this: ButtonControl, e: MouseEvent, button: ButtonControl, map: MaplairMap) => void} [onClick]\n * Called with the click event, the `ButtonControl` and the map when clicking the button.\n * @property {ButtonControlState[]} [states] Alternative states of the button, each an\n * object with `name` and with `content`, `title` and `onClick` like the options. The\n * first state is the initial one, `setState()` switches them.\n * @property {string} [className=''] A custom CSS class name to assign to the button.\n * @property {string} [accessKey=''] A key to activate the button with the browser's\n * [access key](https://developer.mozilla.org/docs/Web/HTML/Reference/Global_attributes/accesskey)\n * modifiers (e.g. Alt+Shift+K), shown in the title.\n * @extends ControlOptions\n */\n\n/**\n * A control with a button, styled like the zoom control, calling a function when\n * clicked. It can have several states with their own content, title and function,\n * e.g. to toggle something. Several buttons can be grouped with `ButtonBarControl`.\n *\n * Inspired by the [Leaflet.EasyButton](https://github.com/CliffCloud/Leaflet.EasyButton) plugin.\n *\n * @example\n * ```js\n * new ButtonControl({\n * \tcontent: '⌂',\n * \ttitle: 'Home',\n * \tonClick: (e, button, map) => map.setView([47.27, 11.40], 13)\n * }).addTo(map);\n *\n * new ButtonControl({\n * \tstates: [{\n * \t\tname: 'show',\n * \t\tcontent: '👁',\n * \t\ttitle: 'Show the markers',\n * \t\tonClick(e, button, map) { markers.addTo(map); button.setState('hide'); }\n * \t}, {\n * \t\tname: 'hide',\n * \t\tcontent: '🙈',\n * \t\ttitle: 'Hide the markers',\n * \t\tonClick(e, button) { markers.remove(); button.setState('show'); }\n * \t}]\n * }).addTo(map);\n * ```\n */\nexport class ButtonControl extends Control {\n\n\tstatic {\n\t\
|
|
1
|
+
{"version":3,"file":"ButtonControl.js","names":["DomUtil.create","DomEvent.stop"],"sources":["../../../src/control/ButtonControl.js"],"sourcesContent":["import {Control} from './Control.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\n/** @import {ControlOptions} from './Control.js' */\n/** @import {MaplairMap} from '../map/Map.js' */\n\n/**\n * A state of a `ButtonControl`, see its `states` option.\n * @typedef {object} ButtonControlState\n * @property {string} name The name of the state, see `setState()`.\n * @property {string|HTMLElement} [content] The content of the button in this state.\n * @property {string} [title] The title of the button in this state.\n * @property {(this: ButtonControl, e: MouseEvent, button: ButtonControl, map: MaplairMap) => void} [onClick]\n * Called when clicking the button in this state.\n */\n\n/**\n * Options of `ButtonControl`.\n * @typedef {object} ButtonControlOptions\n * @property {string} [position='topleft'] The position of the control (one of the map\n * corners). Possible values are `'topleft'`, `'topright'`, `'bottomleft'` or\n * `'bottomright'`.\n * @property {string|HTMLElement} [content=''] The content of the button: HTML (e.g. an\n * icon or a character) or an element. String content is rendered as HTML; do not pass\n * untrusted input.\n * @property {string} [title=''] The title (tooltip) and accessible name of the button.\n * @property {(this: ButtonControl, e: MouseEvent, button: ButtonControl, map: MaplairMap) => void} [onClick]\n * Called with the click event, the `ButtonControl` and the map when clicking the button.\n * @property {ButtonControlState[]} [states] Alternative states of the button, each an\n * object with `name` and with `content`, `title` and `onClick` like the options. The\n * first state is the initial one, `setState()` switches them.\n * @property {string} [className=''] A custom CSS class name to assign to the button.\n * @property {string} [accessKey=''] A key to activate the button with the browser's\n * [access key](https://developer.mozilla.org/docs/Web/HTML/Reference/Global_attributes/accesskey)\n * modifiers (e.g. Alt+Shift+K), shown in the title.\n * @extends ControlOptions\n */\n\n/**\n * A control with a button, styled like the zoom control, calling a function when\n * clicked. It can have several states with their own content, title and function,\n * e.g. to toggle something. Several buttons can be grouped with `ButtonBarControl`.\n *\n * Inspired by the [Leaflet.EasyButton](https://github.com/CliffCloud/Leaflet.EasyButton) plugin.\n *\n * @example\n * ```js\n * new ButtonControl({\n * \tcontent: '⌂',\n * \ttitle: 'Home',\n * \tonClick: (e, button, map) => map.setView([47.27, 11.40], 13)\n * }).addTo(map);\n *\n * new ButtonControl({\n * \tstates: [{\n * \t\tname: 'show',\n * \t\tcontent: '👁',\n * \t\ttitle: 'Show the markers',\n * \t\tonClick(e, button, map) { markers.addTo(map); button.setState('hide'); }\n * \t}, {\n * \t\tname: 'hide',\n * \t\tcontent: '🙈',\n * \t\ttitle: 'Hide the markers',\n * \t\tonClick(e, button) { markers.remove(); button.setState('show'); }\n * \t}]\n * }).addTo(map);\n * ```\n */\nexport class ButtonControl extends Control {\n\n\tstatic defaultOptions = {\n\t\tposition: 'topleft',\n\t\tcontent: '',\n\t\ttitle: '',\n\t\tonClick: undefined,\n\t\tstates: undefined,\n\t\tclassName: '',\n\t\taccessKey: ''\n\t};\n\n\t/**\n\t * Creates a button control.\n\t * @param {...ButtonControlOptions} args The options.\n\t */\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis._state = this.options.states?.[0];\n\t\tthis.callInitHooks(ButtonControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @returns {HTMLElement}\n\t */\n\tonAdd() {\n\t\tconst container = DomUtil.create('div', 'maplair-bar maplair-control-button');\n\t\tthis._createButton(container);\n\t\treturn container;\n\t}\n\n\t// Creates the button element in `container`, see `ButtonBarControl`\n\t_createButton(container) {\n\t\tconst button = this._button = DomUtil.create('button', `maplair-control-button-button ${this.options.className}`, container);\n\t\tbutton.type = 'button';\n\t\tbutton.accessKey = this.options.accessKey;\n\n\t\tDomEvent.disableClickPropagation(button);\n\t\tDomEvent.on(button, 'click', DomEvent.stop);\n\t\tDomEvent.on(button, 'click', this._onClick, this);\n\t\tDomEvent.on(button, 'click', this._refocusOnMap, this);\n\n\t\tthis._update();\n\t\treturn button;\n\t}\n\n\t_onClick(e) {\n\t\tif (this._disabled) { return; }\n\t\t(this._state ?? this.options).onClick?.call(this, e, this, this._map);\n\t}\n\n\t_update() {\n\t\tif (!this._button) { return; }\n\t\tconst {content, title} = this._state ?? this.options,\n\t\tbutton = this._button;\n\n\t\tif (typeof content === 'string') {\n\t\t\tbutton.innerHTML = content;\n\t\t} else {\n\t\t\tbutton.replaceChildren(content);\n\t\t}\n\t\tconst key = button.accessKeyLabel || this.options.accessKey.toUpperCase();\n\t\tbutton.title = [title, key && `[${key}]`].filter(Boolean).join(' ');\n\t\tbutton.setAttribute('aria-label', title ?? '');\n\t\tif (this._state) {\n\t\t\tbutton.dataset.state = this._state.name;\n\t\t}\n\t\tbutton.classList.toggle('maplair-disabled', !!this._disabled);\n\t\tbutton.setAttribute('aria-disabled', !!this._disabled);\n\t}\n\n\t/**\n\t * Switches to the state with the given `name`, see the `states` option.\n\t * @param {string} name\n\t * @returns {this}\n\t */\n\tsetState(name) {\n\t\tconst state = this.options.states?.find(s => s.name === name);\n\t\tif (!state) {\n\t\t\tthrow new Error(`Unknown button state \"${name}\".`);\n\t\t}\n\t\tthis._state = state;\n\t\tthis._update();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the name of the current state, see the `states` option.\n\t * @returns {string|undefined}\n\t */\n\tgetState() {\n\t\treturn this._state?.name;\n\t}\n\n\t/**\n\t * Disables the button, so that clicking it does nothing.\n\t * @returns {this}\n\t */\n\tdisable() {\n\t\tthis._disabled = true;\n\t\tthis._update();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables the button again.\n\t * @returns {this}\n\t */\n\tenable() {\n\t\tthis._disabled = false;\n\t\tthis._update();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the button element.\n\t * @returns {HTMLElement}\n\t */\n\tgetButton() {\n\t\treturn this._button;\n\t}\n}\n\n/**\n * Groups several `ButtonControl`s in one bar, like the buttons of the zoom control.\n *\n * Inspired by the [Leaflet.EasyButton](https://github.com/CliffCloud/Leaflet.EasyButton) plugin.\n *\n * @example\n * ```js\n * new ButtonBarControl([\n * \tnew ButtonControl({content: 'A', title: 'First', onClick: () => {}}),\n * \tnew ButtonControl({content: 'B', title: 'Second', onClick: () => {}})\n * ]).addTo(map);\n * ```\n */\nexport class ButtonBarControl extends Control {\n\t/**\n\t * Creates a bar with the given buttons.\n\t * @param {ButtonControl[]} buttons\n\t * @param {ControlOptions} [options]\n\t */\n\tconstructor(buttons, options) {\n\t\tsuper(options);\n\t\tthis._buttons = buttons;\n\t\tthis.callInitHooks(ButtonBarControl);\n\t}\n\n\t/**\n\t * @internal\n\t * @param {MaplairMap} map\n\t * @returns {HTMLElement}\n\t */\n\tonAdd(map) {\n\t\tconst container = DomUtil.create('div', 'maplair-bar maplair-control-button-bar');\n\t\tfor (const button of this._buttons) {\n\t\t\tbutton._map = map;\n\t\t\tbutton._createButton(container);\n\t\t}\n\t\treturn container;\n\t}\n\n\t/** @internal */\n\tonRemove() {\n\t\tfor (const button of this._buttons) {\n\t\t\tbutton._map = null;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the buttons of the bar.\n\t * @returns {ButtonControl[]}\n\t */\n\tgetButtons() {\n\t\treturn this._buttons;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,IAAa,gBAAb,MAAa,sBAAsB,QAAQ;CAE1C,OAAO,iBAAiB;EACvB,UAAU;EACV,SAAS;EACT,OAAO;EACP,SAAS,KAAA;EACT,QAAQ,KAAA;EACR,WAAW;EACX,WAAW;CACZ;;;;;CAMA,YAAY,GAAG,MAAM;EACpB,MAAM,GAAG,IAAI;EACb,KAAK,SAAS,KAAK,QAAQ,SAAS;EACpC,KAAK,cAAc,aAAa;CACjC;;;;;CAMA,QAAQ;EACP,MAAM,YAAYA,OAAe,OAAO,oCAAoC;EAC5E,KAAK,cAAc,SAAS;EAC5B,OAAO;CACR;CAGA,cAAc,WAAW;EACxB,MAAM,SAAS,KAAK,UAAUA,OAAe,UAAU,iCAAiC,KAAK,QAAQ,aAAa,SAAS;EAC3H,OAAO,OAAO;EACd,OAAO,YAAY,KAAK,QAAQ;EAEhC,wBAAiC,MAAM;EACvC,GAAY,QAAQ,SAASC,IAAa;EAC1C,GAAY,QAAQ,SAAS,KAAK,UAAU,IAAI;EAChD,GAAY,QAAQ,SAAS,KAAK,eAAe,IAAI;EAErD,KAAK,QAAQ;EACb,OAAO;CACR;CAEA,SAAS,GAAG;EACX,IAAI,KAAK,WAAa;EACtB,CAAC,KAAK,UAAU,KAAK,QAAA,CAAS,SAAS,KAAK,MAAM,GAAG,MAAM,KAAK,IAAI;CACrE;CAEA,UAAU;EACT,IAAI,CAAC,KAAK,SAAW;EACrB,MAAM,EAAC,SAAS,UAAS,KAAK,UAAU,KAAK,SAC7C,SAAS,KAAK;EAEd,IAAI,OAAO,YAAY,UACtB,OAAO,YAAY;OAEnB,OAAO,gBAAgB,OAAO;EAE/B,MAAM,MAAM,OAAO,kBAAkB,KAAK,QAAQ,UAAU,YAAY;EACxE,OAAO,QAAQ,CAAC,OAAO,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAClE,OAAO,aAAa,cAAc,SAAS,EAAE;EAC7C,IAAI,KAAK,QACR,OAAO,QAAQ,QAAQ,KAAK,OAAO;EAEpC,OAAO,UAAU,OAAO,oBAAoB,CAAC,CAAC,KAAK,SAAS;EAC5D,OAAO,aAAa,iBAAiB,CAAC,CAAC,KAAK,SAAS;CACtD;;;;;;CAOA,SAAS,MAAM;EACd,MAAM,QAAQ,KAAK,QAAQ,QAAQ,MAAK,MAAK,EAAE,SAAS,IAAI;EAC5D,IAAI,CAAC,OACJ,MAAM,IAAI,MAAM,yBAAyB,KAAK,GAAG;EAElD,KAAK,SAAS;EACd,KAAK,QAAQ;EACb,OAAO;CACR;;;;;CAMA,WAAW;EACV,OAAO,KAAK,QAAQ;CACrB;;;;;CAMA,UAAU;EACT,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,OAAO;CACR;;;;;CAMA,SAAS;EACR,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,OAAO;CACR;;;;;CAMA,YAAY;EACX,OAAO,KAAK;CACb;AACD;;;;;;;;;;;;;;AAeA,IAAa,mBAAb,MAAa,yBAAyB,QAAQ;;;;;;CAM7C,YAAY,SAAS,SAAS;EAC7B,MAAM,OAAO;EACb,KAAK,WAAW;EAChB,KAAK,cAAc,gBAAgB;CACpC;;;;;;CAOA,MAAM,KAAK;EACV,MAAM,YAAYD,OAAe,OAAO,wCAAwC;EAChF,KAAK,MAAM,UAAU,KAAK,UAAU;GACnC,OAAO,OAAO;GACd,OAAO,cAAc,SAAS;EAC/B;EACA,OAAO;CACR;;CAGA,WAAW;EACV,KAAK,MAAM,UAAU,KAAK,UACzB,OAAO,OAAO;CAEhB;;;;;CAMA,aAAa;EACZ,OAAO,KAAK;CACb;AACD"}
|
|
@@ -3,7 +3,7 @@ import { Class } from "../core/Class.js";
|
|
|
3
3
|
import { disableClickPropagation, disableScrollPropagation, on, stop } from "../dom/DomEvent.js";
|
|
4
4
|
import { create } from "../dom/DomUtil.js";
|
|
5
5
|
import { Layer } from "../layer/Layer.js";
|
|
6
|
-
|
|
6
|
+
// src/control/ContextMenu.js
|
|
7
7
|
/** @import {MaplairMap} from '../map/Map.js' */
|
|
8
8
|
/** @import {LatLng} from '../geo/LatLng.js' */
|
|
9
9
|
/** @import {Point} from '../geometry/Point.js' */
|
|
@@ -54,9 +54,7 @@ import { Layer } from "../layer/Layer.js";
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
var ContextMenu = class ContextMenu extends Class {
|
|
57
|
-
static {
|
|
58
|
-
this.setDefaultOptions({ className: "" });
|
|
59
|
-
}
|
|
57
|
+
static defaultOptions = { className: "" };
|
|
60
58
|
/**
|
|
61
59
|
* Creates a context menu. Each item is an object with `text`, `callback` and the
|
|
62
60
|
* optional `disabled`, or `'-'` for a separator. The `callback` gets an event with
|
|
@@ -167,7 +165,6 @@ var ContextMenu = class ContextMenu extends Class {
|
|
|
167
165
|
buttons.at(next % buttons.length)?.focus();
|
|
168
166
|
}
|
|
169
167
|
};
|
|
170
|
-
//#endregion
|
|
171
168
|
export { ContextMenu };
|
|
172
169
|
|
|
173
170
|
//# sourceMappingURL=ContextMenu.js.map
|