maplair 4.0.0-alpha.2 → 4.1.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 +140 -38
- package/LICENSE +1 -1
- package/README.md +10 -9
- package/dist/esm/Maplair.js +14 -14
- package/dist/esm/control/AttributionControl.js +24 -14
- package/dist/esm/control/AttributionControl.js.map +1 -1
- package/dist/esm/control/ButtonControl.js +9 -11
- package/dist/esm/control/ButtonControl.js.map +1 -1
- package/dist/esm/control/ContextMenu.js +1 -3
- package/dist/esm/control/ContextMenu.js.map +1 -1
- package/dist/esm/control/Control.js +9 -16
- package/dist/esm/control/Control.js.map +1 -1
- package/dist/esm/control/FullscreenControl.js +5 -7
- package/dist/esm/control/FullscreenControl.js.map +1 -1
- package/dist/esm/control/LayersControl.js +144 -35
- package/dist/esm/control/LayersControl.js.map +1 -1
- package/dist/esm/control/LegendControl.js +7 -9
- package/dist/esm/control/LegendControl.js.map +1 -1
- package/dist/esm/control/MiniMapControl.js +14 -16
- package/dist/esm/control/MiniMapControl.js.map +1 -1
- package/dist/esm/control/RotateControl.js +1 -3
- package/dist/esm/control/RotateControl.js.map +1 -1
- package/dist/esm/control/ScaleControl.js +7 -9
- package/dist/esm/control/ScaleControl.js.map +1 -1
- package/dist/esm/control/SearchControl.js +100 -18
- package/dist/esm/control/SearchControl.js.map +1 -1
- package/dist/esm/control/SideBySideControl.js +1 -3
- package/dist/esm/control/SideBySideControl.js.map +1 -1
- package/dist/esm/control/TextControl.js +5 -7
- package/dist/esm/control/TextControl.js.map +1 -1
- package/dist/esm/control/TimeControl.js +408 -0
- package/dist/esm/control/TimeControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +5 -7
- package/dist/esm/control/ZoomControl.js.map +1 -1
- package/dist/esm/core/Class.js +28 -37
- package/dist/esm/core/Class.js.map +1 -1
- package/dist/esm/core/Events.js +21 -8
- package/dist/esm/core/Events.js.map +1 -1
- package/dist/esm/core/Handler.js +13 -11
- package/dist/esm/core/Handler.js.map +1 -1
- package/dist/esm/core/Util.js +13 -1
- package/dist/esm/core/Util.js.map +1 -1
- package/dist/esm/dom/DomEvent.DoubleTap.js +25 -22
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
- package/dist/esm/dom/DomEvent.PointerEvents.js +2 -16
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
- package/dist/esm/dom/DomEvent.js +8 -42
- package/dist/esm/dom/DomEvent.js.map +1 -1
- package/dist/esm/dom/DomUtil.js +14 -68
- package/dist/esm/dom/DomUtil.js.map +1 -1
- package/dist/esm/dom/Draggable.js +17 -18
- package/dist/esm/dom/Draggable.js.map +1 -1
- package/dist/esm/dom/PosAnimation.js +3 -25
- package/dist/esm/dom/PosAnimation.js.map +1 -1
- package/dist/esm/geo/LatLng.js +34 -6
- package/dist/esm/geo/LatLng.js.map +1 -1
- package/dist/esm/geo/LatLngBounds.js +19 -7
- package/dist/esm/geo/LatLngBounds.js.map +1 -1
- package/dist/esm/geo/crs/CRS.js +4 -3
- package/dist/esm/geo/crs/CRS.js.map +1 -1
- package/dist/esm/geo/crs/EPSG3395.js +1 -1
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
- package/dist/esm/geo/crs/EPSG3857.js +1 -1
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
- package/dist/esm/geo/crs/EPSG4326.js +1 -1
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
- package/dist/esm/geo/crs/EarthCRS.js +2 -2
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
- package/dist/esm/geo/crs/SimpleCRS.js +1 -1
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
- package/dist/esm/geo/projection/Projection.LonLat.js +3 -3
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -1
- package/dist/esm/geo/projection/Projection.Mercator.js +3 -3
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +3 -3
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -1
- package/dist/esm/geometry/Bounds.js +19 -7
- package/dist/esm/geometry/Bounds.js.map +1 -1
- package/dist/esm/geometry/LineUtil.js +36 -30
- package/dist/esm/geometry/LineUtil.js.map +1 -1
- package/dist/esm/geometry/Point.js +23 -5
- package/dist/esm/geometry/Point.js.map +1 -1
- package/dist/esm/geometry/PolyUtil.js +9 -28
- package/dist/esm/geometry/PolyUtil.js.map +1 -1
- package/dist/esm/layer/BlanketOverlay.js +6 -8
- package/dist/esm/layer/BlanketOverlay.js.map +1 -1
- package/dist/esm/layer/DivOverlay.js +15 -20
- package/dist/esm/layer/DivOverlay.js.map +1 -1
- package/dist/esm/layer/GeoJSON.js +9 -145
- package/dist/esm/layer/GeoJSON.js.map +1 -1
- package/dist/esm/layer/GeoJSONUtil.js +75 -0
- package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
- package/dist/esm/layer/HeatLayer.js +15 -17
- package/dist/esm/layer/HeatLayer.js.map +1 -1
- package/dist/esm/layer/ImageOverlay.js +20 -26
- package/dist/esm/layer/ImageOverlay.js.map +1 -1
- package/dist/esm/layer/Layer.js +8 -10
- package/dist/esm/layer/Layer.js.map +1 -1
- package/dist/esm/layer/LayerGroup.js +51 -0
- package/dist/esm/layer/LayerGroup.js.map +1 -1
- package/dist/esm/layer/Popup.js +27 -43
- package/dist/esm/layer/Popup.js.map +1 -1
- package/dist/esm/layer/SVGOverlay.js +2 -5
- package/dist/esm/layer/SVGOverlay.js.map +1 -1
- package/dist/esm/layer/Tooltip.js +15 -17
- package/dist/esm/layer/Tooltip.js.map +1 -1
- package/dist/esm/layer/VideoOverlay.js +12 -15
- package/dist/esm/layer/VideoOverlay.js.map +1 -1
- package/dist/esm/layer/marker/DefaultIcon.js +15 -48
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
- package/dist/esm/layer/marker/DivIcon.js +8 -10
- 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 +1 -1
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
- package/dist/esm/layer/marker/Marker.Move.js +2 -3
- package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
- package/dist/esm/layer/marker/Marker.js +63 -35
- package/dist/esm/layer/marker/Marker.js.map +1 -1
- package/dist/esm/layer/marker/MarkerClusterGroup.js +302 -0
- package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
- package/dist/esm/layer/marker/SvgIcon.js +6 -8
- package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
- package/dist/esm/layer/tile/GridLayer.js +86 -98
- package/dist/esm/layer/tile/GridLayer.js.map +1 -1
- package/dist/esm/layer/tile/TileLayer.js +28 -36
- package/dist/esm/layer/tile/TileLayer.js.map +1 -1
- package/dist/esm/layer/tile/WMSTileLayer.js +28 -23
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
- package/dist/esm/layer/vector/Canvas.js +1 -3
- package/dist/esm/layer/vector/Canvas.js.map +1 -1
- package/dist/esm/layer/vector/Circle.js +2 -2
- package/dist/esm/layer/vector/Circle.js.map +1 -1
- package/dist/esm/layer/vector/CircleMarker.js +17 -7
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
- package/dist/esm/layer/vector/Path.DashAnimation.js +2 -3
- package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
- package/dist/esm/layer/vector/Path.js +27 -20
- package/dist/esm/layer/vector/Path.js.map +1 -1
- package/dist/esm/layer/vector/Polygon.js +20 -4
- package/dist/esm/layer/vector/Polygon.js.map +1 -1
- package/dist/esm/layer/vector/Polyline.Decorations.js +2 -2
- package/dist/esm/layer/vector/Polyline.js +24 -8
- package/dist/esm/layer/vector/Polyline.js.map +1 -1
- package/dist/esm/layer/vector/Renderer.getRenderer.js +14 -13
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
- package/dist/esm/layer/vector/SVG.js +5 -5
- package/dist/esm/layer/vector/SVG.js.map +1 -1
- package/dist/esm/map/Map.Rotation.js +15 -11
- package/dist/esm/map/Map.Rotation.js.map +1 -1
- package/dist/esm/map/Map.js +135 -129
- package/dist/esm/map/Map.js.map +1 -1
- package/dist/esm/map/handler/BoxZoomHandler.js +5 -7
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/DisplaceHandler.js +6 -8
- package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
- package/dist/esm/map/handler/DragHandler.js +20 -20
- package/dist/esm/map/handler/DragHandler.js.map +1 -1
- package/dist/esm/map/handler/KeyboardHandler.js +37 -37
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
- package/dist/esm/map/handler/PinchZoomHandler.js +12 -3
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +3 -4
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
- package/dist/esm/map/handler/TapHoldHandler.js +12 -5
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
- package/dist/esm/package.js +1 -1
- package/dist/maplair-global-src.js +6326 -5625
- package/dist/maplair-global-src.js.map +1 -1
- package/dist/maplair-global.js +3 -3
- package/dist/maplair-global.js.map +1 -1
- package/dist/maplair-src.js +9010 -8290
- package/dist/maplair-src.js.map +1 -1
- package/dist/maplair.css +148 -98
- package/dist/maplair.js +3 -3
- 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 +12 -14
- 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 +159 -36
- 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 +104 -21
- 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 +5 -7
- package/src/control/index.js +1 -0
- package/src/core/Class.js +35 -34
- package/src/core/Events.js +22 -3
- package/src/core/Handler.js +14 -12
- package/src/core/Util.js +19 -1
- 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 +8 -66
- package/src/dom/DomUtil.js +22 -78
- package/src/dom/Draggable.js +27 -22
- package/src/dom/PosAnimation.js +3 -25
- package/src/dom/index.js +0 -1
- package/src/geo/LatLng.js +40 -4
- package/src/geo/LatLngBounds.js +20 -7
- package/src/geo/crs/CRS.js +4 -3
- package/src/geo/crs/EPSG3395.js +1 -1
- package/src/geo/crs/EPSG3857.js +1 -1
- package/src/geo/crs/EPSG4326.js +1 -1
- package/src/geo/crs/EarthCRS.js +2 -8
- package/src/geo/crs/SimpleCRS.js +1 -1
- package/src/geo/projection/Projection.LonLat.js +3 -3
- package/src/geo/projection/Projection.Mercator.js +3 -3
- package/src/geo/projection/Projection.SphericalMercator.js +3 -3
- package/src/geometry/Bounds.js +20 -7
- package/src/geometry/LineUtil.js +47 -48
- package/src/geometry/Point.js +24 -5
- package/src/geometry/PolyUtil.js +15 -44
- package/src/layer/BlanketOverlay.js +6 -10
- package/src/layer/DivOverlay.js +15 -26
- package/src/layer/GeoJSON.js +7 -205
- package/src/layer/GeoJSONUtil.js +85 -0
- package/src/layer/HeatLayer.js +9 -11
- package/src/layer/ImageOverlay.js +19 -30
- package/src/layer/Layer.js +8 -10
- package/src/layer/LayerGroup.js +71 -0
- package/src/layer/Popup.js +31 -46
- package/src/layer/SVGOverlay.js +1 -5
- package/src/layer/Tooltip.js +15 -19
- package/src/layer/VideoOverlay.js +12 -15
- package/src/layer/marker/DefaultIcon.js +15 -61
- package/src/layer/marker/DivIcon.js +10 -12
- package/src/layer/marker/Icon.js +9 -12
- package/src/layer/marker/Marker.Drag.js +1 -1
- package/src/layer/marker/Marker.Move.js +2 -3
- package/src/layer/marker/Marker.js +83 -41
- 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 +104 -134
- package/src/layer/tile/TileLayer.js +35 -43
- package/src/layer/tile/WMSTileLayer.js +26 -24
- package/src/layer/vector/Canvas.js +3 -5
- package/src/layer/vector/Circle.js +5 -2
- package/src/layer/vector/CircleMarker.js +17 -6
- package/src/layer/vector/Path.DashAnimation.js +1 -2
- package/src/layer/vector/Path.js +30 -21
- package/src/layer/vector/Polygon.js +28 -5
- package/src/layer/vector/Polyline.js +26 -7
- package/src/layer/vector/Renderer.getRenderer.js +17 -17
- package/src/layer/vector/SVG.js +5 -5
- package/src/map/Map.Rotation.js +19 -11
- package/src/map/Map.js +163 -154
- package/src/map/handler/BoxZoomHandler.js +9 -8
- package/src/map/handler/DisplaceHandler.js +6 -8
- package/src/map/handler/DragHandler.js +26 -29
- package/src/map/handler/KeyboardHandler.js +44 -50
- 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 +148 -98
- package/dist/esm/core/Browser.js +0 -100
- package/dist/esm/core/Browser.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/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,143 @@ Maplair Changelog
|
|
|
3
3
|
|
|
4
4
|
(all changes of Leaflet without author notice are by [@mourner](https://github.com/mourner))
|
|
5
5
|
|
|
6
|
-
## 4.
|
|
6
|
+
## 4.1.0 (2026-10-28)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
⚠️ Despite the minor version, this release contains breaking changes ported from Leaflet, see the refactorings below.
|
|
9
|
+
|
|
10
|
+
### Maplair
|
|
11
|
+
|
|
12
|
+
(changes without author notice are by [@simon04](https://github.com/simon04))
|
|
13
|
+
|
|
14
|
+
#### ❇️ New Features
|
|
15
|
+
|
|
16
|
+
* 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
|
|
17
|
+
* 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`
|
|
18
|
+
* Add `MarkerClusterGroup` clustering nearby markers, with zooming to and spiderfying clusters on click
|
|
19
|
+
* 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
|
|
20
|
+
* WMSTileLayer: swap the tiles without flickering on `setParams()`
|
|
21
|
+
* SearchControl: the option `marker` accepts a function returning the layer to show at the selected result, new options `clearOnMapClick` and `noResultsText`
|
|
22
|
+
* Export `LeafletMap` as an alias of `MaplairMap`, like `Map`, for compatibility with code written for Leaflet 2
|
|
23
|
+
|
|
24
|
+
### Leaflet, since the fork
|
|
25
|
+
|
|
26
|
+
Ported from Leaflet (changes without author notice are by [@mourner](https://github.com/mourner))
|
|
27
|
+
|
|
28
|
+
#### ✨ Refactorings (⚠️ Breaking Changes)
|
|
29
|
+
|
|
30
|
+
* Replace static blocks with `static defaultOptions`; `setDefaultOptions()` is a deprecated alias of `mergeOptions()` in https://github.com/Leaflet/Leaflet/pull/10432
|
|
31
|
+
* Throw on classes still defining `initialize()` (from https://github.com/Leaflet/Leaflet/pull/10433)
|
|
32
|
+
* 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
|
|
33
|
+
* Move `toGeoJSON()` into each layer class, available without importing `GeoJSON` in https://github.com/Leaflet/Leaflet/pull/10439
|
|
34
|
+
* Make `PosAnimation` internal in https://github.com/Leaflet/Leaflet/pull/10446
|
|
35
|
+
* Remove browser sniffing and the `Browser` namespace (`Browser.reducedMotion` is `DomUtil.reducedMotion`), enable `tapHold` everywhere in https://github.com/Leaflet/Leaflet/pull/10447
|
|
36
|
+
* 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
|
|
37
|
+
* Remove `DomUtil.preventOutline()` and `restoreOutline()`, `Draggable` takes options as its third argument in https://github.com/Leaflet/Leaflet/pull/10455
|
|
38
|
+
* 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
|
|
39
|
+
* Remove `DomEvent.PointerEvents.cleanupPointers()` in https://github.com/Leaflet/Leaflet/commit/cfae2c15eb66833f9260820e2d692e10f4a6c263
|
|
40
|
+
* Fix remaining side effects and import cycles in https://github.com/Leaflet/Leaflet/pull/10442
|
|
41
|
+
* Simplify some core code for a smaller bundle in https://github.com/Leaflet/Leaflet/pull/10452
|
|
42
|
+
* Simplify the center calculation of polylines and polygons in https://github.com/Leaflet/Leaflet/pull/10451
|
|
43
|
+
* Simplify `flyTo()` in https://github.com/Leaflet/Leaflet/commit/3dc172b57175994f152d6fe512b0131869ee30cb
|
|
44
|
+
* The global build has plain, patchable namespaces (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
45
|
+
* 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
|
|
46
|
+
* Stop restyling the whole page on map and marker drags, remove `DomUtil.disableTextSelection()` and `enableTextSelection()` in https://github.com/Leaflet/Leaflet/pull/10470
|
|
47
|
+
* 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
|
|
48
|
+
* Improve the keyboard accessibility of markers (Enter and Space click interactive markers), remove the `keypress` event in https://github.com/Leaflet/Leaflet/pull/10473
|
|
49
|
+
* Export `Map` as an alias of `MaplairMap` more idiomatically in https://github.com/Leaflet/Leaflet/commit/4bc93b605f043cb2ff6bbe0615c03109fd0b6723
|
|
50
|
+
|
|
51
|
+
#### 🐞 Bugfixes
|
|
52
|
+
|
|
53
|
+
* Load tiles during panning unless reduced motion is preferred in https://github.com/Leaflet/Leaflet/commit/2550ebfa7513ed65e8b6febb4be8d68992b847ec
|
|
54
|
+
* Fix the http to https upgrade of OSM URLs in https://github.com/Leaflet/Leaflet/pull/10444
|
|
55
|
+
* Read the Leaflet 1 option `bubblingMouseEvents`, log removed `mouse*` events once in https://github.com/Leaflet/Leaflet/commit/2cac72a01fe1b43eb158156bf10158877a9be716
|
|
56
|
+
* Fix seams between tiles when dragging the map in https://github.com/Leaflet/Leaflet/pull/10445
|
|
57
|
+
* 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
|
|
58
|
+
* 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
|
|
59
|
+
* Fix infinite loop in `clipSegment()` with fractional clip bounds by [@spokodev](https://github.com/spokodev) in https://github.com/Leaflet/Leaflet/pull/10284
|
|
60
|
+
* 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
|
|
61
|
+
* Fix map jumping when dragging after pointerdown during inertia by [@Yahiro025](https://github.com/Yahiro025) in https://github.com/Leaflet/Leaflet/pull/10386
|
|
62
|
+
* Fix small Circle radii coming out as ellipses by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10454
|
|
63
|
+
* Fix worldCopyJump throwing with an infinite CRS by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10453
|
|
64
|
+
* 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
|
|
65
|
+
* 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
|
|
66
|
+
* Keep dragging a marker when its icon is changed by [@haranishi](https://github.com/haranishi) in https://github.com/Leaflet/Leaflet/pull/10457
|
|
67
|
+
* Fix DOM API misuse in https://github.com/Leaflet/Leaflet/pull/10460
|
|
68
|
+
* Fix tiles, markers and tooltips being selectable in Safari in https://github.com/Leaflet/Leaflet/pull/10462
|
|
69
|
+
* Fix a small `flyTo()` glitch in https://github.com/Leaflet/Leaflet/commit/3a809320007a3cad0efd920c8216bdb11ff1988a
|
|
70
|
+
* Fix hover breaking on `bringToFront()` in Chrome in https://github.com/Leaflet/Leaflet/commit/0609413eb7f5d12e8dc59a15fd3058657c3897a0
|
|
71
|
+
* Fix page scrolling on map refocus in https://github.com/Leaflet/Leaflet/commit/dd71a7849294265140d5d32aebbb8e1ddc7de199
|
|
72
|
+
* Fix an edge case with a tiny box zoom in https://github.com/Leaflet/Leaflet/commit/a82d3832c9b803fdc74029ed6093c2dd924a64f6
|
|
73
|
+
* Fix VideoOverlay throwing when created from a video element by [@Enesuygurs](https://github.com/Enesuygurs) in https://github.com/Leaflet/Leaflet/pull/10464
|
|
74
|
+
* Fix the global build throwing without `navigator` (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
75
|
+
* Fix usability on maps with `zoomAnimation` disabled in https://github.com/Leaflet/Leaflet/pull/10465
|
|
76
|
+
* Avoid relayouts on wheel zoom and pinch zoom in https://github.com/Leaflet/Leaflet/commit/9c0cef035e695650964786af63f3222f42f15f1f and https://github.com/Leaflet/Leaflet/commit/0f8f2fb008900f05b5b614b6e76a2ea7a426eb9f
|
|
77
|
+
* Fix `toGeoJSON()` dropping MultiPoint members of a GeometryCollection by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10468
|
|
78
|
+
* Fix WMSTileLayer throwing on relative service URLs by [@nk-batman21](https://github.com/nk-batman21) in https://github.com/Leaflet/Leaflet/pull/10474
|
|
79
|
+
* 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
|
|
80
|
+
* Limit the destination of `flyTo()` to `maxBounds` by [@Don-Yin](https://github.com/Don-Yin) in https://github.com/Leaflet/Leaflet/pull/10477
|
|
81
|
+
* Fix a drag sometimes getting stuck after a quick pan outside the window in https://github.com/Leaflet/Leaflet/commit/cdff2a590004f604db7ef44f69b0ea02073cfea6
|
|
82
|
+
* 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
|
|
83
|
+
* 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
|
|
84
|
+
* Return the layer from `closeTooltip()`, fix `isTooltipOpen()` throwing without a bound tooltip in https://github.com/Leaflet/Leaflet/commit/7f89a0681e6e33e25edfefb1586cae7b42948e35
|
|
85
|
+
|
|
86
|
+
#### 📝 Docs
|
|
87
|
+
|
|
88
|
+
* Update leaflet.sidepanel plugin links by [@m-altaifi](https://github.com/m-altaifi) in https://github.com/Leaflet/Leaflet/pull/10389
|
|
89
|
+
* Fix accuracy radius in the mobile geolocation example by [@xvodddwannaG](https://github.com/xvodddwannaG) in https://github.com/Leaflet/Leaflet/pull/10332
|
|
90
|
+
* Evergreen language on zoom-levels and handlers tutorials by [@SatvikMishra08](https://github.com/SatvikMishra08) in https://github.com/Leaflet/Leaflet/pull/10398
|
|
91
|
+
* 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
|
|
92
|
+
* Fix missing front matter delimiter in city-autocomplete-usa.md by [@slbarriosdev](https://github.com/slbarriosdev) in https://github.com/Leaflet/Leaflet/pull/10258
|
|
93
|
+
* Fix spelling errors in Joomla plugin documentation by [@Fran-cruz](https://github.com/Fran-cruz) in https://github.com/Leaflet/Leaflet/pull/10298
|
|
94
|
+
* Remove `!important` in the CSS of the website in https://github.com/Leaflet/Leaflet/commit/e2036455408de5b6dc1e6c60f10888c1f34af49b
|
|
95
|
+
* Clarify the stacking of layers within a pane by [@VisakanM-bit](https://github.com/VisakanM-bit) in https://github.com/Leaflet/Leaflet/pull/10297
|
|
96
|
+
* Add the Leaflet WebGL Markers plugin by [@tang-tc](https://github.com/tang-tc) in https://github.com/Leaflet/Leaflet/pull/10349
|
|
97
|
+
* Add the PartiallyEditablePolyline plugin by [@hiroaki](https://github.com/hiroaki) in https://github.com/Leaflet/Leaflet/pull/10395
|
|
98
|
+
* Add the @s57-parser/leaflet plugin by [@devladpopov](https://github.com/devladpopov) in https://github.com/Leaflet/Leaflet/pull/10394
|
|
99
|
+
* Add the leaflet-daynight plugin by [@LoganD900](https://github.com/LoganD900) in https://github.com/Leaflet/Leaflet/pull/10388
|
|
100
|
+
* Add the Leaflet.GridLayer.Relief plugin by [@glandais](https://github.com/glandais) in https://github.com/Leaflet/Leaflet/pull/10348
|
|
101
|
+
* Update the maptiler-geocoding-control plugin for v2 by [@katemihalikova](https://github.com/katemihalikova) in https://github.com/Leaflet/Leaflet/pull/10195
|
|
102
|
+
* Add the Leaflet.WorldWrap plugin by [@EricDalnas](https://github.com/EricDalnas) in https://github.com/Leaflet/Leaflet/pull/10188
|
|
103
|
+
* 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
|
|
104
|
+
* 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
|
|
105
|
+
* Add the leaflet-floating-measure plugin by [@ringraham](https://github.com/ringraham) in https://github.com/Leaflet/Leaflet/pull/10345
|
|
106
|
+
|
|
107
|
+
#### 🔧 Workflow
|
|
108
|
+
|
|
109
|
+
* Consolidate CI jobs in https://github.com/Leaflet/Leaflet/commit/43f310b53c2632699f6a6a3679d14a3f717aacf8
|
|
110
|
+
* Report the bundle size in a tiny CI job in https://github.com/Leaflet/Leaflet/pull/10430
|
|
111
|
+
* Check the global build and the self-contained CSS in CI (from https://github.com/Leaflet/Leaflet/pull/10443)
|
|
112
|
+
* 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
|
|
113
|
+
* Remove the stale AMD debug page in https://github.com/Leaflet/Leaflet/commit/9adfc0ac0d3a62a5b4af292f637fcb15c5e534dd
|
|
114
|
+
* Remove CSS fallbacks and leftovers, explain the `!important` in https://github.com/Leaflet/Leaflet/pull/10462
|
|
115
|
+
* Build the website with a small Node script instead of Jekyll in https://github.com/Leaflet/Leaflet/pull/10484
|
|
116
|
+
|
|
117
|
+
#### 🧪 Tests
|
|
118
|
+
|
|
119
|
+
* Simplify, improve and speed up the test setup in https://github.com/Leaflet/Leaflet/pull/10463
|
|
120
|
+
* Add specs of the layer lifecycle and of extending layers (from https://github.com/Leaflet/Leaflet/pull/10441)
|
|
121
|
+
* 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
|
|
122
|
+
* Replace prosthetic-hand with a small built-in `Finger` helper in https://github.com/Leaflet/Leaflet/pull/10476
|
|
123
|
+
|
|
124
|
+
## 4.0.0 (2026-10-19) 🍁 Maplair, a fork of Leaflet
|
|
125
|
+
|
|
126
|
+
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.
|
|
127
|
+
|
|
128
|
+
For an overview and a migration guide from Leaflet 1.9.4, see the blog post: https://maplair.org/2026/10/19/maplair-4.0.0.html
|
|
129
|
+
|
|
130
|
+
### Maplair
|
|
9
131
|
|
|
10
132
|
(changes without author notice are by [@simon04](https://github.com/simon04))
|
|
11
133
|
|
|
12
134
|
#### ❇️ New Features
|
|
13
135
|
|
|
136
|
+
* Translations of the built-in strings with `I18n` (cherry-picked from https://github.com/Leaflet/Leaflet/pull/9845), translated on Transifex: https://app.transifex.com/simon04/maplair/
|
|
137
|
+
* Translations to German, Spanish, French, Czech, Slovak, Hungarian, Slovenian, Italian and Romansh
|
|
138
|
+
* Map: new option `markerCulling` to take markers far outside of the view off the page
|
|
139
|
+
* Marker: new option `shadow` to disable icon shadows for performance
|
|
140
|
+
* Publish one ES module per source file (`dist/esm`) and declare `sideEffects`, so that bundlers can drop unused features
|
|
141
|
+
* Bring back `L.noConflict()` in the global build `maplair-global.js`
|
|
142
|
+
* New logo, maple leaf marker icon with zigzag outline, and favicon
|
|
14
143
|
* Add `FullscreenControl` with `toggleFullscreen()`, `isFullscreen()` and the events `enterfullscreen`, `exitfullscreen` and `fullscreenchange`
|
|
15
144
|
* Add `SearchControl` with custom geocoders and `SearchControl.nominatim()`, complying with the Nominatim usage policy (`acceptUsagePolicy`)
|
|
16
145
|
* Add `ButtonControl`, `ButtonBarControl` and `TextControl`, and the Control option `order`
|
|
@@ -25,6 +154,7 @@ For an overview and a migration guide from Leaflet 1.9.4, see the blog post: htt
|
|
|
25
154
|
* Add `DisplaceHandler` for the displacement of overlapping circle markers
|
|
26
155
|
* Add `TapDragZoomHandler` to zoom by double tapping and dragging up/down
|
|
27
156
|
* Add `LatLng.parse()` for coordinates in decimal degrees and geo URIs
|
|
157
|
+
* Add `LatLng.from()`, `Point.from()`, `Bounds.from()` and `LatLngBounds.from()`, which return instances as they are, unlike the constructors
|
|
28
158
|
* Map: add rotation with `bearing`, `setBearing()`, `pinchRotate` and `RotateControl` (optional module `maplair/map-rotation`)
|
|
29
159
|
* Marker: add the options `rotationAngle` and `rotationOrigin` (optional module `maplair/marker-rotation`)
|
|
30
160
|
* Animate markers along routes with `moveTo()`/`moveAlong()` (optional module `maplair/marker-movement`) and dashes along paths with `dashSpeed` (optional module `maplair/dash-animation`)
|
|
@@ -47,42 +177,6 @@ For an overview and a migration guide from Leaflet 1.9.4, see the blog post: htt
|
|
|
47
177
|
* Use CSS variables for the colors, borders, shadows, fonts and spacing
|
|
48
178
|
* Ship TypeScript type declarations (`dist/types/`)
|
|
49
179
|
|
|
50
|
-
#### 🐞 Bugfixes
|
|
51
|
-
|
|
52
|
-
* TileLayer: with `detectRetina`, no longer request tiles beyond `maxNativeZoom`
|
|
53
|
-
* Release the pointer capture only if it is still active
|
|
54
|
-
|
|
55
|
-
#### 📝 Docs
|
|
56
|
-
|
|
57
|
-
* Replace Leafdoc with JSDoc, and generate the API reference from the type declarations
|
|
58
|
-
* Explain the name Maplair, mention tree-shaking and update the bundle sizes on the homepage
|
|
59
|
-
|
|
60
|
-
#### 🔧 Workflow
|
|
61
|
-
|
|
62
|
-
* Migrate from npm to pnpm 12, upgrade Vite+ to 1.3.0 and Vitest to 5.0.5
|
|
63
|
-
* Check that optional features are dropped by tree-shaking unless imported (`pnpm run test:tree-shaking`)
|
|
64
|
-
* Type-check the type declarations and the debug pages (`pnpm run types:check`)
|
|
65
|
-
|
|
66
|
-
## 4.0.0-alpha.1 (2026-10-15) 🍁 Maplair, a fork of Leaflet
|
|
67
|
-
|
|
68
|
-
The first pre-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.
|
|
69
|
-
|
|
70
|
-
For an overview and a migration guide from Leaflet 1.9.4, see the blog post: https://maplair.org/2026/10/17/maplair-4.0.0-alpha.2.html
|
|
71
|
-
|
|
72
|
-
### Maplair
|
|
73
|
-
|
|
74
|
-
(changes without author notice are by [@simon04](https://github.com/simon04))
|
|
75
|
-
|
|
76
|
-
#### ❇️ New Features
|
|
77
|
-
|
|
78
|
-
* Translations of the built-in strings with `I18n` (cherry-picked from https://github.com/Leaflet/Leaflet/pull/9845), translated on Transifex: https://app.transifex.com/simon04/maplair/
|
|
79
|
-
* Translations to German, Spanish, French, Czech, Slovak, Hungarian, Slovenian, Italian and Romansh
|
|
80
|
-
* Map: new option `markerCulling` to take markers far outside of the view off the page
|
|
81
|
-
* Marker: new option `shadow` to disable icon shadows for performance
|
|
82
|
-
* Publish one ES module per source file (`dist/esm`) and declare `sideEffects`, so that bundlers can drop unused features
|
|
83
|
-
* Bring back `L.noConflict()` in the global build `maplair-global.js`
|
|
84
|
-
* New logo, maple leaf marker icon with zigzag outline, and favicon
|
|
85
|
-
|
|
86
180
|
#### ✨ Refactorings (⚠️ Breaking Changes)
|
|
87
181
|
|
|
88
182
|
* Rename Leaflet to Maplair: npm package `maplair`, files `maplair*.js`/`maplair.css`, CSS classes `maplair-*`, `LeafletMap` to `MaplairMap`
|
|
@@ -102,11 +196,14 @@ For an overview and a migration guide from Leaflet 1.9.4, see the blog post: htt
|
|
|
102
196
|
* Popup: avoid a second forced layout when opening a popup
|
|
103
197
|
* Events: index listeners by function and context, and store them in Sets, so that adding and removing many layers isn't quadratic
|
|
104
198
|
* Skip unchanged transform and z-index style writes
|
|
199
|
+
* Don't copy points and bounds which are only read, e.g. in the projections and `Point#add()`
|
|
105
200
|
|
|
106
201
|
#### 🐞 Bugfixes
|
|
107
202
|
|
|
108
203
|
* DomEvent.stopPropagation: keep feature detection for DOM events of other windows (e.g. iframes)
|
|
109
204
|
* Fix the `Map.addInitHook` example in the controls tutorial
|
|
205
|
+
* TileLayer: with `detectRetina`, no longer request tiles beyond `maxNativeZoom`
|
|
206
|
+
* Release the pointer capture only if it is still active
|
|
110
207
|
|
|
111
208
|
#### 📝 Docs
|
|
112
209
|
|
|
@@ -115,12 +212,17 @@ For an overview and a migration guide from Leaflet 1.9.4, see the blog post: htt
|
|
|
115
212
|
* Credit major contributors in `CITATION.cff`, `package.json`, `README.md`, `LICENSE` and the website footer
|
|
116
213
|
* Document standard constructors, init hooks and translations
|
|
117
214
|
* Remove the Ukraine appeal, Leaflet's social media links and the "Trusted by the best" logos
|
|
215
|
+
* Replace Leafdoc with JSDoc, and generate the API reference from the type declarations
|
|
216
|
+
* Explain the name Maplair, mention tree-shaking and update the bundle sizes on the homepage
|
|
118
217
|
|
|
119
218
|
#### 🔧 Workflow
|
|
120
219
|
|
|
121
220
|
* Test, build, lint and run commit hooks with Vite+ (`vp test`, `vp pack`, `vp lint`, `vp staged`), replacing Vitest, Rollup, ESLint, husky and lint-staged
|
|
122
221
|
* Serve the debug pages with `vp dev`; remove bundlemon, `http-server` and `ssri`
|
|
123
222
|
* Upgrade `eslint-plugin-baseline-js` to 0.7.5, `@e18e/eslint-plugin` to 0.8.1 and Playwright to 1.64
|
|
223
|
+
* Migrate from npm to pnpm 12, upgrade Vite+ to 1.3.0 and Vitest to 5.0.5
|
|
224
|
+
* Check that optional features are dropped by tree-shaking unless imported (`pnpm run test:tree-shaking`)
|
|
225
|
+
* Type-check the type declarations and the debug pages (`pnpm run types:check`)
|
|
124
226
|
|
|
125
227
|
#### 🧪 Tests
|
|
126
228
|
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<img width="600" src="src/images/logo.svg" alt="Maplair" />
|
|
2
2
|
|
|
3
|
-
Maplair is
|
|
3
|
+
Maplair is an open-source JavaScript library for **building powerful interactive maps**, a fork of [Leaflet](https://leafletjs.com), the leading library for this.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Since Maplair supports tree-shaking, your bundler shakes off the leaves you don't use 🍁
|
|
6
|
+
A map with just a tile layer weighs about 34 kB of gzipped JS plus 5.3 kB of gzipped CSS code.
|
|
7
|
+
With everything included, about 63 kB of gzipped JS, it has all the mapping [features][] most developers ever need.
|
|
8
8
|
|
|
9
9
|
Maplair is designed with *simplicity*, *performance* and *usability* in mind.
|
|
10
10
|
It works efficiently across all major desktop and mobile platforms out of the box,
|
|
11
|
-
|
|
12
|
-
It
|
|
11
|
+
using only web features that are [Baseline Widely available](https://web.dev/baseline).
|
|
12
|
+
It is easy to [extend][],
|
|
13
13
|
has a beautiful, easy to use and [well-documented][] API
|
|
14
14
|
and a simple, readable [source code][] that is a joy to [contribute][] to.
|
|
15
15
|
|
|
@@ -23,16 +23,17 @@ and push the limits of what's possible with online maps!
|
|
|
23
23
|
|
|
24
24
|
## Authors
|
|
25
25
|
|
|
26
|
-
Maplair is
|
|
26
|
+
Maplair is developed by [Simon Legner](https://github.com/simon04)
|
|
27
|
+
as a fork of [Leaflet](https://leafletjs.com), created in 2010 by [Volodymyr Agafonkin](https://agafonkin.com).
|
|
27
28
|
Major contributors include Iván Sánchez Ortega, Dave Leaver, Yohan Boniface, Jon Koops,
|
|
28
|
-
Florian Bischof, Per Liedman
|
|
29
|
+
Florian Bischof, Per Liedman and John Firebaugh,
|
|
29
30
|
along with [hundreds of other contributors][contributors].
|
|
30
31
|
|
|
31
32
|
[](https://github.com/maplair/maplair/actions/workflows/main.yml)
|
|
32
33
|
|
|
33
34
|
[contributors]: https://github.com/maplair/maplair/graphs/contributors
|
|
34
35
|
[features]: https://maplair.org/#features
|
|
35
|
-
[
|
|
36
|
+
[extend]: https://maplair.org/examples/extending-1-classes/
|
|
36
37
|
[well-documented]: https://maplair.org/reference.html "Maplair API reference"
|
|
37
38
|
[source code]: https://github.com/maplair/maplair "Maplair GitHub repository"
|
|
38
39
|
[hosted on GitHub]: https://github.com/maplair/maplair
|
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,26 @@ 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";
|
|
25
28
|
import { Transformation } from "./geometry/Transformation.js";
|
|
26
29
|
import { EPSG3857, EPSG900913 } from "./geo/crs/EPSG3857.js";
|
|
27
|
-
import { PosAnimation } from "./dom/PosAnimation.js";
|
|
28
30
|
import { ZoomControl } from "./control/ZoomControl.js";
|
|
29
31
|
import { LayerGroup } from "./layer/LayerGroup.js";
|
|
30
32
|
import { FeatureGroup } from "./layer/FeatureGroup.js";
|
|
31
33
|
import { DivOverlay } from "./layer/DivOverlay.js";
|
|
32
34
|
import { Popup } from "./layer/Popup.js";
|
|
33
35
|
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
36
|
import { Handler } from "./core/Handler.js";
|
|
39
37
|
import { BoxZoomHandler } from "./map/handler/BoxZoomHandler.js";
|
|
40
38
|
import { DoubleClickZoomHandler } from "./map/handler/DoubleClickZoomHandler.js";
|
|
@@ -45,10 +43,9 @@ import { PinchZoomHandler } from "./map/handler/PinchZoomHandler.js";
|
|
|
45
43
|
import { ScrollWheelZoomHandler } from "./map/handler/ScrollWheelZoomHandler.js";
|
|
46
44
|
import { TapHoldHandler } from "./map/handler/TapHoldHandler.js";
|
|
47
45
|
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";
|
|
46
|
+
import { LeafletMap as MaplairMap } from "./map/Map.js";
|
|
51
47
|
import { Polyline } from "./layer/vector/Polyline.js";
|
|
48
|
+
import { PolyUtil_exports } from "./geometry/PolyUtil.js";
|
|
52
49
|
import { Polygon } from "./layer/vector/Polygon.js";
|
|
53
50
|
import { MiniMapControl } from "./control/MiniMapControl.js";
|
|
54
51
|
import { ScaleControl } from "./control/ScaleControl.js";
|
|
@@ -58,11 +55,11 @@ import { Marker } from "./layer/marker/Marker.js";
|
|
|
58
55
|
import { SearchControl } from "./control/SearchControl.js";
|
|
59
56
|
import { SideBySideControl } from "./control/SideBySideControl.js";
|
|
60
57
|
import { TextControl } from "./control/TextControl.js";
|
|
58
|
+
import { TimeControl } from "./control/TimeControl.js";
|
|
61
59
|
import { projection_exports } from "./geo/projection/index.js";
|
|
62
60
|
import { EPSG3395 } from "./geo/crs/EPSG3395.js";
|
|
63
61
|
import { EPSG4326 } from "./geo/crs/EPSG4326.js";
|
|
64
62
|
import { SimpleCRS } from "./geo/crs/SimpleCRS.js";
|
|
65
|
-
import { Circle } from "./layer/vector/Circle.js";
|
|
66
63
|
import { GeoJSON } from "./layer/GeoJSON.js";
|
|
67
64
|
import { Classification } from "./layer/Classification.js";
|
|
68
65
|
import { HeatLayer } from "./layer/HeatLayer.js";
|
|
@@ -71,9 +68,12 @@ import { VideoOverlay } from "./layer/VideoOverlay.js";
|
|
|
71
68
|
import { SVGOverlay } from "./layer/SVGOverlay.js";
|
|
72
69
|
import { DivIcon } from "./layer/marker/DivIcon.js";
|
|
73
70
|
import { SvgIcon } from "./layer/marker/SvgIcon.js";
|
|
71
|
+
import { MarkerClusterGroup } from "./layer/marker/MarkerClusterGroup.js";
|
|
74
72
|
import { GridLayer } from "./layer/tile/GridLayer.js";
|
|
75
73
|
import { TileLayer } from "./layer/tile/TileLayer.js";
|
|
76
74
|
import { WMSTileLayer } from "./layer/tile/WMSTileLayer.js";
|
|
75
|
+
import { Canvas } from "./layer/vector/Canvas.js";
|
|
76
|
+
import { Circle } from "./layer/vector/Circle.js";
|
|
77
77
|
import { Rectangle } from "./layer/vector/Rectangle.js";
|
|
78
78
|
import { Hash } from "./map/Hash.js";
|
|
79
79
|
import { MapSync } from "./map/MapSync.js";
|
|
@@ -85,6 +85,6 @@ import { DisplaceHandler, displace } from "./map/handler/DisplaceHandler.js";
|
|
|
85
85
|
*/
|
|
86
86
|
const version = version$1;
|
|
87
87
|
//#endregion
|
|
88
|
-
export { AttributionControl, BlanketOverlay, Bounds, BoxZoomHandler,
|
|
88
|
+
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, MaplairMap as Map, MapSync, MaplairMap, Marker, MarkerClusterGroup, MiniMapControl, Path, PinchZoomHandler, Point, PolyUtil_exports as PolyUtil, Polygon, Polyline, Popup, projection_exports as Projection, Rectangle, Renderer, SVG, SVGOverlay, ScaleControl, ScrollWheelZoomHandler, SearchControl, SideBySideControl, SimpleCRS, SvgIcon, TapDragZoomHandler, TapHoldHandler, TextControl, TileLayer, TimeControl, Tooltip, Transformation, Util_exports as Util, VideoOverlay, WMSTileLayer, ZoomControl, displace, version };
|
|
89
89
|
|
|
90
90
|
//# sourceMappingURL=Maplair.js.map
|
|
@@ -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.
|
|
@@ -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"}
|
|
@@ -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.
|
|
@@ -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"}
|
|
@@ -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
|