maplair 4.0.0 → 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 +118 -0
- 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 +99 -17
- 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 +15 -5
- package/dist/esm/geo/LatLng.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 +1 -1
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -1
- package/dist/esm/geo/projection/Projection.Mercator.js +1 -1
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +1 -1
- package/dist/esm/geo/projection/Projection.SphericalMercator.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/PolyUtil.js +8 -27
- 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 +26 -42
- 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 +7 -9
- package/dist/esm/layer/marker/DivIcon.js.map +1 -1
- package/dist/esm/layer/marker/Icon.js +7 -10
- 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 +1 -2
- package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
- package/dist/esm/layer/marker/Marker.js +61 -33
- 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 +85 -97
- 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 +23 -7
- 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 +10 -6
- package/dist/esm/map/Map.Rotation.js.map +1 -1
- package/dist/esm/map/Map.js +116 -110
- 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 +19 -19
- package/dist/esm/map/handler/DragHandler.js.map +1 -1
- package/dist/esm/map/handler/KeyboardHandler.js +35 -35
- 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 +8009 -7369
- 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 +10040 -9381
- package/dist/maplair-src.js.map +1 -1
- package/dist/maplair.css +148 -98
- 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 +9 -11
- 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 +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 +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 +20 -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 +1 -1
- package/src/geo/projection/Projection.Mercator.js +1 -1
- package/src/geo/projection/Projection.SphericalMercator.js +1 -1
- package/src/geometry/LineUtil.js +47 -48
- package/src/geometry/PolyUtil.js +14 -43
- 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 +28 -43
- 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 +9 -11
- package/src/layer/marker/Icon.js +7 -10
- package/src/layer/marker/Marker.Drag.js +1 -1
- package/src/layer/marker/Marker.Move.js +1 -2
- package/src/layer/marker/Marker.js +81 -39
- 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 +103 -133
- 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 +25 -6
- package/src/layer/vector/Renderer.getRenderer.js +17 -17
- package/src/layer/vector/SVG.js +5 -5
- package/src/map/Map.Rotation.js +12 -4
- package/src/map/Map.js +142 -133
- package/src/map/handler/BoxZoomHandler.js +9 -8
- package/src/map/handler/DisplaceHandler.js +6 -8
- package/src/map/handler/DragHandler.js +25 -28
- package/src/map/handler/KeyboardHandler.js +42 -48
- 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
|
@@ -6,6 +6,8 @@ import {Point} from '../../geometry/Point.js';
|
|
|
6
6
|
import * as DomUtil from '../../dom/DomUtil.js';
|
|
7
7
|
import * as DomEvent from '../../dom/DomEvent.js';
|
|
8
8
|
import {MarkerDrag} from './Marker.Drag.js';
|
|
9
|
+
import {pointToGeoJSON} from '../GeoJSONUtil.js';
|
|
10
|
+
/** @import {Feature} from 'geojson' */
|
|
9
11
|
/** @import {Icon} from './Icon.js' */
|
|
10
12
|
/** @import {LatLngExpression} from '../../geo/LatLng.js' */
|
|
11
13
|
/** @import {PointExpression} from '../../geometry/Point.js' */
|
|
@@ -20,7 +22,7 @@ import {MarkerDrag} from './Marker.Drag.js';
|
|
|
20
22
|
* marker. See [Icon documentation](#Icon) for details on how to customize the marker
|
|
21
23
|
* icon. If not specified, a common instance of `DefaultIcon` is used.
|
|
22
24
|
* @property {boolean} [keyboard=true] Whether the marker can be tabbed to with a keyboard
|
|
23
|
-
* and clicked by pressing
|
|
25
|
+
* and, if interactive, clicked by pressing Enter or Space.
|
|
24
26
|
* @property {string} [title=''] Text for the browser tooltip that appear on marker hover
|
|
25
27
|
* (no tooltip by default).
|
|
26
28
|
* [Useful for accessibility](https://maplair.org/examples/accessibility/#markers-must-be-labelled).
|
|
@@ -84,31 +86,29 @@ import {MarkerDrag} from './Marker.Drag.js';
|
|
|
84
86
|
*/
|
|
85
87
|
export class Marker extends Layer {
|
|
86
88
|
|
|
87
|
-
static {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
}
|
|
89
|
+
static defaultOptions = {
|
|
90
|
+
icon: /* @__PURE__ */ new DefaultIcon(),
|
|
91
|
+
|
|
92
|
+
// Option inherited from "Interactive layer" abstract class
|
|
93
|
+
interactive: true,
|
|
94
|
+
|
|
95
|
+
keyboard: true,
|
|
96
|
+
title: '',
|
|
97
|
+
alt: 'Marker',
|
|
98
|
+
zIndexOffset: 0,
|
|
99
|
+
opacity: 1,
|
|
100
|
+
riseOnHover: false,
|
|
101
|
+
riseOffset: 250,
|
|
102
|
+
pane: 'markerPane',
|
|
103
|
+
shadowPane: 'shadowPane',
|
|
104
|
+
shadow: true,
|
|
105
|
+
bubblingPointerEvents: false,
|
|
106
|
+
autoPanOnFocus: true,
|
|
107
|
+
draggable: false,
|
|
108
|
+
autoPan: false,
|
|
109
|
+
autoPanPadding: [50, 50],
|
|
110
|
+
autoPanSpeed: 10
|
|
111
|
+
};
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Instantiates a Marker object given a geographical point and optionally an options
|
|
@@ -148,9 +148,10 @@ export class Marker extends Layer {
|
|
|
148
148
|
* @param {MaplairMap} map
|
|
149
149
|
*/
|
|
150
150
|
onRemove(map) {
|
|
151
|
-
if (this.dragging
|
|
152
|
-
|
|
153
|
-
this.dragging.
|
|
151
|
+
if (this.dragging) {
|
|
152
|
+
// remember whether dragging is on or off (`dragging.disable()`) for when the marker is added again
|
|
153
|
+
this.options.draggable = this.dragging.enabled();
|
|
154
|
+
if (this.options.draggable) { this.dragging.removeHooks(); }
|
|
154
155
|
}
|
|
155
156
|
delete this.dragging;
|
|
156
157
|
|
|
@@ -234,10 +235,6 @@ export class Marker extends Layer {
|
|
|
234
235
|
this.update();
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
if (this._popup) {
|
|
238
|
-
this.bindPopup(this._popup, this._popup.options);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
238
|
return this;
|
|
242
239
|
}
|
|
243
240
|
|
|
@@ -282,7 +279,7 @@ export class Marker extends Layer {
|
|
|
282
279
|
icon.title = options.title;
|
|
283
280
|
}
|
|
284
281
|
|
|
285
|
-
if (icon
|
|
282
|
+
if (icon instanceof HTMLImageElement) {
|
|
286
283
|
icon.alt = options.alt ?? '';
|
|
287
284
|
}
|
|
288
285
|
}
|
|
@@ -290,8 +287,11 @@ export class Marker extends Layer {
|
|
|
290
287
|
icon.classList.add(classToAdd);
|
|
291
288
|
|
|
292
289
|
if (options.keyboard) {
|
|
293
|
-
icon.tabIndex =
|
|
294
|
-
|
|
290
|
+
icon.tabIndex = 0;
|
|
291
|
+
if (options.interactive) {
|
|
292
|
+
icon.setAttribute('role', 'button');
|
|
293
|
+
}
|
|
294
|
+
DomEvent.on(icon, 'keydown', this._onKeyDown, this);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
this._icon = icon;
|
|
@@ -347,6 +347,7 @@ export class Marker extends Layer {
|
|
|
347
347
|
if (this.options.autoPanOnFocus) {
|
|
348
348
|
DomEvent.off(this._icon, 'focus', this._panOnFocus, this);
|
|
349
349
|
}
|
|
350
|
+
DomEvent.off(this._icon, 'keydown', this._onKeyDown, this);
|
|
350
351
|
|
|
351
352
|
this._icon.remove();
|
|
352
353
|
this.removeInteractiveTarget(this._icon);
|
|
@@ -361,7 +362,10 @@ export class Marker extends Layer {
|
|
|
361
362
|
_updateCulling() {
|
|
362
363
|
if (!this._icon || !this._map) { return; }
|
|
363
364
|
|
|
364
|
-
const
|
|
365
|
+
const map = this._map,
|
|
366
|
+
// computed once per view for all markers, reset by the map on `move`
|
|
367
|
+
bounds = map._cullingBounds ??= map.getBounds().pad(0.5),
|
|
368
|
+
visible = bounds.contains(this._latlng) ||
|
|
365
369
|
!!this.dragging?._draggable?._moving ||
|
|
366
370
|
this._icon.contains(document.activeElement);
|
|
367
371
|
|
|
@@ -416,6 +420,13 @@ export class Marker extends Layer {
|
|
|
416
420
|
|
|
417
421
|
_updateInteractive() {
|
|
418
422
|
if (!this._icon) { return; }
|
|
423
|
+
if (this.options.keyboard) {
|
|
424
|
+
if (this.options.interactive) {
|
|
425
|
+
this._icon.setAttribute('role', 'button');
|
|
426
|
+
} else {
|
|
427
|
+
this._icon.removeAttribute('role');
|
|
428
|
+
}
|
|
429
|
+
}
|
|
419
430
|
if (this.options.interactive) {
|
|
420
431
|
this._initInteraction();
|
|
421
432
|
if (this._draggableBeforeNonInteractive) {
|
|
@@ -438,6 +449,14 @@ export class Marker extends Layer {
|
|
|
438
449
|
this.addInteractiveTarget(this._icon);
|
|
439
450
|
|
|
440
451
|
if (MarkerDrag) {
|
|
452
|
+
// When the icon element is reused, the drag handler still refers to it. Keep that handler, because
|
|
453
|
+
// replacing it ends a drag in progress and forgets that the marker has just been dragged.
|
|
454
|
+
if (this.dragging?._draggable?._element === this._icon) {
|
|
455
|
+
// the icon has reset the class names of the element
|
|
456
|
+
this._icon.classList.toggle('maplair-marker-draggable', this.dragging.enabled());
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
|
|
441
460
|
let draggable = this.options.draggable;
|
|
442
461
|
if (this.dragging) {
|
|
443
462
|
draggable = this.dragging.enabled();
|
|
@@ -484,11 +503,11 @@ export class Marker extends Layer {
|
|
|
484
503
|
const opacity = this.options.opacity;
|
|
485
504
|
|
|
486
505
|
if (this._icon) {
|
|
487
|
-
this._icon.style.opacity = opacity
|
|
506
|
+
this._icon.style.opacity = `${opacity}`;
|
|
488
507
|
}
|
|
489
508
|
|
|
490
509
|
if (this._shadow) {
|
|
491
|
-
this._shadow.style.opacity = opacity
|
|
510
|
+
this._shadow.style.opacity = `${opacity}`;
|
|
492
511
|
}
|
|
493
512
|
}
|
|
494
513
|
|
|
@@ -500,6 +519,17 @@ export class Marker extends Layer {
|
|
|
500
519
|
this._updateZIndex(0);
|
|
501
520
|
}
|
|
502
521
|
|
|
522
|
+
_onKeyDown(e) {
|
|
523
|
+
// a key pressed on a focusable element inside a DivIcon (e.g. a <button>) already clicks it natively
|
|
524
|
+
if (this.options.interactive && e.target === this._icon && !e.repeat && (e.key === 'Enter' || e.key === ' ')) {
|
|
525
|
+
e.preventDefault(); // stop Space from scrolling the page
|
|
526
|
+
// lets a popup opened by the click take the focus, see Popup.onAdd()
|
|
527
|
+
this._clickedByKeyboard = true;
|
|
528
|
+
this._icon.click();
|
|
529
|
+
this._clickedByKeyboard = false;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
503
533
|
_panOnFocus() {
|
|
504
534
|
const map = this._map;
|
|
505
535
|
if (!map) { return; }
|
|
@@ -521,4 +551,16 @@ export class Marker extends Layer {
|
|
|
521
551
|
_getTooltipAnchor() {
|
|
522
552
|
return this.options.icon.options.tooltipAnchor;
|
|
523
553
|
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Coordinates values are rounded with [`formatNum`](#util-formatnum) to the
|
|
557
|
+
* given `precision`. Returns a [`GeoJSON`](https://en.wikipedia.org/wiki/GeoJSON)
|
|
558
|
+
* representation of the marker (as a GeoJSON `Point` Feature).
|
|
559
|
+
* @group Other methods
|
|
560
|
+
* @param {number|false} [precision]
|
|
561
|
+
* @returns {Feature}
|
|
562
|
+
*/
|
|
563
|
+
toGeoJSON(precision) {
|
|
564
|
+
return pointToGeoJSON(this, precision);
|
|
565
|
+
}
|
|
524
566
|
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import {FeatureGroup} from '../FeatureGroup.js';
|
|
2
|
+
import {Marker} from './Marker.js';
|
|
3
|
+
import {DivIcon} from './DivIcon.js';
|
|
4
|
+
import {Polyline} from '../vector/Polyline.js';
|
|
5
|
+
import {LatLng} from '../../geo/LatLng.js';
|
|
6
|
+
import {LatLngBounds} from '../../geo/LatLngBounds.js';
|
|
7
|
+
import {Point} from '../../geometry/Point.js';
|
|
8
|
+
import {I18n} from '../../core/I18n.js';
|
|
9
|
+
/** @import {Layer, LayerOptions} from '../Layer.js' */
|
|
10
|
+
/** @import {MaplairEvent} from '../../core/Events.js' */
|
|
11
|
+
|
|
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
|
+
/**
|
|
23
|
+
* The event object of `clusterclick`.
|
|
24
|
+
* @typedef {object} ClusterClickEvent
|
|
25
|
+
* @property {MarkerCluster} cluster The clicked cluster.
|
|
26
|
+
* @property {Marker} layer The marker of the cluster.
|
|
27
|
+
* @property {Event} originalEvent The DOM event of the click.
|
|
28
|
+
* @extends MaplairEvent
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Options of `MarkerClusterGroup`.
|
|
33
|
+
* @typedef {object} MarkerClusterGroupOptions
|
|
34
|
+
* @property {number} [maxClusterRadius=80] The maximum distance in pixels between the
|
|
35
|
+
* first marker of a cluster and the other ones.
|
|
36
|
+
* @property {number} [disableClusteringAtZoom] From this zoom level on, the markers are
|
|
37
|
+
* shown without clustering.
|
|
38
|
+
* @property {boolean} [zoomToBoundsOnClick=true] Whether a click on a cluster zooms to
|
|
39
|
+
* the bounds of its markers.
|
|
40
|
+
* @property {boolean} [spiderfyOnMaxZoom=true] Whether a click on a cluster which
|
|
41
|
+
* zooming in doesn't split (e.g. markers at the same position, or at the maximum
|
|
42
|
+
* zoom) spreads its markers in a circle around it ("spiderfies" them). Until the next
|
|
43
|
+
* click on the map, change of the zoom or of the layers, their `getLatLng()` returns
|
|
44
|
+
* the spread positions. Clusters can also be activated with the <kbd>Enter</kbd> key.
|
|
45
|
+
* @property {(cluster: MarkerCluster) => DivIcon} [iconCreateFunction] Returns the icon
|
|
46
|
+
* of a cluster, by default a circle with the count, sized and colored by the
|
|
47
|
+
* `maplair-cluster-small`, `-medium` and `-large` CSS classes (for up to 9, 99 and
|
|
48
|
+
* more markers).
|
|
49
|
+
* @extends LayerOptions
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A layer group clustering its markers: nearby markers are shown as one marker with
|
|
54
|
+
* their count, which zooms in to them when clicked. The clusters are computed for
|
|
55
|
+
* the zoom level of the map, and only the ones near the view are on the map, so
|
|
56
|
+
* that tens of thousands of markers stay fast. Accepts all layers with a single
|
|
57
|
+
* position (`getLatLng()`), e.g. markers and circle markers; other layers are shown
|
|
58
|
+
* without clustering. Events of the markers (e.g. `click`) propagate to the group.
|
|
59
|
+
*
|
|
60
|
+
* Replaces the [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster)
|
|
61
|
+
* plugin for the common use cases, with its option names; without animations and
|
|
62
|
+
* cluster coverage polygons.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```js
|
|
66
|
+
* const clusters = new MarkerClusterGroup();
|
|
67
|
+
* for (const [lat, lng, name] of places) {
|
|
68
|
+
* clusters.addLayer(new Marker([lat, lng]).bindPopup(name));
|
|
69
|
+
* }
|
|
70
|
+
* map.addLayer(clusters);
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @fires MarkerClusterGroup#clusterclick {ClusterClickEvent} Fired when a cluster is
|
|
74
|
+
* clicked.
|
|
75
|
+
*/
|
|
76
|
+
export class MarkerClusterGroup extends FeatureGroup {
|
|
77
|
+
|
|
78
|
+
static defaultOptions = {
|
|
79
|
+
maxClusterRadius: 80,
|
|
80
|
+
disableClusteringAtZoom: undefined,
|
|
81
|
+
zoomToBoundsOnClick: true,
|
|
82
|
+
spiderfyOnMaxZoom: true,
|
|
83
|
+
iconCreateFunction: undefined
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Creates a cluster group with the given layers.
|
|
88
|
+
* @param {Layer[]} [layers]
|
|
89
|
+
* @param {MarkerClusterGroupOptions} [options]
|
|
90
|
+
*/
|
|
91
|
+
constructor(layers, options) {
|
|
92
|
+
super(layers, options);
|
|
93
|
+
// the layers on the map: cluster markers, and the markers not in a cluster
|
|
94
|
+
this._shown = new Set();
|
|
95
|
+
this.callInitHooks(MarkerClusterGroup);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Adds the given layer to the group.
|
|
100
|
+
* @param {Layer} layer
|
|
101
|
+
* @returns {this}
|
|
102
|
+
*/
|
|
103
|
+
addLayer(layer) {
|
|
104
|
+
return this.addLayers([layer]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Adds the given layers to the group, clustering once instead of for each layer.
|
|
109
|
+
* @param {Layer[]} layers
|
|
110
|
+
* @returns {this}
|
|
111
|
+
*/
|
|
112
|
+
addLayers(layers) {
|
|
113
|
+
for (const layer of layers) {
|
|
114
|
+
if (!this.hasLayer(layer)) {
|
|
115
|
+
layer.addEventParent(this).on('dragend', this._onDragEnd, this);
|
|
116
|
+
this._layers[this.getLayerId(layer)] = layer;
|
|
117
|
+
this.fire('layeradd', {layer});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return this.refreshClusters();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Removes the given layer from the group.
|
|
125
|
+
* @param {Layer|number} layer The layer or its id.
|
|
126
|
+
* @returns {this}
|
|
127
|
+
*/
|
|
128
|
+
removeLayer(layer) {
|
|
129
|
+
layer = typeof layer === 'number' ? this._layers[layer] : layer;
|
|
130
|
+
if (!layer || !this.hasLayer(layer)) {
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
this._unspiderfy();
|
|
134
|
+
layer.removeEventParent(this).off('dragend', this._onDragEnd, this);
|
|
135
|
+
delete this._layers[this.getLayerId(layer)];
|
|
136
|
+
if (this._shown?.delete(layer)) {
|
|
137
|
+
this._map.removeLayer(layer);
|
|
138
|
+
}
|
|
139
|
+
this.fire('layerremove', {layer});
|
|
140
|
+
return this.refreshClusters();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Removes all layers from the group.
|
|
145
|
+
* @returns {this}
|
|
146
|
+
*/
|
|
147
|
+
clearLayers() {
|
|
148
|
+
this._unspiderfy();
|
|
149
|
+
for (const layer of this.getLayers()) {
|
|
150
|
+
layer.removeEventParent(this).off('dragend', this._onDragEnd, this);
|
|
151
|
+
this.fire('layerremove', {layer});
|
|
152
|
+
}
|
|
153
|
+
this._layers = {};
|
|
154
|
+
return this.refreshClusters();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Computes the clusters again, e.g. after markers of the group were moved with
|
|
159
|
+
* `setLatLng()`. Happens by itself when the zoom changes or layers are added or
|
|
160
|
+
* removed.
|
|
161
|
+
* @returns {this}
|
|
162
|
+
*/
|
|
163
|
+
refreshClusters() {
|
|
164
|
+
this._clusters = null;
|
|
165
|
+
if (this._map) {
|
|
166
|
+
this._update();
|
|
167
|
+
}
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
onAdd() {
|
|
172
|
+
this._clusters = null;
|
|
173
|
+
this._update();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
onRemove(map) {
|
|
177
|
+
this._unspiderfy();
|
|
178
|
+
for (const layer of this._shown) {
|
|
179
|
+
map.removeLayer(layer);
|
|
180
|
+
}
|
|
181
|
+
this._shown.clear();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getEvents() {
|
|
185
|
+
return {
|
|
186
|
+
moveend: this._update,
|
|
187
|
+
zoomstart: this._unspiderfy,
|
|
188
|
+
click: this._unspiderfy
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// A marker of the group was dragged: keep its new position, also if spiderfied
|
|
193
|
+
_onDragEnd({target: marker}) {
|
|
194
|
+
if (marker._clusterLatLng) {
|
|
195
|
+
marker._clusterLatLng = marker.getLatLng();
|
|
196
|
+
}
|
|
197
|
+
this.refreshClusters();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Shows the clusters and single layers near the view. The clusters are computed for
|
|
201
|
+
// each zoom level and when the layers change, not when panning, which keeps the
|
|
202
|
+
// cluster markers and spiderfied markers.
|
|
203
|
+
_update() {
|
|
204
|
+
const map = this._map,
|
|
205
|
+
zoom = map.getZoom();
|
|
206
|
+
if (!this._clusters || this._clustersZoom !== zoom) {
|
|
207
|
+
this._unspiderfy();
|
|
208
|
+
this._clusters = this._cluster();
|
|
209
|
+
this._clustersZoom = zoom;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// the view and half of it around, in projected pixels
|
|
213
|
+
const view = map.getPixelBounds().pad(0.5),
|
|
214
|
+
shown = new Set();
|
|
215
|
+
for (const cluster of this._clusters) {
|
|
216
|
+
const {markers, point} = cluster;
|
|
217
|
+
if (markers.length > 1) {
|
|
218
|
+
if (view.contains(point)) {
|
|
219
|
+
cluster.marker ??= this._createClusterMarker(cluster);
|
|
220
|
+
shown.add(cluster.marker);
|
|
221
|
+
}
|
|
222
|
+
} else if (!markers[0].getLatLng || view.contains(point)) {
|
|
223
|
+
shown.add(markers[0]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const spiderfied = this._spider?.clusterMarker;
|
|
228
|
+
for (const layer of this._shown) {
|
|
229
|
+
if (!shown.has(layer)) {
|
|
230
|
+
map.removeLayer(layer);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
for (const layer of shown) {
|
|
234
|
+
if (layer !== spiderfied) {
|
|
235
|
+
map.addLayer(layer);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
this._shown = shown;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Greedy clustering on a grid with cells of the cluster radius: each marker joins the
|
|
242
|
+
// nearest cluster whose first marker is within the radius, or starts a new one
|
|
243
|
+
_cluster() {
|
|
244
|
+
const map = this._map,
|
|
245
|
+
zoom = map.getZoom(),
|
|
246
|
+
radius = this.options.maxClusterRadius,
|
|
247
|
+
noClustering = zoom >= (this.options.disableClusteringAtZoom ?? Infinity),
|
|
248
|
+
grid = new Map(),
|
|
249
|
+
clusters = [];
|
|
250
|
+
|
|
251
|
+
for (const layer of Object.values(this._layers)) {
|
|
252
|
+
if (!layer.getLatLng) {
|
|
253
|
+
clusters.push({markers: [layer]});
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const point = map.project(layer.getLatLng(), zoom),
|
|
257
|
+
x = Math.floor(point.x / radius),
|
|
258
|
+
y = Math.floor(point.y / radius);
|
|
259
|
+
let nearest, minDistance = radius;
|
|
260
|
+
for (let i = x - 1; i <= x + 1; i++) {
|
|
261
|
+
for (let j = y - 1; j <= y + 1; j++) {
|
|
262
|
+
for (const cluster of noClustering ? [] : grid.get(`${i}:${j}`) ?? []) {
|
|
263
|
+
const distance = cluster.point.distanceTo(point);
|
|
264
|
+
if (distance <= minDistance) {
|
|
265
|
+
nearest = cluster;
|
|
266
|
+
minDistance = distance;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (nearest) {
|
|
272
|
+
nearest.markers.push(layer);
|
|
273
|
+
} else {
|
|
274
|
+
const cluster = {point, markers: [layer]},
|
|
275
|
+
key = `${x}:${y}`;
|
|
276
|
+
if (!grid.has(key)) {
|
|
277
|
+
grid.set(key, []);
|
|
278
|
+
}
|
|
279
|
+
grid.get(key).push(cluster);
|
|
280
|
+
clusters.push(cluster);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
for (const cluster of clusters) {
|
|
285
|
+
if (cluster.markers.length > 1) {
|
|
286
|
+
const latlngs = cluster.markers.map(marker => marker.getLatLng());
|
|
287
|
+
cluster.latlng = new LatLng(
|
|
288
|
+
latlngs.reduce((sum, latlng) => sum + latlng.lat, 0) / latlngs.length,
|
|
289
|
+
latlngs.reduce((sum, latlng) => sum + latlng.lng, 0) / latlngs.length);
|
|
290
|
+
cluster.point = map.project(cluster.latlng, zoom);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return clusters;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
_createClusterMarker({latlng, markers}) {
|
|
297
|
+
const cluster = {latlng, bounds: new LatLngBounds(markers.map(marker => marker.getLatLng())), markers, count: markers.length},
|
|
298
|
+
icon = this.options.iconCreateFunction?.(cluster) ?? this._createIcon(cluster),
|
|
299
|
+
marker = new Marker(latlng, {icon, title: I18n.translate('{count} markers', {count: cluster.count})});
|
|
300
|
+
marker.on('click', e => this._onClusterClick(cluster, marker, e));
|
|
301
|
+
return marker;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
_createIcon({count}) {
|
|
305
|
+
const size = count < 10 ? 'small' : count < 100 ? 'medium' : 'large';
|
|
306
|
+
return new DivIcon({
|
|
307
|
+
html: `<span>${count}</span>`,
|
|
308
|
+
className: `maplair-cluster maplair-cluster-${size}`,
|
|
309
|
+
iconSize: {small: 32, medium: 38, large: 44}[size]
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
_onClusterClick(cluster, marker, e) {
|
|
314
|
+
this.fire('clusterclick', {cluster, layer: marker, originalEvent: e.originalEvent});
|
|
315
|
+
const map = this._map,
|
|
316
|
+
maxZoom = map.getMaxZoom(),
|
|
317
|
+
{bounds} = cluster,
|
|
318
|
+
// zooming in splits the cluster if its markers are farther apart at the maximum zoom
|
|
319
|
+
splittable = map.getZoom() < maxZoom && (this.options.disableClusteringAtZoom <= maxZoom ||
|
|
320
|
+
map.project(bounds.getNorthEast(), maxZoom).distanceTo(map.project(bounds.getSouthWest(), maxZoom)) > this.options.maxClusterRadius);
|
|
321
|
+
if (splittable) {
|
|
322
|
+
if (this.options.zoomToBoundsOnClick) {
|
|
323
|
+
map.fitBounds(bounds);
|
|
324
|
+
}
|
|
325
|
+
} else if (this.options.spiderfyOnMaxZoom) {
|
|
326
|
+
this._spiderfy(cluster, marker);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Spreads the markers of the cluster in a circle around it, with legs to the center
|
|
331
|
+
_spiderfy({markers}, clusterMarker) {
|
|
332
|
+
this._unspiderfy();
|
|
333
|
+
const map = this._map,
|
|
334
|
+
center = map.latLngToLayerPoint(clusterMarker.getLatLng()),
|
|
335
|
+
// about 30 pixels between the markers
|
|
336
|
+
radius = Math.max(30, markers.length * 30 / (2 * Math.PI)),
|
|
337
|
+
spider = this._spider = {markers, clusterMarker, legs: []};
|
|
338
|
+
|
|
339
|
+
map.removeLayer(clusterMarker);
|
|
340
|
+
markers.forEach((marker, i) => {
|
|
341
|
+
const angle = 2 * Math.PI * i / markers.length,
|
|
342
|
+
latlng = map.layerPointToLatLng(center.add(new Point(Math.cos(angle), Math.sin(angle)).multiplyBy(radius)));
|
|
343
|
+
marker._clusterLatLng = marker.getLatLng();
|
|
344
|
+
marker.setLatLng(latlng);
|
|
345
|
+
const leg = new Polyline([clusterMarker.getLatLng(), latlng], {className: 'maplair-cluster-leg', interactive: false, weight: 1.5});
|
|
346
|
+
spider.legs.push(leg);
|
|
347
|
+
map.addLayer(leg);
|
|
348
|
+
map.addLayer(marker);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Moves the spiderfied markers back and shows their cluster again
|
|
353
|
+
_unspiderfy() {
|
|
354
|
+
const spider = this._spider;
|
|
355
|
+
if (!spider) { return; }
|
|
356
|
+
this._spider = null;
|
|
357
|
+
const map = this._map;
|
|
358
|
+
for (const leg of spider.legs) {
|
|
359
|
+
map?.removeLayer(leg);
|
|
360
|
+
}
|
|
361
|
+
for (const marker of spider.markers) {
|
|
362
|
+
map?.removeLayer(marker);
|
|
363
|
+
marker.setLatLng(marker._clusterLatLng);
|
|
364
|
+
delete marker._clusterLatLng;
|
|
365
|
+
}
|
|
366
|
+
if (map && this._shown.has(spider.clusterMarker)) {
|
|
367
|
+
map.addLayer(spider.clusterMarker);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
@@ -3,7 +3,7 @@ import {DefaultIcon} from './DefaultIcon.js';
|
|
|
3
3
|
|
|
4
4
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
5
5
|
|
|
6
|
-
// The outline of the marker in a 500×820 view box (see
|
|
6
|
+
// The outline of the marker in a 500×820 view box (see the iconUrl of DefaultIcon)
|
|
7
7
|
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',
|
|
8
8
|
markerTransform = 'translate(-7889.1 -9807.44)scale(19.5417)',
|
|
9
9
|
leafPath = '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',
|
|
@@ -55,14 +55,12 @@ function svgElement(name, attributes, parent) {
|
|
|
55
55
|
*/
|
|
56
56
|
export class SvgIcon extends DefaultIcon {
|
|
57
57
|
|
|
58
|
-
static {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
}
|
|
58
|
+
static defaultOptions = {
|
|
59
|
+
color: '#d4462c',
|
|
60
|
+
glyph: undefined,
|
|
61
|
+
glyphPath: undefined,
|
|
62
|
+
glyphColor: 'white'
|
|
63
|
+
};
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
66
|
* Creates an `SvgIcon` with the given options.
|