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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.js","names":[],"sources":["../../../../src/layer/marker/Marker.js"],"sourcesContent":["import {Layer} from '../Layer.js';\nimport {DefaultIcon} from './DefaultIcon.js';\nimport * as Util from '../../core/Util.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {Point} from '../../geometry/Point.js';\nimport * as DomUtil from '../../dom/DomUtil.js';\nimport * as DomEvent from '../../dom/DomEvent.js';\nimport {MarkerDrag} from './Marker.Drag.js';\n/** @import {Icon} from './Icon.js' */\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {PointExpression} from '../../geometry/Point.js' */\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {MaplairEvent} from '../../core/Events.js' */\n/** @import {InteractiveLayerOptions} from '../Layer.js' */\n\n/**\n * Options of `Marker`.\n * @typedef {object} MarkerOptions\n * @property {Icon} [icon=new DefaultIcon()] Icon instance to use for rendering the\n * marker. See [Icon documentation](#Icon) for details on how to customize the marker\n * icon. If not specified, a common instance of `DefaultIcon` is used.\n * @property {boolean} [keyboard=true] Whether the marker can be tabbed to with a keyboard\n * and clicked by pressing enter.\n * @property {string} [title=''] Text for the browser tooltip that appear on marker hover\n * (no tooltip by default).\n * [Useful for accessibility](https://maplair.org/examples/accessibility/#markers-must-be-labelled).\n * @property {string} [alt='Marker'] Text for the `alt` attribute of the icon image.\n * [Useful for accessibility](https://maplair.org/examples/accessibility/#markers-must-be-labelled).\n * @property {number} [zIndexOffset=0] By default, marker images zIndex is set\n * automatically based on its latitude. Use this option if you want to put the marker on\n * top of all others (or below), specifying a high value like `1000` (or high negative\n * value, respectively).\n * @property {number} [opacity=1] The opacity of the marker.\n * @property {boolean} [riseOnHover=false] If `true`, the marker will get on top of\n * others when you hover the pointer over it.\n * @property {number} [riseOffset=250] The z-index offset used for the `riseOnHover`\n * feature.\n * @property {string} [pane='markerPane'] `Map pane` where the markers icon will be added.\n * @property {string} [shadowPane='shadowPane'] `Map pane` where the markers shadow will\n * be added.\n * @property {boolean} [shadow=true] Whether to show the shadow of the marker's icon. Each\n * shadow is an additional element on the page, so disabling shadows noticeably reduces\n * the browser's rendering work when showing many markers (e.g. several thousands),\n * especially while panning and zooming. To disable shadows for all markers, use\n * `Marker.mergeOptions({shadow: false})`.\n * @property {boolean} [bubblingPointerEvents=false] When `true`, a pointer event on this\n * marker will trigger the same event on the map (unless\n * [`DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n * @property {boolean} [autoPanOnFocus=true] When `true`, the map will pan whenever the\n * marker is focused (via e.g. pressing `tab` on the keyboard) to ensure the marker is\n * visible within the map's bounds.\n * @property {boolean} [draggable=false] Whether the marker is draggable with pointer or\n * not.\n * @property {boolean} [autoPan=false] Whether to pan the map when dragging this marker\n * near its edge or not.\n * @property {PointExpression} [autoPanPadding=[50, 50]] Distance (in pixels to the\n * left/right and to the top/bottom) of the map edge to start panning the map.\n * @property {number} [autoPanSpeed=10] Number of pixels the map should pan by.\n * @extends InteractiveLayerOptions\n */\n\n/**\n * The event object of `move` and `drag` of markers.\n * @typedef {object} MarkerMoveEvent\n * @property {LatLng} latlng The new position of the marker.\n * @property {LatLng} [oldLatLng] The previous position of the marker.\n * @extends MaplairEvent\n */\n\n/**\n * Marker is used to display clickable/draggable icons on the map. Extends `Layer`.\n *\n * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and\n * [popup methods](#Popup) like `bindPopup()` you can also use the methods below.\n *\n * @example\n * ```js\n * new Marker([50.5, 30.5]).addTo(map);\n * ```\n *\n * @fires move {MarkerMoveEvent} Fired when the marker is moved via\n * [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new\n * coordinates are included in event arguments as `oldLatLng`, `latlng`.\n */\nexport class Marker extends Layer {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\ticon: new DefaultIcon(),\n\n\t\t\t// Option inherited from \"Interactive layer\" abstract class\n\t\t\tinteractive: true,\n\n\t\t\tkeyboard: true,\n\t\t\ttitle: '',\n\t\t\talt: 'Marker',\n\t\t\tzIndexOffset: 0,\n\t\t\topacity: 1,\n\t\t\triseOnHover: false,\n\t\t\triseOffset: 250,\n\t\t\tpane: 'markerPane',\n\t\t\tshadowPane: 'shadowPane',\n\t\t\tshadow: true,\n\t\t\tbubblingPointerEvents: false,\n\t\t\tautoPanOnFocus: true,\n\t\t\tdraggable: false,\n\t\t\tautoPan: false,\n\t\t\tautoPanPadding: [50, 50],\n\t\t\tautoPanSpeed: 10\n\t\t});\n\t}\n\n\t/**\n\t * Instantiates a Marker object given a geographical point and optionally an options\n\t * object.\n\t * @param {LatLngExpression} latlng\n\t * @param {MarkerOptions} [options]\n\t */\n\tconstructor(latlng, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._latlng = new LatLng(latlng);\n\n\t\tthis.callInitHooks(Marker);\n\t}\n\n\t/**\n\t * Adds the icon (and shadow) of the marker to the map.\n\t * @param {MaplairMap} map\n\t */\n\tonAdd(map) {\n\t\tthis._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\n\n\t\tif (this._zoomAnimated) {\n\t\t\tmap.on('zoomanim', this._animateZoom, this);\n\t\t}\n\n\t\tthis._initIcon();\n\t\tthis.update();\n\n\t\tif (map.options.markerCulling) {\n\t\t\tthis._updateCulling();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the icon (and shadow) of the marker from the map.\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tif (this.dragging?.enabled()) {\n\t\t\tthis.options.draggable = true;\n\t\t\tthis.dragging.removeHooks();\n\t\t}\n\t\tdelete this.dragging;\n\n\t\tif (this._zoomAnimated) {\n\t\t\tmap.off('zoomanim', this._animateZoom, this);\n\t\t}\n\n\t\tthis._removeIcon();\n\t\tthis._removeShadow();\n\t\tthis._culled = false;\n\t}\n\n\t/**\n\t * Returns the map events the marker listens to, see `Layer`.\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\tconst events = {\n\t\t\tzoom: this.update,\n\t\t\tviewreset: this.update\n\t\t};\n\t\tif (this._map?.options.markerCulling) {\n\t\t\tevents.moveend = this._updateCulling;\n\t\t}\n\t\treturn events;\n\t}\n\n\t/**\n\t * Returns the current geographical position of the marker.\n\t * @returns {LatLng}\n\t */\n\tgetLatLng() {\n\t\treturn this._latlng;\n\t}\n\n\t/**\n\t * Changes the marker position to the given point.\n\t * @param {LatLngExpression} latlng\n\t * @returns {this}\n\t */\n\tsetLatLng(latlng) {\n\t\tconst oldLatLng = this._latlng;\n\t\tthis._latlng = new LatLng(latlng);\n\t\tif (this._map?.options.markerCulling) {\n\t\t\tthis._updateCulling();\n\t\t}\n\t\tthis.update();\n\n\t\treturn this.fire('move', {oldLatLng, latlng: this._latlng});\n\t}\n\n\t/**\n\t * Changes the [zIndex offset](#markeroptions-zindexoffset) of the marker.\n\t * @param {number} offset\n\t * @returns {this}\n\t */\n\tsetZIndexOffset(offset) {\n\t\tthis.options.zIndexOffset = offset;\n\t\treturn this.update();\n\t}\n\n\t/**\n\t * Returns the current icon used by the marker.\n\t * @returns {Icon}\n\t */\n\tgetIcon() {\n\t\treturn this.options.icon;\n\t}\n\n\t/**\n\t * Changes the marker icon.\n\t * @param {Icon} icon\n\t * @returns {this}\n\t */\n\tsetIcon(icon) {\n\n\t\tthis.options.icon = icon;\n\n\t\tif (this._map) {\n\t\t\tthis._initIcon();\n\t\t\tthis.update();\n\t\t}\n\n\t\tif (this._popup) {\n\t\t\tthis.bindPopup(this._popup, this._popup.options);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the instance of [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)\n\t * used by Marker layer.\n\t * @returns {HTMLElement}\n\t */\n\tgetElement() {\n\t\treturn this._icon;\n\t}\n\n\t/**\n\t * Updates the position of the marker on the map, e.g. after a change of its options.\n\t * @returns {this}\n\t */\n\tupdate() {\n\n\t\tif (this._icon && this._map && !this._culled) {\n\t\t\tconst pos = this._map.latLngToLayerPoint(this._latlng).round();\n\t\t\tthis._setPos(pos);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t_initIcon() {\n\t\tconst options = this.options,\n\t\tclassToAdd = `maplair-zoom-${this._zoomAnimated ? 'animated' : 'hide'}`;\n\n\t\tconst icon = options.icon.createIcon(this._icon);\n\t\tlet addIcon = false;\n\n\t\t// if we're not reusing the icon, remove the old one and init new one\n\t\tif (icon !== this._icon) {\n\t\t\tif (this._icon) {\n\t\t\t\tthis._removeIcon();\n\t\t\t}\n\t\t\taddIcon = true;\n\n\t\t\tif (options.title) {\n\t\t\t\ticon.title = options.title;\n\t\t\t}\n\n\t\t\tif (icon.tagName === 'IMG') {\n\t\t\t\ticon.alt = options.alt ?? '';\n\t\t\t}\n\t\t}\n\n\t\ticon.classList.add(classToAdd);\n\n\t\tif (options.keyboard) {\n\t\t\ticon.tabIndex = '0';\n\t\t\ticon.setAttribute('role', 'button');\n\t\t}\n\n\t\tthis._icon = icon;\n\n\t\tif (options.riseOnHover) {\n\t\t\tthis.on({\n\t\t\t\tpointerover: this._bringToFront,\n\t\t\t\tpointerout: this._resetZIndex\n\t\t\t});\n\t\t}\n\n\t\tif (this.options.autoPanOnFocus) {\n\t\t\tDomEvent.on(icon, 'focus', this._panOnFocus, this);\n\t\t}\n\n\t\tconst newShadow = options.shadow ? options.icon.createShadow(this._shadow) : null;\n\t\tlet addShadow = false;\n\n\t\tif (newShadow !== this._shadow) {\n\t\t\tthis._removeShadow();\n\t\t\taddShadow = true;\n\t\t}\n\n\t\tif (newShadow) {\n\t\t\tnewShadow.classList.add(classToAdd);\n\t\t\tnewShadow.alt = '';\n\t\t}\n\t\tthis._shadow = newShadow;\n\n\n\t\tif (options.opacity < 1) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\n\t\tif (addIcon) {\n\t\t\tthis.getPane().appendChild(this._icon);\n\t\t}\n\t\tthis._initInteraction();\n\t\tif (newShadow && addShadow) {\n\t\t\tthis.getPane(options.shadowPane).appendChild(this._shadow);\n\t\t}\n\t}\n\n\t_removeIcon() {\n\t\tif (this.options.riseOnHover) {\n\t\t\tthis.off({\n\t\t\t\tpointerover: this._bringToFront,\n\t\t\t\tpointerout: this._resetZIndex\n\t\t\t});\n\t\t}\n\n\t\tif (this.options.autoPanOnFocus) {\n\t\t\tDomEvent.off(this._icon, 'focus', this._panOnFocus, this);\n\t\t}\n\n\t\tthis._icon.remove();\n\t\tthis.removeInteractiveTarget(this._icon);\n\n\t\tthis._icon = null;\n\t}\n\n\t// With the map's `markerCulling` option, takes the icon and shadow of a marker\n\t// far outside of the map view off the page (and puts them back when needed),\n\t// so that the browser doesn't need to render, and the marker doesn't need\n\t// to reposition, them while panning and zooming.\n\t_updateCulling() {\n\t\tif (!this._icon || !this._map) { return; }\n\n\t\tconst visible = this._map.getBounds().pad(0.5).contains(this._latlng) ||\n\t\t\t!!this.dragging?._draggable?._moving ||\n\t\t\tthis._icon.contains(document.activeElement);\n\n\t\tif (visible === !this._culled) { return; }\n\t\tthis._culled = !visible;\n\n\t\tif (visible) {\n\t\t\tthis.getPane().appendChild(this._icon);\n\t\t\tif (this._shadow) {\n\t\t\t\tthis.getPane(this.options.shadowPane).appendChild(this._shadow);\n\t\t\t}\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis._icon.remove();\n\t\t\tthis._shadow?.remove();\n\t\t}\n\t}\n\n\t_removeShadow() {\n\t\tthis._shadow?.remove();\n\t\tthis._shadow = null;\n\t}\n\n\t_setPos(pos) {\n\n\t\tif (this._icon) {\n\t\t\tDomUtil.setPosition(this._icon, pos);\n\t\t}\n\n\t\tif (this._shadow) {\n\t\t\tDomUtil.setPosition(this._shadow, pos);\n\t\t}\n\n\t\tthis._zIndex = pos.y + this.options.zIndexOffset;\n\n\t\tthis._resetZIndex();\n\t}\n\n\t_updateZIndex(offset) {\n\t\tconst zIndex = String(this._zIndex + offset);\n\t\tif (this._icon && this._icon.style.zIndex !== zIndex) {\n\t\t\tthis._icon.style.zIndex = zIndex;\n\t\t}\n\t}\n\n\t_animateZoom(opt) {\n\t\tif (this._culled) { return; }\n\t\tconst pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();\n\n\t\tthis._setPos(pos);\n\t}\n\n\t_updateInteractive() {\n\t\tif (!this._icon) { return; }\n\t\tif (this.options.interactive) {\n\t\t\tthis._initInteraction();\n\t\t\tif (this._draggableBeforeNonInteractive) {\n\t\t\t\tthis.dragging?.enable();\n\t\t\t}\n\t\t} else {\n\t\t\tthis._icon.classList.remove('maplair-interactive');\n\t\t\tthis.removeInteractiveTarget(this._icon);\n\t\t\tthis._draggableBeforeNonInteractive = this.dragging?.enabled();\n\t\t\tthis.dragging?.disable();\n\t\t}\n\t}\n\n\t_initInteraction() {\n\n\t\tif (!this.options.interactive) { return; }\n\n\t\tthis._icon.classList.add('maplair-interactive');\n\n\t\tthis.addInteractiveTarget(this._icon);\n\n\t\tif (MarkerDrag) {\n\t\t\tlet draggable = this.options.draggable;\n\t\t\tif (this.dragging) {\n\t\t\t\tdraggable = this.dragging.enabled();\n\t\t\t\tthis.dragging.disable();\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Marker dragging handler, see `Handler`. Only valid when the marker is on the\n\t\t\t * map (otherwise set [`marker.options.draggable`](#markeroptions-draggable)).\n\t\t\t *\n\t\t\t * Interaction handlers are properties of a marker instance that allow you to\n\t\t\t * control interaction behavior in runtime, enabling or disabling certain\n\t\t\t * features such as dragging (see `Handler` methods). Example:\n\t\t\t *\n\t\t\t * ```js\n\t\t\t * marker.dragging.disable();\n\t\t\t * ```\n\t\t\t * @group Interaction handlers\n\t\t\t * @type {MarkerDrag}\n\t\t\t */\n\t\t\tthis.dragging = new MarkerDrag(this);\n\n\t\t\tif (draggable) {\n\t\t\t\tthis.dragging.enable();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Changes the opacity of the marker.\n\t * @param {number} opacity\n\t * @returns {this}\n\t */\n\tsetOpacity(opacity) {\n\t\tthis.options.opacity = opacity;\n\t\tif (this._map) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t_updateOpacity() {\n\t\tconst opacity = this.options.opacity;\n\n\t\tif (this._icon) {\n\t\t\tthis._icon.style.opacity = opacity;\n\t\t}\n\n\t\tif (this._shadow) {\n\t\t\tthis._shadow.style.opacity = opacity;\n\t\t}\n\t}\n\n\t_bringToFront() {\n\t\tthis._updateZIndex(this.options.riseOffset);\n\t}\n\n\t_resetZIndex() {\n\t\tthis._updateZIndex(0);\n\t}\n\n\t_panOnFocus() {\n\t\tconst map = this._map;\n\t\tif (!map) { return; }\n\n\t\tconst iconOpts = this.options.icon.options;\n\t\tconst size = iconOpts.iconSize ? Point.from(iconOpts.iconSize) : new Point(0, 0);\n\t\tconst anchor = iconOpts.iconAnchor ? Point.from(iconOpts.iconAnchor) : new Point(0, 0);\n\n\t\tmap.panInside(this._latlng, {\n\t\t\tpaddingTopLeft: anchor,\n\t\t\tpaddingBottomRight: size.subtract(anchor)\n\t\t});\n\t}\n\n\t_getPopupAnchor() {\n\t\treturn this.options.icon.options.popupAnchor;\n\t}\n\n\t_getTooltipAnchor() {\n\t\treturn this.options.icon.options.tooltipAnchor;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoFA,IAAa,SAAb,MAAa,eAAe,MAAM;CAEjC;EACC,KAAK,kBAAkB;GACtB,MAAM,IAAI,YAAY;GAGtB,aAAa;GAEb,UAAU;GACV,OAAO;GACP,KAAK;GACL,cAAc;GACd,SAAS;GACT,aAAa;GACb,YAAY;GACZ,MAAM;GACN,YAAY;GACZ,QAAQ;GACR,uBAAuB;GACvB,gBAAgB;GAChB,WAAW;GACX,SAAS;GACT,gBAAgB,CAAC,IAAI,EAAE;GACvB,cAAc;EACf,CAAC;CACF;;;;;;;CAQA,YAAY,QAAQ,SAAS;EAC5B,MAAM;EACN,WAAgB,MAAM,OAAO;EAC7B,KAAK,UAAU,IAAI,OAAO,MAAM;EAEhC,KAAK,cAAc,MAAM;CAC1B;;;;;CAMA,MAAM,KAAK;EACV,KAAK,gBAAgB,KAAK,iBAAiB,IAAI,QAAQ;EAEvD,IAAI,KAAK,eACR,IAAI,GAAG,YAAY,KAAK,cAAc,IAAI;EAG3C,KAAK,UAAU;EACf,KAAK,OAAO;EAEZ,IAAI,IAAI,QAAQ,eACf,KAAK,eAA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AAI,MAAM,GAAG,CAAC;EAErF,IAAI,UAAU,KAAK,SAAS;GAC3B,gBAAgB;GAChB,oBAAoB,KAAK,SAAS,MAAM;EACzC,CAAC;CACF;CAEA,kBAAkB;EACjB,OAAO,KAAK,QAAQ,KAAK,QAAQ;CAClC;CAEA,oBAAoB;EACnB,OAAO,KAAK,QAAQ,KAAK,QAAQ;CAClC;AACD"}
|
|
1
|
+
{"version":3,"file":"Marker.js","names":["DomUtil.getPosition"],"sources":["../../../../src/layer/marker/Marker.js"],"sourcesContent":["import {Layer} from '../Layer.js';\nimport {DefaultIcon} from './DefaultIcon.js';\nimport * as Util from '../../core/Util.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {Point} from '../../geometry/Point.js';\nimport * as DomUtil from '../../dom/DomUtil.js';\nimport * as DomEvent from '../../dom/DomEvent.js';\nimport {MarkerDrag} from './Marker.Drag.js';\nimport {pointToGeoJSON} from '../GeoJSONUtil.js';\n/** @import {Feature} from 'geojson' */\n/** @import {Icon} from './Icon.js' */\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {PointExpression} from '../../geometry/Point.js' */\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {MaplairEvent} from '../../core/Events.js' */\n/** @import {InteractiveLayerOptions} from '../Layer.js' */\n\n/**\n * Options of `Marker`.\n * @typedef {object} MarkerOptions\n * @property {Icon} [icon=new DefaultIcon()] Icon instance to use for rendering the\n * marker. See [Icon documentation](#Icon) for details on how to customize the marker\n * icon. If not specified, a common instance of `DefaultIcon` is used.\n * @property {boolean} [keyboard=true] Whether the marker can be tabbed to with a keyboard\n * and, if interactive, clicked by pressing Enter or Space.\n * @property {string} [title=''] Text for the browser tooltip that appear on marker hover\n * (no tooltip by default).\n * [Useful for accessibility](https://maplair.org/examples/accessibility/#markers-must-be-labelled).\n * @property {string} [alt='Marker'] Text for the `alt` attribute of the icon image.\n * [Useful for accessibility](https://maplair.org/examples/accessibility/#markers-must-be-labelled).\n * @property {number} [zIndexOffset=0] By default, marker images zIndex is set\n * automatically based on its latitude. Use this option if you want to put the marker on\n * top of all others (or below), specifying a high value like `1000` (or high negative\n * value, respectively).\n * @property {number} [opacity=1] The opacity of the marker.\n * @property {number|null} [rotation=null] Rotation of the marker icon in degrees,\n * clockwise, around the icon anchor, e.g. for the heading of a vehicle. A rotated\n * marker, even at 0°, has no shadow, since the shadow of an upright pin looks wrong\n * under a tilted one. `null` means no rotation.\n * @property {boolean} [riseOnHover=false] If `true`, the marker will get on top of\n * others when you hover the pointer over it.\n * @property {number} [riseOffset=250] The z-index offset used for the `riseOnHover`\n * feature.\n * @property {string} [pane='markerPane'] `Map pane` where the markers icon will be added.\n * @property {string} [shadowPane='shadowPane'] `Map pane` where the markers shadow will\n * be added.\n * @property {boolean} [shadow=true] Whether to show the shadow of the marker's icon. Each\n * shadow is an additional element on the page, so disabling shadows noticeably reduces\n * the browser's rendering work when showing many markers (e.g. several thousands),\n * especially while panning and zooming. To disable shadows for all markers, use\n * `Marker.mergeOptions({shadow: false})`.\n * @property {boolean} [bubblingPointerEvents=false] When `true`, a pointer event on this\n * marker will trigger the same event on the map (unless\n * [`DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n * @property {boolean} [autoPanOnFocus=true] When `true`, the map will pan whenever the\n * marker is focused (via e.g. pressing `tab` on the keyboard) to ensure the marker is\n * visible within the map's bounds.\n * @property {boolean} [draggable=false] Whether the marker is draggable with pointer or\n * not. A focused draggable marker can also be moved with the arrow keys, by 10 pixels\n * or 30 with Shift.\n * @property {boolean} [autoPan=false] Whether to pan the map when dragging this marker\n * near its edge or not.\n * @property {PointExpression} [autoPanPadding=[50, 50]] Distance (in pixels to the\n * left/right and to the top/bottom) of the map edge to start panning the map.\n * @property {number} [autoPanSpeed=10] Number of pixels the map should pan by.\n * @extends InteractiveLayerOptions\n */\n\n/**\n * The event object of `move` and `drag` of markers.\n * @typedef {object} MarkerMoveEvent\n * @property {LatLng} latlng The new position of the marker.\n * @property {LatLng} [oldLatLng] The previous position of the marker.\n * @extends MaplairEvent\n */\n\n/**\n * Marker is used to display clickable/draggable icons on the map. Extends `Layer`.\n *\n * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and\n * [popup methods](#Popup) like `bindPopup()` you can also use the methods below.\n *\n * @example\n * ```js\n * new Marker([50.5, 30.5]).addTo(map);\n * ```\n *\n * @fires move {MarkerMoveEvent} Fired when the marker is moved via\n * [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new\n * coordinates are included in event arguments as `oldLatLng`, `latlng`.\n */\nexport class Marker extends Layer {\n\n\tstatic defaultOptions = {\n\t\ticon: /* @__PURE__ */ new DefaultIcon(),\n\n\t\t// Option inherited from \"Interactive layer\" abstract class\n\t\tinteractive: true,\n\n\t\tkeyboard: true,\n\t\ttitle: '',\n\t\talt: 'Marker',\n\t\tzIndexOffset: 0,\n\t\topacity: 1,\n\t\trotation: null,\n\t\triseOnHover: false,\n\t\triseOffset: 250,\n\t\tpane: 'markerPane',\n\t\tshadowPane: 'shadowPane',\n\t\tshadow: true,\n\t\tbubblingPointerEvents: false,\n\t\tautoPanOnFocus: true,\n\t\tdraggable: false,\n\t\tautoPan: false,\n\t\tautoPanPadding: [50, 50],\n\t\tautoPanSpeed: 10\n\t};\n\n\t/**\n\t * Instantiates a Marker object given a geographical point and optionally an options\n\t * object.\n\t * @param {LatLngExpression} latlng\n\t * @param {MarkerOptions} [options]\n\t */\n\tconstructor(latlng, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._latlng = new LatLng(latlng);\n\n\t\tthis.callInitHooks(Marker);\n\t}\n\n\t/**\n\t * Adds the icon (and shadow) of the marker to the map.\n\t * @param {MaplairMap} map\n\t */\n\tonAdd(map) {\n\t\tthis._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\n\n\t\tif (this._zoomAnimated) {\n\t\t\tmap.on('zoomanim', this._animateZoom, this);\n\t\t}\n\n\t\tthis._initIcon();\n\t\tthis.update();\n\n\t\tif (map.options.markerCulling) {\n\t\t\tthis._updateCulling();\n\t\t}\n\t}\n\n\t/**\n\t * Removes the icon (and shadow) of the marker from the map.\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tif (this.dragging) {\n\t\t\t// remember whether dragging is on or off (`dragging.disable()`) for when the marker is added again\n\t\t\tthis.options.draggable = this.dragging.enabled();\n\t\t\tif (this.options.draggable) { this.dragging.removeHooks(); }\n\t\t}\n\t\tdelete this.dragging;\n\n\t\tif (this._zoomAnimated) {\n\t\t\tmap.off('zoomanim', this._animateZoom, this);\n\t\t}\n\n\t\tthis._removeIcon();\n\t\tthis._removeShadow();\n\t\tthis._culled = false;\n\t}\n\n\t/**\n\t * Returns the map events the marker listens to, see `Layer`.\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\tconst events = {\n\t\t\tzoom: this.update,\n\t\t\tviewreset: this.update\n\t\t};\n\t\tif (this._map?.options.markerCulling) {\n\t\t\tevents.moveend = this._updateCulling;\n\t\t}\n\t\treturn events;\n\t}\n\n\t/**\n\t * Returns the current geographical position of the marker.\n\t * @returns {LatLng}\n\t */\n\tgetLatLng() {\n\t\treturn this._latlng;\n\t}\n\n\t/**\n\t * Changes the marker position to the given point.\n\t * @param {LatLngExpression} latlng\n\t * @returns {this}\n\t */\n\tsetLatLng(latlng) {\n\t\tconst oldLatLng = this._latlng;\n\t\tthis._latlng = new LatLng(latlng);\n\t\tif (this._map?.options.markerCulling) {\n\t\t\tthis._updateCulling();\n\t\t}\n\t\tthis.update();\n\n\t\treturn this.fire('move', {oldLatLng, latlng: this._latlng});\n\t}\n\n\t/**\n\t * Changes the [zIndex offset](#markeroptions-zindexoffset) of the marker.\n\t * @param {number} offset\n\t * @returns {this}\n\t */\n\tsetZIndexOffset(offset) {\n\t\tthis.options.zIndexOffset = offset;\n\t\treturn this.update();\n\t}\n\n\t/**\n\t * Returns the current icon used by the marker.\n\t * @returns {Icon}\n\t */\n\tgetIcon() {\n\t\treturn this.options.icon;\n\t}\n\n\t/**\n\t * Changes the marker icon.\n\t * @param {Icon} icon\n\t * @returns {this}\n\t */\n\tsetIcon(icon) {\n\n\t\tthis.options.icon = icon;\n\n\t\tif (this._map) {\n\t\t\tthis._initIcon();\n\t\t\tthis.update();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the instance of [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement)\n\t * used by Marker layer.\n\t * @returns {HTMLElement}\n\t */\n\tgetElement() {\n\t\treturn this._icon;\n\t}\n\n\t/**\n\t * Updates the position of the marker on the map, e.g. after a change of its options.\n\t * @returns {this}\n\t */\n\tupdate() {\n\n\t\tif (this._icon && this._map && !this._culled) {\n\t\t\tconst pos = this._map.latLngToLayerPoint(this._latlng)._round();\n\t\t\tthis._setPos(pos);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t_initIcon() {\n\t\tconst options = this.options,\n\t\tclassToAdd = `maplair-zoom-${this._zoomAnimated ? 'animated' : 'hide'}`;\n\n\t\tconst icon = options.icon.createIcon(this._icon);\n\t\tlet addIcon = false;\n\n\t\t// if we're not reusing the icon, remove the old one and init new one\n\t\tif (icon !== this._icon) {\n\t\t\tif (this._icon) {\n\t\t\t\tthis._removeIcon();\n\t\t\t}\n\t\t\taddIcon = true;\n\n\t\t\tif (options.title) {\n\t\t\t\ticon.title = options.title;\n\t\t\t}\n\n\t\t\tif (icon instanceof HTMLImageElement) {\n\t\t\t\ticon.alt = options.alt ?? '';\n\t\t\t}\n\t\t}\n\n\t\ticon.classList.add(classToAdd);\n\n\t\tif (options.keyboard) {\n\t\t\ticon.tabIndex = 0;\n\t\t\tif (options.interactive) {\n\t\t\t\ticon.setAttribute('role', 'button');\n\t\t\t}\n\t\t\tDomEvent.on(icon, 'keydown', this._onKeyDown, this);\n\t\t}\n\n\t\tthis._icon = icon;\n\n\t\tif (options.riseOnHover) {\n\t\t\tthis.on({\n\t\t\t\tpointerover: this._bringToFront,\n\t\t\t\tpointerout: this._resetZIndex\n\t\t\t});\n\t\t}\n\n\t\tif (this.options.autoPanOnFocus) {\n\t\t\tDomEvent.on(icon, 'focus', this._panOnFocus, this);\n\t\t}\n\n\t\tconst newShadow = options.shadow ? options.icon.createShadow?.(this._shadow) ?? null : null;\n\t\tlet addShadow = false;\n\n\t\tif (newShadow !== this._shadow) {\n\t\t\tthis._removeShadow();\n\t\t\taddShadow = true;\n\t\t}\n\n\t\tif (newShadow) {\n\t\t\tnewShadow.classList.add(classToAdd);\n\t\t\tnewShadow.alt = '';\n\t\t}\n\t\tthis._shadow = newShadow;\n\n\n\t\tif (options.opacity < 1) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\n\t\tif (addIcon) {\n\t\t\tthis.getPane().appendChild(this._icon);\n\t\t}\n\t\tthis._initInteraction();\n\t\tif (newShadow && addShadow) {\n\t\t\tthis.getPane(options.shadowPane).appendChild(this._shadow);\n\t\t}\n\t}\n\n\t_removeIcon() {\n\t\tif (this.options.riseOnHover) {\n\t\t\tthis.off({\n\t\t\t\tpointerover: this._bringToFront,\n\t\t\t\tpointerout: this._resetZIndex\n\t\t\t});\n\t\t}\n\n\t\tif (this.options.autoPanOnFocus) {\n\t\t\tDomEvent.off(this._icon, 'focus', this._panOnFocus, this);\n\t\t}\n\t\tDomEvent.off(this._icon, 'keydown', this._onKeyDown, this);\n\n\t\tthis._icon.remove();\n\t\tthis.removeInteractiveTarget(this._icon);\n\n\t\tthis._icon = null;\n\t}\n\n\t// With the map's `markerCulling` option, takes the icon and shadow of a marker\n\t// far outside of the map view off the page (and puts them back when needed),\n\t// so that the browser doesn't need to render, and the marker doesn't need\n\t// to reposition, them while panning and zooming.\n\t_updateCulling() {\n\t\tif (!this._icon || !this._map) { return; }\n\n\t\tconst map = this._map,\n\t\t// computed once per view for all markers, reset by the map on `move`\n\t\tbounds = map._cullingBounds ??= map.getBounds().pad(0.5),\n\t\tvisible = bounds.contains(this._latlng) ||\n\t\t\t!!this.dragging?._draggable?._moving ||\n\t\t\tthis._icon.contains(document.activeElement);\n\n\t\tif (visible === !this._culled) { return; }\n\t\tthis._culled = !visible;\n\n\t\tif (visible) {\n\t\t\tthis.getPane().appendChild(this._icon);\n\t\t\tif (this._shadow) {\n\t\t\t\tthis.getPane(this.options.shadowPane).appendChild(this._shadow);\n\t\t\t}\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis._icon.remove();\n\t\t\tthis._shadow?.remove();\n\t\t}\n\t}\n\n\t_removeShadow() {\n\t\tthis._shadow?.remove();\n\t\tthis._shadow = null;\n\t}\n\n\t_setPos(pos) {\n\t\tthis._positionElements(pos);\n\n\t\tthis._zIndex = pos.y + this.options.zIndexOffset;\n\n\t\tthis._resetZIndex();\n\t}\n\n\t_positionElements(pos) {\n\t\tconst rotation = this.options.rotation;\n\n\t\tif (this._icon) {\n\t\t\tDomUtil.setPosition(this._icon, pos);\n\t\t\tif (rotation != null) {\n\t\t\t\tthis._icon.style.transform += ` rotate(${rotation}deg)`;\n\t\t\t}\n\t\t}\n\n\t\tif (this._shadow) {\n\t\t\tDomUtil.setPosition(this._shadow, pos);\n\t\t\tthis._shadow.style.display = rotation == null ? '' : 'none';\n\t\t}\n\t}\n\n\t_updateZIndex(offset) {\n\t\tconst zIndex = String(this._zIndex + offset);\n\t\tif (this._icon && this._icon.style.zIndex !== zIndex) {\n\t\t\tthis._icon.style.zIndex = zIndex;\n\t\t}\n\t}\n\n\t_animateZoom(opt) {\n\t\tif (this._culled) { return; }\n\t\tconst pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center)._round();\n\n\t\tthis._setPos(pos);\n\t}\n\n\t_updateInteractive() {\n\t\tif (!this._icon) { return; }\n\t\tif (this.options.keyboard) {\n\t\t\tif (this.options.interactive) {\n\t\t\t\tthis._icon.setAttribute('role', 'button');\n\t\t\t} else {\n\t\t\t\tthis._icon.removeAttribute('role');\n\t\t\t}\n\t\t}\n\t\tif (this.options.interactive) {\n\t\t\tthis._initInteraction();\n\t\t\tif (this._draggableBeforeNonInteractive) {\n\t\t\t\tthis.dragging?.enable();\n\t\t\t}\n\t\t} else {\n\t\t\tthis._icon.classList.remove('maplair-interactive');\n\t\t\tthis.removeInteractiveTarget(this._icon);\n\t\t\tthis._draggableBeforeNonInteractive = this.dragging?.enabled();\n\t\t\tthis.dragging?.disable();\n\t\t}\n\t}\n\n\t_initInteraction() {\n\n\t\tif (!this.options.interactive) { return; }\n\n\t\tthis._icon.classList.add('maplair-interactive');\n\n\t\tthis.addInteractiveTarget(this._icon);\n\n\t\tif (MarkerDrag) {\n\t\t\t// When the icon element is reused, the drag handler still refers to it. Keep that handler, because\n\t\t\t// replacing it ends a drag in progress and forgets that the marker has just been dragged.\n\t\t\tif (this.dragging?._draggable?._element === this._icon) {\n\t\t\t\t// the icon has reset the class names of the element\n\t\t\t\tthis._icon.classList.toggle('maplair-marker-draggable', this.dragging.enabled());\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet draggable = this.options.draggable;\n\t\t\tif (this.dragging) {\n\t\t\t\tdraggable = this.dragging.enabled();\n\t\t\t\tthis.dragging.disable();\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Marker dragging handler, see `Handler`. Only valid when the marker is on the\n\t\t\t * map (otherwise set [`marker.options.draggable`](#markeroptions-draggable)).\n\t\t\t *\n\t\t\t * Interaction handlers are properties of a marker instance that allow you to\n\t\t\t * control interaction behavior in runtime, enabling or disabling certain\n\t\t\t * features such as dragging (see `Handler` methods). Example:\n\t\t\t *\n\t\t\t * ```js\n\t\t\t * marker.dragging.disable();\n\t\t\t * ```\n\t\t\t * @group Interaction handlers\n\t\t\t * @type {MarkerDrag}\n\t\t\t */\n\t\t\tthis.dragging = new MarkerDrag(this);\n\n\t\t\tif (draggable) {\n\t\t\t\tthis.dragging.enable();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns the current [rotation](#markeroptions-rotation) of the marker in degrees.\n\t * @returns {number|null}\n\t */\n\tgetRotation() {\n\t\treturn this.options.rotation;\n\t}\n\n\t/**\n\t * Changes the [rotation](#markeroptions-rotation) of the marker; `null` removes it.\n\t * @param {number|null} rotation\n\t * @returns {this}\n\t */\n\tsetRotation(rotation) {\n\t\tthis.options.rotation = rotation;\n\t\t// mid-zoom, the icon is transitioning to a position that update() can't compute yet; the zoom end applies it\n\t\tif (this._icon && !this._map._animatingZoom) {\n\t\t\tthis._positionElements(DomUtil.getPosition(this._icon));\n\t\t\tthis._popup?._updatePosition();\n\t\t\tthis._tooltip?._updatePosition();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Changes the opacity of the marker.\n\t * @param {number} opacity\n\t * @returns {this}\n\t */\n\tsetOpacity(opacity) {\n\t\tthis.options.opacity = opacity;\n\t\tif (this._map) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t_updateOpacity() {\n\t\tconst opacity = this.options.opacity;\n\n\t\tif (this._icon) {\n\t\t\tthis._icon.style.opacity = `${opacity}`;\n\t\t}\n\n\t\tif (this._shadow) {\n\t\t\tthis._shadow.style.opacity = `${opacity}`;\n\t\t}\n\t}\n\n\t_bringToFront() {\n\t\tthis._updateZIndex(this.options.riseOffset);\n\t}\n\n\t_resetZIndex() {\n\t\tthis._updateZIndex(0);\n\t}\n\n\t_onKeyDown(e) {\n\t\t// a key pressed on a focusable element inside a DivIcon (e.g. a <button>) already clicks it natively\n\t\tif (this.options.interactive && e.target === this._icon && !e.repeat && (e.key === 'Enter' || e.key === ' ')) {\n\t\t\te.preventDefault(); // stop Space from scrolling the page\n\t\t\t// lets a popup opened by the click take the focus, see Popup.onAdd()\n\t\t\tthis._clickedByKeyboard = true;\n\t\t\tthis._icon.click();\n\t\t\tthis._clickedByKeyboard = false;\n\t\t}\n\t}\n\n\t_panOnFocus() {\n\t\tconst map = this._map;\n\t\tif (!map) { return; }\n\n\t\tconst icon = this._icon,\n\t\tstyle = getComputedStyle(icon),\n\t\tanchor = new Point(-parseFloat(style.marginLeft) || 0, -parseFloat(style.marginTop) || 0),\n\t\tsize = new Point(icon.offsetWidth, icon.offsetHeight);\n\n\t\tmap.panInside(this._latlng, {\n\t\t\tpaddingTopLeft: anchor,\n\t\t\tpaddingBottomRight: size.subtract(anchor)\n\t\t});\n\t}\n\n\t_getPopupAnchor() {\n\t\treturn this._rotateAnchor(this.options.icon.options.popupAnchor);\n\t}\n\n\t_getTooltipAnchor() {\n\t\treturn this._rotateAnchor(this.options.icon.options.tooltipAnchor);\n\t}\n\n\t// anchors are offsets from the icon anchor, which is also the rotation origin\n\t_rotateAnchor(anchor) {\n\t\tconst angle = this.options.rotation * Math.PI / 180;\n\t\tif (!angle || !anchor) { return anchor; }\n\n\t\tconst {x, y} = Point.from(anchor),\n\t\tcos = Math.cos(angle),\n\t\tsin = Math.sin(angle);\n\t\treturn new Point(x * cos - y * sin, x * sin + y * cos);\n\t}\n\n\t/**\n\t * Coordinates values are rounded with [`formatNum`](#util-formatnum) to the\n\t * given `precision`. Returns a [`GeoJSON`](https://en.wikipedia.org/wiki/GeoJSON)\n\t * representation of the marker (as a GeoJSON `Point` Feature).\n\t * @group Other methods\n\t * @param {number|false} [precision]\n\t * @returns {Feature}\n\t */\n\ttoGeoJSON(precision) {\n\t\treturn pointToGeoJSON(this, precision);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAa,SAAb,MAAa,eAAe,MAAM;CAEjC,OAAO,iBAAiB;EACvB,sBAAsB,IAAI,YAAY;EAGtC,aAAa;EAEb,UAAU;EACV,OAAO;EACP,KAAK;EACL,cAAc;EACd,SAAS;EACT,UAAU;EACV,aAAa;EACb,YAAY;EACZ,MAAM;EACN,YAAY;EACZ,QAAQ;EACR,uBAAuB;EACvB,gBAAgB;EAChB,WAAW;EACX,SAAS;EACT,gBAAgB,CAAC,IAAI,EAAE;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AAM,KAAK;EACjB,IAAI,CAAC,KAAO;EAEZ,MAAM,OAAO,KAAK,OAClB,QAAQ,iBAAiB,IAAI,GAC7B,SAAS,IAAI,MAAM,CAAC,WAAW,MAAM,UAAU,KAAK,GAAG,CAAC,WAAW,MAAM,SAAS,KAAK,CAAC,GACxF,OAAO,IAAI,MAAM,KAAK,aAAa,KAAK,YAAY;EAEpD,IAAI,UAAU,KAAK,SAAS;GAC3B,gBAAgB;GAChB,oBAAoB,KAAK,SAAS,MAAM;EACzC,CAAC;CACF;CAEA,kBAAkB;EACjB,OAAO,KAAK,cAAc,KAAK,QAAQ,KAAK,QAAQ,WAAW;CAChE;CAEA,oBAAoB;EACnB,OAAO,KAAK,cAAc,KAAK,QAAQ,KAAK,QAAQ,aAAa;CAClE;CAGA,cAAc,QAAQ;EACrB,MAAM,QAAQ,KAAK,QAAQ,WAAW,KAAK,KAAK;EAChD,IAAI,CAAC,SAAS,CAAC,QAAU,OAAO;EAEhC,MAAM,EAAC,GAAG,MAAK,MAAM,KAAK,MAAM,GAChC,MAAM,KAAK,IAAI,KAAK,GACpB,MAAM,KAAK,IAAI,KAAK;EACpB,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG;CACtD;;;;;;;;;CAUA,UAAU,WAAW;EACpB,OAAO,eAAe,MAAM,SAAS;CACtC;AACD"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { Point } from "../../geometry/Point.js";
|
|
2
|
+
import { I18n } from "../../core/I18n.js";
|
|
3
|
+
import { LatLngBounds } from "../../geo/LatLngBounds.js";
|
|
4
|
+
import { LatLng } from "../../geo/LatLng.js";
|
|
5
|
+
import { FeatureGroup } from "../FeatureGroup.js";
|
|
6
|
+
import { Polyline } from "../vector/Polyline.js";
|
|
7
|
+
import { Marker } from "./Marker.js";
|
|
8
|
+
import { DivIcon } from "./DivIcon.js";
|
|
9
|
+
// src/layer/marker/MarkerClusterGroup.js
|
|
10
|
+
/** @import {Layer, LayerOptions} from '../Layer.js' */
|
|
11
|
+
/** @import {MaplairEvent} from '../../core/Events.js' */
|
|
12
|
+
/**
|
|
13
|
+
* A cluster of markers, see `MarkerClusterGroup`.
|
|
14
|
+
* @typedef {object} MarkerCluster
|
|
15
|
+
* @property {LatLng} latlng The position of the cluster marker: the mean of the
|
|
16
|
+
* positions of its markers.
|
|
17
|
+
* @property {LatLngBounds} bounds The bounds of its markers.
|
|
18
|
+
* @property {Layer[]} markers Its markers.
|
|
19
|
+
* @property {number} count The number of its markers.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The event object of `clusterclick`.
|
|
23
|
+
* @typedef {object} ClusterClickEvent
|
|
24
|
+
* @property {MarkerCluster} cluster The clicked cluster.
|
|
25
|
+
* @property {Marker} layer The marker of the cluster.
|
|
26
|
+
* @property {Event} originalEvent The DOM event of the click.
|
|
27
|
+
* @extends MaplairEvent
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Options of `MarkerClusterGroup`.
|
|
31
|
+
* @typedef {object} MarkerClusterGroupOptions
|
|
32
|
+
* @property {number} [maxClusterRadius=80] The maximum distance in pixels between the
|
|
33
|
+
* first marker of a cluster and the other ones.
|
|
34
|
+
* @property {number} [disableClusteringAtZoom] From this zoom level on, the markers are
|
|
35
|
+
* shown without clustering.
|
|
36
|
+
* @property {boolean} [zoomToBoundsOnClick=true] Whether a click on a cluster zooms to
|
|
37
|
+
* the bounds of its markers.
|
|
38
|
+
* @property {boolean} [spiderfyOnMaxZoom=true] Whether a click on a cluster which
|
|
39
|
+
* zooming in doesn't split (e.g. markers at the same position, or at the maximum
|
|
40
|
+
* zoom) spreads its markers in a circle around it ("spiderfies" them). Until the next
|
|
41
|
+
* click on the map, change of the zoom or of the layers, their `getLatLng()` returns
|
|
42
|
+
* the spread positions. Clusters can also be activated with the <kbd>Enter</kbd> key.
|
|
43
|
+
* @property {(cluster: MarkerCluster) => DivIcon} [iconCreateFunction] Returns the icon
|
|
44
|
+
* of a cluster, by default a circle with the count, sized and colored by the
|
|
45
|
+
* `maplair-cluster-small`, `-medium` and `-large` CSS classes (for up to 9, 99 and
|
|
46
|
+
* more markers).
|
|
47
|
+
* @extends LayerOptions
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* A layer group clustering its markers: nearby markers are shown as one marker with
|
|
51
|
+
* their count, which zooms in to them when clicked. The clusters are computed for
|
|
52
|
+
* the zoom level of the map, and only the ones near the view are on the map, so
|
|
53
|
+
* that tens of thousands of markers stay fast. Accepts all layers with a single
|
|
54
|
+
* position (`getLatLng()`), e.g. markers and circle markers; other layers are shown
|
|
55
|
+
* without clustering. Events of the markers (e.g. `click`) propagate to the group.
|
|
56
|
+
*
|
|
57
|
+
* Replaces the [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster)
|
|
58
|
+
* plugin for the common use cases, with its option names; without animations and
|
|
59
|
+
* cluster coverage polygons.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```js
|
|
63
|
+
* const clusters = new MarkerClusterGroup();
|
|
64
|
+
* for (const [lat, lng, name] of places) {
|
|
65
|
+
* clusters.addLayer(new Marker([lat, lng]).bindPopup(name));
|
|
66
|
+
* }
|
|
67
|
+
* map.addLayer(clusters);
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @fires MarkerClusterGroup#clusterclick {ClusterClickEvent} Fired when a cluster is
|
|
71
|
+
* clicked.
|
|
72
|
+
*/
|
|
73
|
+
var MarkerClusterGroup = class MarkerClusterGroup extends FeatureGroup {
|
|
74
|
+
static defaultOptions = {
|
|
75
|
+
maxClusterRadius: 80,
|
|
76
|
+
disableClusteringAtZoom: void 0,
|
|
77
|
+
zoomToBoundsOnClick: true,
|
|
78
|
+
spiderfyOnMaxZoom: true,
|
|
79
|
+
iconCreateFunction: void 0
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Creates a cluster group with the given layers.
|
|
83
|
+
* @param {Layer[]} [layers]
|
|
84
|
+
* @param {MarkerClusterGroupOptions} [options]
|
|
85
|
+
*/
|
|
86
|
+
constructor(layers, options) {
|
|
87
|
+
super(layers, options);
|
|
88
|
+
this._shown = /* @__PURE__ */ new Set();
|
|
89
|
+
this.callInitHooks(MarkerClusterGroup);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Adds the given layer to the group.
|
|
93
|
+
* @param {Layer} layer
|
|
94
|
+
* @returns {this}
|
|
95
|
+
*/
|
|
96
|
+
addLayer(layer) {
|
|
97
|
+
return this.addLayers([layer]);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Adds the given layers to the group, clustering once instead of for each layer.
|
|
101
|
+
* @param {Layer[]} layers
|
|
102
|
+
* @returns {this}
|
|
103
|
+
*/
|
|
104
|
+
addLayers(layers) {
|
|
105
|
+
for (const layer of layers) if (!this.hasLayer(layer)) {
|
|
106
|
+
layer.addEventParent(this).on("dragend", this._onDragEnd, this);
|
|
107
|
+
this._layers[this.getLayerId(layer)] = layer;
|
|
108
|
+
this.fire("layeradd", { layer });
|
|
109
|
+
}
|
|
110
|
+
return this.refreshClusters();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Removes the given layer from the group.
|
|
114
|
+
* @param {Layer|number} layer The layer or its id.
|
|
115
|
+
* @returns {this}
|
|
116
|
+
*/
|
|
117
|
+
removeLayer(layer) {
|
|
118
|
+
layer = typeof layer === "number" ? this._layers[layer] : layer;
|
|
119
|
+
if (!layer || !this.hasLayer(layer)) return this;
|
|
120
|
+
this._unspiderfy();
|
|
121
|
+
layer.removeEventParent(this).off("dragend", this._onDragEnd, this);
|
|
122
|
+
delete this._layers[this.getLayerId(layer)];
|
|
123
|
+
if (this._shown?.delete(layer)) this._map.removeLayer(layer);
|
|
124
|
+
this.fire("layerremove", { layer });
|
|
125
|
+
return this.refreshClusters();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Removes all layers from the group.
|
|
129
|
+
* @returns {this}
|
|
130
|
+
*/
|
|
131
|
+
clearLayers() {
|
|
132
|
+
this._unspiderfy();
|
|
133
|
+
for (const layer of this.getLayers()) {
|
|
134
|
+
layer.removeEventParent(this).off("dragend", this._onDragEnd, this);
|
|
135
|
+
this.fire("layerremove", { layer });
|
|
136
|
+
}
|
|
137
|
+
this._layers = {};
|
|
138
|
+
return this.refreshClusters();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Computes the clusters again, e.g. after markers of the group were moved with
|
|
142
|
+
* `setLatLng()`. Happens by itself when the zoom changes or layers are added or
|
|
143
|
+
* removed.
|
|
144
|
+
* @returns {this}
|
|
145
|
+
*/
|
|
146
|
+
refreshClusters() {
|
|
147
|
+
this._clusters = null;
|
|
148
|
+
if (this._map) this._update();
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
onAdd() {
|
|
152
|
+
this._clusters = null;
|
|
153
|
+
this._update();
|
|
154
|
+
}
|
|
155
|
+
onRemove(map) {
|
|
156
|
+
this._unspiderfy();
|
|
157
|
+
for (const layer of this._shown) map.removeLayer(layer);
|
|
158
|
+
this._shown.clear();
|
|
159
|
+
}
|
|
160
|
+
getEvents() {
|
|
161
|
+
return {
|
|
162
|
+
moveend: this._update,
|
|
163
|
+
zoomstart: this._unspiderfy,
|
|
164
|
+
click: this._unspiderfy
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
_onDragEnd({ target: marker }) {
|
|
168
|
+
if (marker._clusterLatLng) marker._clusterLatLng = marker.getLatLng();
|
|
169
|
+
this.refreshClusters();
|
|
170
|
+
}
|
|
171
|
+
_update() {
|
|
172
|
+
const map = this._map, zoom = map.getZoom();
|
|
173
|
+
if (!this._clusters || this._clustersZoom !== zoom) {
|
|
174
|
+
this._unspiderfy();
|
|
175
|
+
this._clusters = this._cluster();
|
|
176
|
+
this._clustersZoom = zoom;
|
|
177
|
+
}
|
|
178
|
+
const view = map.getPixelBounds().pad(.5), shown = /* @__PURE__ */ new Set();
|
|
179
|
+
for (const cluster of this._clusters) {
|
|
180
|
+
const { markers, point } = cluster;
|
|
181
|
+
if (markers.length > 1) {
|
|
182
|
+
if (view.contains(point)) {
|
|
183
|
+
cluster.marker ??= this._createClusterMarker(cluster);
|
|
184
|
+
shown.add(cluster.marker);
|
|
185
|
+
}
|
|
186
|
+
} else if (!markers[0].getLatLng || view.contains(point)) shown.add(markers[0]);
|
|
187
|
+
}
|
|
188
|
+
const spiderfied = this._spider?.clusterMarker;
|
|
189
|
+
for (const layer of this._shown) if (!shown.has(layer)) map.removeLayer(layer);
|
|
190
|
+
for (const layer of shown) if (layer !== spiderfied) map.addLayer(layer);
|
|
191
|
+
this._shown = shown;
|
|
192
|
+
}
|
|
193
|
+
_cluster() {
|
|
194
|
+
const map = this._map, zoom = map.getZoom(), radius = this.options.maxClusterRadius, noClustering = zoom >= (this.options.disableClusteringAtZoom ?? Infinity), grid = /* @__PURE__ */ new Map(), clusters = [];
|
|
195
|
+
for (const layer of Object.values(this._layers)) {
|
|
196
|
+
if (!layer.getLatLng) {
|
|
197
|
+
clusters.push({ markers: [layer] });
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const point = map.project(layer.getLatLng(), zoom), x = Math.floor(point.x / radius), y = Math.floor(point.y / radius);
|
|
201
|
+
let nearest, minDistance = radius;
|
|
202
|
+
for (let i = x - 1; i <= x + 1; i++) for (let j = y - 1; j <= y + 1; j++) for (const cluster of noClustering ? [] : grid.get(`${i}:${j}`) ?? []) {
|
|
203
|
+
const distance = cluster.point.distanceTo(point);
|
|
204
|
+
if (distance <= minDistance) {
|
|
205
|
+
nearest = cluster;
|
|
206
|
+
minDistance = distance;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (nearest) nearest.markers.push(layer);
|
|
210
|
+
else {
|
|
211
|
+
const cluster = {
|
|
212
|
+
point,
|
|
213
|
+
markers: [layer]
|
|
214
|
+
}, key = `${x}:${y}`;
|
|
215
|
+
if (!grid.has(key)) grid.set(key, []);
|
|
216
|
+
grid.get(key).push(cluster);
|
|
217
|
+
clusters.push(cluster);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (const cluster of clusters) if (cluster.markers.length > 1) {
|
|
221
|
+
const latlngs = cluster.markers.map((marker) => marker.getLatLng());
|
|
222
|
+
cluster.latlng = new LatLng(latlngs.reduce((sum, latlng) => sum + latlng.lat, 0) / latlngs.length, latlngs.reduce((sum, latlng) => sum + latlng.lng, 0) / latlngs.length);
|
|
223
|
+
cluster.point = map.project(cluster.latlng, zoom);
|
|
224
|
+
}
|
|
225
|
+
return clusters;
|
|
226
|
+
}
|
|
227
|
+
_createClusterMarker({ latlng, markers }) {
|
|
228
|
+
const cluster = {
|
|
229
|
+
latlng,
|
|
230
|
+
bounds: new LatLngBounds(markers.map((marker) => marker.getLatLng())),
|
|
231
|
+
markers,
|
|
232
|
+
count: markers.length
|
|
233
|
+
}, icon = this.options.iconCreateFunction?.(cluster) ?? this._createIcon(cluster), marker = new Marker(latlng, {
|
|
234
|
+
icon,
|
|
235
|
+
title: I18n.translate("{count} markers", { count: cluster.count })
|
|
236
|
+
});
|
|
237
|
+
marker.on("click", (e) => this._onClusterClick(cluster, marker, e));
|
|
238
|
+
return marker;
|
|
239
|
+
}
|
|
240
|
+
_createIcon({ count }) {
|
|
241
|
+
const size = count < 10 ? "small" : count < 100 ? "medium" : "large";
|
|
242
|
+
return new DivIcon({
|
|
243
|
+
html: `<span>${count}</span>`,
|
|
244
|
+
className: `maplair-cluster maplair-cluster-${size}`,
|
|
245
|
+
iconSize: {
|
|
246
|
+
small: 32,
|
|
247
|
+
medium: 38,
|
|
248
|
+
large: 44
|
|
249
|
+
}[size]
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
_onClusterClick(cluster, marker, e) {
|
|
253
|
+
this.fire("clusterclick", {
|
|
254
|
+
cluster,
|
|
255
|
+
layer: marker,
|
|
256
|
+
originalEvent: e.originalEvent
|
|
257
|
+
});
|
|
258
|
+
const map = this._map, maxZoom = map.getMaxZoom(), { bounds } = cluster;
|
|
259
|
+
if (map.getZoom() < maxZoom && (this.options.disableClusteringAtZoom <= maxZoom || map.project(bounds.getNorthEast(), maxZoom).distanceTo(map.project(bounds.getSouthWest(), maxZoom)) > this.options.maxClusterRadius)) {
|
|
260
|
+
if (this.options.zoomToBoundsOnClick) map.fitBounds(bounds);
|
|
261
|
+
} else if (this.options.spiderfyOnMaxZoom) this._spiderfy(cluster, marker);
|
|
262
|
+
}
|
|
263
|
+
_spiderfy({ markers }, clusterMarker) {
|
|
264
|
+
this._unspiderfy();
|
|
265
|
+
const map = this._map, center = map.latLngToLayerPoint(clusterMarker.getLatLng()), radius = Math.max(30, markers.length * 30 / (2 * Math.PI)), spider = this._spider = {
|
|
266
|
+
markers,
|
|
267
|
+
clusterMarker,
|
|
268
|
+
legs: []
|
|
269
|
+
};
|
|
270
|
+
map.removeLayer(clusterMarker);
|
|
271
|
+
markers.forEach((marker, i) => {
|
|
272
|
+
const angle = 2 * Math.PI * i / markers.length, latlng = map.layerPointToLatLng(center.add(new Point(Math.cos(angle), Math.sin(angle)).multiplyBy(radius)));
|
|
273
|
+
marker._clusterLatLng = marker.getLatLng();
|
|
274
|
+
marker.setLatLng(latlng);
|
|
275
|
+
const leg = new Polyline([clusterMarker.getLatLng(), latlng], {
|
|
276
|
+
className: "maplair-cluster-leg",
|
|
277
|
+
interactive: false,
|
|
278
|
+
weight: 1.5
|
|
279
|
+
});
|
|
280
|
+
spider.legs.push(leg);
|
|
281
|
+
map.addLayer(leg);
|
|
282
|
+
map.addLayer(marker);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
_unspiderfy() {
|
|
286
|
+
const spider = this._spider;
|
|
287
|
+
if (!spider) return;
|
|
288
|
+
this._spider = null;
|
|
289
|
+
const map = this._map;
|
|
290
|
+
for (const leg of spider.legs) map?.removeLayer(leg);
|
|
291
|
+
for (const marker of spider.markers) {
|
|
292
|
+
map?.removeLayer(marker);
|
|
293
|
+
marker.setLatLng(marker._clusterLatLng);
|
|
294
|
+
delete marker._clusterLatLng;
|
|
295
|
+
}
|
|
296
|
+
if (map && this._shown.has(spider.clusterMarker)) map.addLayer(spider.clusterMarker);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
export { MarkerClusterGroup };
|
|
300
|
+
|
|
301
|
+
//# sourceMappingURL=MarkerClusterGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerClusterGroup.js","names":[],"sources":["../../../../src/layer/marker/MarkerClusterGroup.js"],"sourcesContent":["import {FeatureGroup} from '../FeatureGroup.js';\nimport {Marker} from './Marker.js';\nimport {DivIcon} from './DivIcon.js';\nimport {Polyline} from '../vector/Polyline.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\nimport {Point} from '../../geometry/Point.js';\nimport {I18n} from '../../core/I18n.js';\n/** @import {Layer, LayerOptions} from '../Layer.js' */\n/** @import {MaplairEvent} from '../../core/Events.js' */\n\n/**\n * A cluster of markers, see `MarkerClusterGroup`.\n * @typedef {object} MarkerCluster\n * @property {LatLng} latlng The position of the cluster marker: the mean of the\n * positions of its markers.\n * @property {LatLngBounds} bounds The bounds of its markers.\n * @property {Layer[]} markers Its markers.\n * @property {number} count The number of its markers.\n */\n\n/**\n * The event object of `clusterclick`.\n * @typedef {object} ClusterClickEvent\n * @property {MarkerCluster} cluster The clicked cluster.\n * @property {Marker} layer The marker of the cluster.\n * @property {Event} originalEvent The DOM event of the click.\n * @extends MaplairEvent\n */\n\n/**\n * Options of `MarkerClusterGroup`.\n * @typedef {object} MarkerClusterGroupOptions\n * @property {number} [maxClusterRadius=80] The maximum distance in pixels between the\n * first marker of a cluster and the other ones.\n * @property {number} [disableClusteringAtZoom] From this zoom level on, the markers are\n * shown without clustering.\n * @property {boolean} [zoomToBoundsOnClick=true] Whether a click on a cluster zooms to\n * the bounds of its markers.\n * @property {boolean} [spiderfyOnMaxZoom=true] Whether a click on a cluster which\n * zooming in doesn't split (e.g. markers at the same position, or at the maximum\n * zoom) spreads its markers in a circle around it (\"spiderfies\" them). Until the next\n * click on the map, change of the zoom or of the layers, their `getLatLng()` returns\n * the spread positions. Clusters can also be activated with the <kbd>Enter</kbd> key.\n * @property {(cluster: MarkerCluster) => DivIcon} [iconCreateFunction] Returns the icon\n * of a cluster, by default a circle with the count, sized and colored by the\n * `maplair-cluster-small`, `-medium` and `-large` CSS classes (for up to 9, 99 and\n * more markers).\n * @extends LayerOptions\n */\n\n/**\n * A layer group clustering its markers: nearby markers are shown as one marker with\n * their count, which zooms in to them when clicked. The clusters are computed for\n * the zoom level of the map, and only the ones near the view are on the map, so\n * that tens of thousands of markers stay fast. Accepts all layers with a single\n * position (`getLatLng()`), e.g. markers and circle markers; other layers are shown\n * without clustering. Events of the markers (e.g. `click`) propagate to the group.\n *\n * Replaces the [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster)\n * plugin for the common use cases, with its option names; without animations and\n * cluster coverage polygons.\n *\n * @example\n * ```js\n * const clusters = new MarkerClusterGroup();\n * for (const [lat, lng, name] of places) {\n * \tclusters.addLayer(new Marker([lat, lng]).bindPopup(name));\n * }\n * map.addLayer(clusters);\n * ```\n *\n * @fires MarkerClusterGroup#clusterclick {ClusterClickEvent} Fired when a cluster is\n * clicked.\n */\nexport class MarkerClusterGroup extends FeatureGroup {\n\n\tstatic defaultOptions = {\n\t\tmaxClusterRadius: 80,\n\t\tdisableClusteringAtZoom: undefined,\n\t\tzoomToBoundsOnClick: true,\n\t\tspiderfyOnMaxZoom: true,\n\t\ticonCreateFunction: undefined\n\t};\n\n\t/**\n\t * Creates a cluster group with the given layers.\n\t * @param {Layer[]} [layers]\n\t * @param {MarkerClusterGroupOptions} [options]\n\t */\n\tconstructor(layers, options) {\n\t\tsuper(layers, options);\n\t\t// the layers on the map: cluster markers, and the markers not in a cluster\n\t\tthis._shown = new Set();\n\t\tthis.callInitHooks(MarkerClusterGroup);\n\t}\n\n\t/**\n\t * Adds the given layer to the group.\n\t * @param {Layer} layer\n\t * @returns {this}\n\t */\n\taddLayer(layer) {\n\t\treturn this.addLayers([layer]);\n\t}\n\n\t/**\n\t * Adds the given layers to the group, clustering once instead of for each layer.\n\t * @param {Layer[]} layers\n\t * @returns {this}\n\t */\n\taddLayers(layers) {\n\t\tfor (const layer of layers) {\n\t\t\tif (!this.hasLayer(layer)) {\n\t\t\t\tlayer.addEventParent(this).on('dragend', this._onDragEnd, this);\n\t\t\t\tthis._layers[this.getLayerId(layer)] = layer;\n\t\t\t\tthis.fire('layeradd', {layer});\n\t\t\t}\n\t\t}\n\t\treturn this.refreshClusters();\n\t}\n\n\t/**\n\t * Removes the given layer from the group.\n\t * @param {Layer|number} layer The layer or its id.\n\t * @returns {this}\n\t */\n\tremoveLayer(layer) {\n\t\tlayer = typeof layer === 'number' ? this._layers[layer] : layer;\n\t\tif (!layer || !this.hasLayer(layer)) {\n\t\t\treturn this;\n\t\t}\n\t\tthis._unspiderfy();\n\t\tlayer.removeEventParent(this).off('dragend', this._onDragEnd, this);\n\t\tdelete this._layers[this.getLayerId(layer)];\n\t\tif (this._shown?.delete(layer)) {\n\t\t\tthis._map.removeLayer(layer);\n\t\t}\n\t\tthis.fire('layerremove', {layer});\n\t\treturn this.refreshClusters();\n\t}\n\n\t/**\n\t * Removes all layers from the group.\n\t * @returns {this}\n\t */\n\tclearLayers() {\n\t\tthis._unspiderfy();\n\t\tfor (const layer of this.getLayers()) {\n\t\t\tlayer.removeEventParent(this).off('dragend', this._onDragEnd, this);\n\t\t\tthis.fire('layerremove', {layer});\n\t\t}\n\t\tthis._layers = {};\n\t\treturn this.refreshClusters();\n\t}\n\n\t/**\n\t * Computes the clusters again, e.g. after markers of the group were moved with\n\t * `setLatLng()`. Happens by itself when the zoom changes or layers are added or\n\t * removed.\n\t * @returns {this}\n\t */\n\trefreshClusters() {\n\t\tthis._clusters = null;\n\t\tif (this._map) {\n\t\t\tthis._update();\n\t\t}\n\t\treturn this;\n\t}\n\n\tonAdd() {\n\t\tthis._clusters = null;\n\t\tthis._update();\n\t}\n\n\tonRemove(map) {\n\t\tthis._unspiderfy();\n\t\tfor (const layer of this._shown) {\n\t\t\tmap.removeLayer(layer);\n\t\t}\n\t\tthis._shown.clear();\n\t}\n\n\tgetEvents() {\n\t\treturn {\n\t\t\tmoveend: this._update,\n\t\t\tzoomstart: this._unspiderfy,\n\t\t\tclick: this._unspiderfy\n\t\t};\n\t}\n\n\t// A marker of the group was dragged: keep its new position, also if spiderfied\n\t_onDragEnd({target: marker}) {\n\t\tif (marker._clusterLatLng) {\n\t\t\tmarker._clusterLatLng = marker.getLatLng();\n\t\t}\n\t\tthis.refreshClusters();\n\t}\n\n\t// Shows the clusters and single layers near the view. The clusters are computed for\n\t// each zoom level and when the layers change, not when panning, which keeps the\n\t// cluster markers and spiderfied markers.\n\t_update() {\n\t\tconst map = this._map,\n\t\tzoom = map.getZoom();\n\t\tif (!this._clusters || this._clustersZoom !== zoom) {\n\t\t\tthis._unspiderfy();\n\t\t\tthis._clusters = this._cluster();\n\t\t\tthis._clustersZoom = zoom;\n\t\t}\n\n\t\t// the view and half of it around, in projected pixels\n\t\tconst view = map.getPixelBounds().pad(0.5),\n\t\tshown = new Set();\n\t\tfor (const cluster of this._clusters) {\n\t\t\tconst {markers, point} = cluster;\n\t\t\tif (markers.length > 1) {\n\t\t\t\tif (view.contains(point)) {\n\t\t\t\t\tcluster.marker ??= this._createClusterMarker(cluster);\n\t\t\t\t\tshown.add(cluster.marker);\n\t\t\t\t}\n\t\t\t} else if (!markers[0].getLatLng || view.contains(point)) {\n\t\t\t\tshown.add(markers[0]);\n\t\t\t}\n\t\t}\n\n\t\tconst spiderfied = this._spider?.clusterMarker;\n\t\tfor (const layer of this._shown) {\n\t\t\tif (!shown.has(layer)) {\n\t\t\t\tmap.removeLayer(layer);\n\t\t\t}\n\t\t}\n\t\tfor (const layer of shown) {\n\t\t\tif (layer !== spiderfied) {\n\t\t\t\tmap.addLayer(layer);\n\t\t\t}\n\t\t}\n\t\tthis._shown = shown;\n\t}\n\n\t// Greedy clustering on a grid with cells of the cluster radius: each marker joins the\n\t// nearest cluster whose first marker is within the radius, or starts a new one\n\t_cluster() {\n\t\tconst map = this._map,\n\t\tzoom = map.getZoom(),\n\t\tradius = this.options.maxClusterRadius,\n\t\tnoClustering = zoom >= (this.options.disableClusteringAtZoom ?? Infinity),\n\t\tgrid = new Map(),\n\t\tclusters = [];\n\n\t\tfor (const layer of Object.values(this._layers)) {\n\t\t\tif (!layer.getLatLng) {\n\t\t\t\tclusters.push({markers: [layer]});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst point = map.project(layer.getLatLng(), zoom),\n\t\t\tx = Math.floor(point.x / radius),\n\t\t\ty = Math.floor(point.y / radius);\n\t\t\tlet nearest, minDistance = radius;\n\t\t\tfor (let i = x - 1; i <= x + 1; i++) {\n\t\t\t\tfor (let j = y - 1; j <= y + 1; j++) {\n\t\t\t\t\tfor (const cluster of noClustering ? [] : grid.get(`${i}:${j}`) ?? []) {\n\t\t\t\t\t\tconst distance = cluster.point.distanceTo(point);\n\t\t\t\t\t\tif (distance <= minDistance) {\n\t\t\t\t\t\t\tnearest = cluster;\n\t\t\t\t\t\t\tminDistance = distance;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (nearest) {\n\t\t\t\tnearest.markers.push(layer);\n\t\t\t} else {\n\t\t\t\tconst cluster = {point, markers: [layer]},\n\t\t\t\tkey = `${x}:${y}`;\n\t\t\t\tif (!grid.has(key)) {\n\t\t\t\t\tgrid.set(key, []);\n\t\t\t\t}\n\t\t\t\tgrid.get(key).push(cluster);\n\t\t\t\tclusters.push(cluster);\n\t\t\t}\n\t\t}\n\n\t\tfor (const cluster of clusters) {\n\t\t\tif (cluster.markers.length > 1) {\n\t\t\t\tconst latlngs = cluster.markers.map(marker => marker.getLatLng());\n\t\t\t\tcluster.latlng = new LatLng(\n\t\t\t\t\tlatlngs.reduce((sum, latlng) => sum + latlng.lat, 0) / latlngs.length,\n\t\t\t\t\tlatlngs.reduce((sum, latlng) => sum + latlng.lng, 0) / latlngs.length);\n\t\t\t\tcluster.point = map.project(cluster.latlng, zoom);\n\t\t\t}\n\t\t}\n\t\treturn clusters;\n\t}\n\n\t_createClusterMarker({latlng, markers}) {\n\t\tconst cluster = {latlng, bounds: new LatLngBounds(markers.map(marker => marker.getLatLng())), markers, count: markers.length},\n\t\ticon = this.options.iconCreateFunction?.(cluster) ?? this._createIcon(cluster),\n\t\tmarker = new Marker(latlng, {icon, title: I18n.translate('{count} markers', {count: cluster.count})});\n\t\tmarker.on('click', e => this._onClusterClick(cluster, marker, e));\n\t\treturn marker;\n\t}\n\n\t_createIcon({count}) {\n\t\tconst size = count < 10 ? 'small' : count < 100 ? 'medium' : 'large';\n\t\treturn new DivIcon({\n\t\t\thtml: `<span>${count}</span>`,\n\t\t\tclassName: `maplair-cluster maplair-cluster-${size}`,\n\t\t\ticonSize: {small: 32, medium: 38, large: 44}[size]\n\t\t});\n\t}\n\n\t_onClusterClick(cluster, marker, e) {\n\t\tthis.fire('clusterclick', {cluster, layer: marker, originalEvent: e.originalEvent});\n\t\tconst map = this._map,\n\t\tmaxZoom = map.getMaxZoom(),\n\t\t{bounds} = cluster,\n\t\t// zooming in splits the cluster if its markers are farther apart at the maximum zoom\n\t\tsplittable = map.getZoom() < maxZoom && (this.options.disableClusteringAtZoom <= maxZoom ||\n\t\t\tmap.project(bounds.getNorthEast(), maxZoom).distanceTo(map.project(bounds.getSouthWest(), maxZoom)) > this.options.maxClusterRadius);\n\t\tif (splittable) {\n\t\t\tif (this.options.zoomToBoundsOnClick) {\n\t\t\t\tmap.fitBounds(bounds);\n\t\t\t}\n\t\t} else if (this.options.spiderfyOnMaxZoom) {\n\t\t\tthis._spiderfy(cluster, marker);\n\t\t}\n\t}\n\n\t// Spreads the markers of the cluster in a circle around it, with legs to the center\n\t_spiderfy({markers}, clusterMarker) {\n\t\tthis._unspiderfy();\n\t\tconst map = this._map,\n\t\tcenter = map.latLngToLayerPoint(clusterMarker.getLatLng()),\n\t\t// about 30 pixels between the markers\n\t\tradius = Math.max(30, markers.length * 30 / (2 * Math.PI)),\n\t\tspider = this._spider = {markers, clusterMarker, legs: []};\n\n\t\tmap.removeLayer(clusterMarker);\n\t\tmarkers.forEach((marker, i) => {\n\t\t\tconst angle = 2 * Math.PI * i / markers.length,\n\t\t\tlatlng = map.layerPointToLatLng(center.add(new Point(Math.cos(angle), Math.sin(angle)).multiplyBy(radius)));\n\t\t\tmarker._clusterLatLng = marker.getLatLng();\n\t\t\tmarker.setLatLng(latlng);\n\t\t\tconst leg = new Polyline([clusterMarker.getLatLng(), latlng], {className: 'maplair-cluster-leg', interactive: false, weight: 1.5});\n\t\t\tspider.legs.push(leg);\n\t\t\tmap.addLayer(leg);\n\t\t\tmap.addLayer(marker);\n\t\t});\n\t}\n\n\t// Moves the spiderfied markers back and shows their cluster again\n\t_unspiderfy() {\n\t\tconst spider = this._spider;\n\t\tif (!spider) { return; }\n\t\tthis._spider = null;\n\t\tconst map = this._map;\n\t\tfor (const leg of spider.legs) {\n\t\t\tmap?.removeLayer(leg);\n\t\t}\n\t\tfor (const marker of spider.markers) {\n\t\t\tmap?.removeLayer(marker);\n\t\t\tmarker.setLatLng(marker._clusterLatLng);\n\t\t\tdelete marker._clusterLatLng;\n\t\t}\n\t\tif (map && this._shown.has(spider.clusterMarker)) {\n\t\t\tmap.addLayer(spider.clusterMarker);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,IAAa,qBAAb,MAAa,2BAA2B,aAAa;CAEpD,OAAO,iBAAiB;EACvB,kBAAkB;EAClB,yBAAyB,KAAA;EACzB,qBAAqB;EACrB,mBAAmB;EACnB,oBAAoB,KA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./DefaultIcon.js";
|
|
2
|
-
|
|
2
|
+
// src/layer/marker/SvgIcon.js
|
|
3
3
|
/** @import {DefaultIconOptions} from './DefaultIcon.js' */
|
|
4
4
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
5
5
|
const markerPath = "M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z";
|
|
@@ -46,14 +46,12 @@ function svgElement(name, attributes, parent) {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
var SvgIcon = class SvgIcon extends DefaultIcon {
|
|
49
|
-
static {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
}
|
|
49
|
+
static defaultOptions = {
|
|
50
|
+
color: "#d4462c",
|
|
51
|
+
glyph: void 0,
|
|
52
|
+
glyphPath: void 0,
|
|
53
|
+
glyphColor: "white"
|
|
54
|
+
};
|
|
57
55
|
/**
|
|
58
56
|
* Creates an `SvgIcon` with the given options.
|
|
59
57
|
* @param {[options?: SvgIconOptions]} args The options.
|
|
@@ -110,7 +108,6 @@ var SvgIcon = class SvgIcon extends DefaultIcon {
|
|
|
110
108
|
return div;
|
|
111
109
|
}
|
|
112
110
|
};
|
|
113
|
-
//#endregion
|
|
114
111
|
export { SvgIcon };
|
|
115
112
|
|
|
116
113
|
//# sourceMappingURL=SvgIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SvgIcon.js","names":[],"sources":["../../../../src/layer/marker/SvgIcon.js"],"sourcesContent":["import {DefaultIcon} from './DefaultIcon.js';\n/** @import {DefaultIconOptions} from './DefaultIcon.js' */\n\nconst svgNS = 'http://www.w3.org/2000/svg';\n\n// The outline of the marker in a 500×820 view box (see
|
|
1
|
+
{"version":3,"file":"SvgIcon.js","names":[],"sources":["../../../../src/layer/marker/SvgIcon.js"],"sourcesContent":["import {DefaultIcon} from './DefaultIcon.js';\n/** @import {DefaultIconOptions} from './DefaultIcon.js' */\n\nconst svgNS = 'http://www.w3.org/2000/svg';\n\n// The outline of the marker in a 500×820 view box (see the iconUrl of DefaultIcon)\nconst markerPath = 'M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z',\nmarkerTransform = 'translate(-7889.1 -9807.44)scale(19.5417)',\nleafPath = 'm-90 2030 45-863a95 95 0 0 0-111-98l-859 151 116-320a65 65 0 0 0-20-73l-941-762 212-99a65 65 0 0 0 34-79l-186-572 542 115a65 65 0 0 0 73-38l105-247 423 454a65 65 0 0 0 111-57l-204-1052 327 189a65 65 0 0 0 91-27l332-652 332 652a65 65 0 0 0 91 27l327-189-204 1052a65 65 0 0 0 111 57l423-454 105 247a65 65 0 0 0 73 38l542-115-186 572a65 65 0 0 0 34 79l212 99-941 762a65 65 0 0 0-20 73l116 320-859-151a95 95 0 0 0-111 98l45 863z',\nleafTransform = 'translate(250 258)scale(.068)',\n// The center of the glyph and its size in the view box\nglyphX = 250,\nglyphY = 270,\nglyphSize = 230;\n\nfunction svgElement(name, attributes, parent) {\n\tconst el = document.createElementNS(svgNS, name);\n\tfor (const [key, value] of Object.entries(attributes)) {\n\t\tel.setAttribute(key, value);\n\t}\n\tparent?.appendChild(el);\n\treturn el;\n}\n\n/**\n * Options of `SvgIcon`.\n * @typedef {object} SvgIconOptions\n * @property {string} [color='#d4462c'] The fill color of the marker, any CSS color. The\n * outline is a darker shade of it.\n * @property {string} [glyph] A character or emoji (or short text) shown in the marker\n * instead of the maple leaf.\n * @property {string} [glyphPath] The path data of an SVG glyph in a 24×24 view box (like\n * Material Design Icons), shown in the marker instead of the maple leaf.\n * @property {string} [glyphColor='white'] The color of the glyph or the maple leaf.\n * @extends DefaultIconOptions\n */\n\n/**\n * A marker icon in the shape of the default marker (with its shadow), drawn as\n * inline SVG in any color and with an optional glyph – a character, an emoji or an\n * SVG path (e.g. of an icon set) – instead of the white maple leaf. No image per\n * color is needed, and it stays sharp on any screen.\n *\n * Inspired by the [Leaflet.awesome-markers](https://github.com/lennardv2/Leaflet.awesome-markers),\n * [leaflet-color-markers](https://github.com/pointhi/leaflet-color-markers) and\n * [Leaflet.ExtraMarkers](https://github.com/coryasilva/Leaflet.ExtraMarkers) plugins.\n *\n * @example\n * ```js\n * new Marker([47.27, 11.40], {icon: new SvgIcon({color: '#2a81cb', glyph: 'P'})}).addTo(map);\n * new Marker([47.28, 11.41], {icon: new SvgIcon({color: 'green', glyph: '🚲'})}).addTo(map);\n * // a 24×24 SVG path, e.g. from Material Design Icons\n * new Marker([47.29, 11.42], {icon: new SvgIcon({color: 'purple', glyphPath: 'M12 2L2 22h20z'})}).addTo(map);\n * ```\n */\nexport class SvgIcon extends DefaultIcon {\n\n\tstatic defaultOptions = {\n\t\tcolor: '#d4462c',\n\t\tglyph: undefined,\n\t\tglyphPath: undefined,\n\t\tglyphColor: 'white'\n\t};\n\n\t/**\n\t * Creates an `SvgIcon` with the given options.\n\t * @param {[options?: SvgIconOptions]} args The options.\n\t */\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.callInitHooks(SvgIcon);\n\t}\n\n\t/**\n\t * Called internally when the icon has to be shown, returns a `<div>` element with\n\t * the SVG of the marker, styled according to the options.\n\t * @param {HTMLElement} [oldIcon] The current element of the icon, to be reused if possible.\n\t * @returns {HTMLElement}\n\t */\n\tcreateIcon(oldIcon) {\n\t\tconst div = oldIcon?.tagName === 'DIV' ? oldIcon : document.createElement('div'),\n\t\toptions = this.options,\n\t\tsvg = svgElement('svg', {viewBox: '0 0 500 820', width: '100%', height: '100%', 'aria-hidden': 'true'});\n\n\t\tsvgElement('path', {\n\t\t\td: markerPath,\n\t\t\ttransform: markerTransform,\n\t\t\tfill: options.color,\n\t\t\tstroke: `color-mix(in srgb, ${options.color}, black 30%)`,\n\t\t\t'stroke-width': '1.1',\n\t\t\t'stroke-linejoin': 'miter'\n\t\t}, svg);\n\n\t\tif (options.glyphPath) {\n\t\t\tconst scale = glyphSize / 24;\n\t\t\tsvgElement('path', {\n\t\t\t\td: options.glyphPath,\n\t\t\t\tfill: options.glyphColor,\n\t\t\t\ttransform: `translate(${glyphX - glyphSize / 2} ${glyphY - glyphSize / 2})scale(${scale})`\n\t\t\t}, svg);\n\t\t} else if (options.glyph) {\n\t\t\tsvgElement('text', {\n\t\t\t\tx: glyphX,\n\t\t\t\ty: glyphY,\n\t\t\t\tfill: options.glyphColor,\n\t\t\t\t'font-size': glyphSize,\n\t\t\t\t'font-family': 'sans-serif',\n\t\t\t\t'font-weight': 'bold',\n\t\t\t\t'text-anchor': 'middle',\n\t\t\t\t'dominant-baseline': 'central'\n\t\t\t}, svg).textContent = options.glyph;\n\t\t} else {\n\t\t\tsvgElement('path', {d: leafPath, transform: leafTransform, fill: options.glyphColor}, svg);\n\t\t}\n\n\t\tdiv.replaceChildren(svg);\n\t\tthis._setIconStyles(div, 'icon');\n\t\treturn div;\n\t}\n}\n"],"mappings":";;;AAGA,MAAM,QAAQ;AAGd,MAAM,aAAa;AACnB,MAAA,kBAAkB;AAClB,MAAA,WAAW;AACX,MAAA,gBAAgB;AAEhB,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