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,70 +0,0 @@
|
|
|
1
|
-
import { MarkerDrag } from "./Marker.Drag.js";
|
|
2
|
-
import { Marker } from "./Marker.js";
|
|
3
|
-
//#region src/layer/marker/Marker.Rotation.js
|
|
4
|
-
const { _setPos: setPos } = Marker.prototype, { _onDrag: onDrag } = MarkerDrag.prototype;
|
|
5
|
-
/**
|
|
6
|
-
* Options of `Marker` for the rotation of marker icons, see the
|
|
7
|
-
* [marker rotation](#marker-setrotationangle).
|
|
8
|
-
* @typedef {object} MarkerRotationOptions
|
|
9
|
-
* @lends MarkerOptions
|
|
10
|
-
* @property {number} [rotationAngle=0] Rotation of the icon in degrees, clockwise, e.g.
|
|
11
|
-
* for the heading of a vehicle. On a rotated map, the angle is relative to the screen,
|
|
12
|
-
* or to north with `rotateWithView`. The shadow is not rotated.
|
|
13
|
-
* @property {string} [rotationOrigin] The CSS
|
|
14
|
-
* [`transform-origin`](https://developer.mozilla.org/docs/Web/CSS/transform-origin) to
|
|
15
|
-
* rotate the icon around, e.g. `'center'`. By default the anchor of the icon.
|
|
16
|
-
* @property {boolean} [rotateWithView=false] On a rotated map (see
|
|
17
|
-
* `MaplairMap.setBearing()`), whether the icon rotates with the map (e.g. for arrows
|
|
18
|
-
* pointing in a geographic direction) instead of staying upright.
|
|
19
|
-
*/
|
|
20
|
-
Marker.include({ options: {
|
|
21
|
-
rotationAngle: 0,
|
|
22
|
-
rotationOrigin: void 0,
|
|
23
|
-
rotateWithView: false
|
|
24
|
-
} });
|
|
25
|
-
/** @typedef {typeof markerRotationMethods} MarkerRotationMethods */
|
|
26
|
-
Marker.include({
|
|
27
|
-
/**
|
|
28
|
-
* Changes the [`rotationAngle`](#markeroptions-rotationangle) of the icon.
|
|
29
|
-
* @group Marker rotation
|
|
30
|
-
* @param {number} angle
|
|
31
|
-
* @returns {this}
|
|
32
|
-
*/
|
|
33
|
-
setRotationAngle(angle) {
|
|
34
|
-
this.options.rotationAngle = angle;
|
|
35
|
-
return this.update();
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* Changes the [`rotationOrigin`](#markeroptions-rotationorigin) of the icon.
|
|
39
|
-
* @group Marker rotation
|
|
40
|
-
* @param {string} origin
|
|
41
|
-
* @returns {this}
|
|
42
|
-
*/
|
|
43
|
-
setRotationOrigin(origin) {
|
|
44
|
-
this.options.rotationOrigin = origin;
|
|
45
|
-
return this.update();
|
|
46
|
-
},
|
|
47
|
-
_setPos(pos) {
|
|
48
|
-
setPos.call(this, pos);
|
|
49
|
-
this._rotateIcon();
|
|
50
|
-
},
|
|
51
|
-
_rotateIcon() {
|
|
52
|
-
const bearing = this.options.rotateWithView ? 0 : this._map?.getBearing?.() ?? 0;
|
|
53
|
-
this._rotateElement(this._icon, bearing + (this.options.rotationAngle || 0), this.options.rotationOrigin);
|
|
54
|
-
this._rotateElement(this._shadow, bearing);
|
|
55
|
-
},
|
|
56
|
-
_rotateElement(el, angle, origin) {
|
|
57
|
-
if (!el) return;
|
|
58
|
-
if (angle % 360) {
|
|
59
|
-
el.style.transform += ` rotate(${angle}deg)`;
|
|
60
|
-
el.style.transformOrigin = origin ?? `${-parseFloat(el.style.marginLeft) || 0}px ${-parseFloat(el.style.marginTop) || 0}px`;
|
|
61
|
-
} else if (el.style.transformOrigin) el.style.transformOrigin = "";
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
MarkerDrag.include({ _onDrag(e) {
|
|
65
|
-
onDrag.call(this, e);
|
|
66
|
-
this._marker._rotateIcon();
|
|
67
|
-
} });
|
|
68
|
-
//#endregion
|
|
69
|
-
|
|
70
|
-
//# sourceMappingURL=Marker.Rotation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.Rotation.js","names":[],"sources":["../../../../src/layer/marker/Marker.Rotation.js"],"sourcesContent":["import {Marker} from './Marker.js';\nimport {MarkerDrag} from './Marker.Drag.js';\n\n// The methods extended below\nconst {_setPos: setPos} = Marker.prototype,\n{_onDrag: onDrag} = MarkerDrag.prototype;\n\n/**\n * Options of `Marker` for the rotation of marker icons, see the\n * [marker rotation](#marker-setrotationangle).\n * @typedef {object} MarkerRotationOptions\n * @lends MarkerOptions\n * @property {number} [rotationAngle=0] Rotation of the icon in degrees, clockwise, e.g.\n * for the heading of a vehicle. On a rotated map, the angle is relative to the screen,\n * or to north with `rotateWithView`. The shadow is not rotated.\n * @property {string} [rotationOrigin] The CSS\n * [`transform-origin`](https://developer.mozilla.org/docs/Web/CSS/transform-origin) to\n * rotate the icon around, e.g. `'center'`. By default the anchor of the icon.\n * @property {boolean} [rotateWithView=false] On a rotated map (see\n * `MaplairMap.setBearing()`), whether the icon rotates with the map (e.g. for arrows\n * pointing in a geographic direction) instead of staying upright.\n */\nMarker.include({\n\toptions: {\n\t\trotationAngle: 0,\n\t\trotationOrigin: undefined,\n\t\trotateWithView: false\n\t}\n});\n\n/**\n * Methods of `Marker` for the rotation of marker icons, an optional feature: import\n * this module to add the `rotationAngle`, `rotationOrigin` and `rotateWithView` options\n * and `setRotationAngle()`/`setRotationOrigin()` to `Marker` (it is also part of the\n * map rotation, see `MaplairMap.setBearing()`).\n *\n * ```js\n * import 'maplair/marker-rotation';\n *\n * new Marker([47.27, 11.40], {rotationAngle: 45}).addTo(map);\n * ```\n *\n * Inspired by the [Leaflet.RotatedMarker](https://github.com/bbecquet/Leaflet.RotatedMarker) plugin.\n * @lends Marker.prototype\n */\nconst markerRotationMethods = {\n\t/**\n\t * Changes the [`rotationAngle`](#markeroptions-rotationangle) of the icon.\n\t * @group Marker rotation\n\t * @param {number} angle\n\t * @returns {this}\n\t */\n\tsetRotationAngle(angle) {\n\t\tthis.options.rotationAngle = angle;\n\t\treturn this.update();\n\t},\n\n\t/**\n\t * Changes the [`rotationOrigin`](#markeroptions-rotationorigin) of the icon.\n\t * @group Marker rotation\n\t * @param {string} origin\n\t * @returns {this}\n\t */\n\tsetRotationOrigin(origin) {\n\t\tthis.options.rotationOrigin = origin;\n\t\treturn this.update();\n\t},\n\n\t_setPos(pos) {\n\t\tsetPos.call(this, pos);\n\t\tthis._rotateIcon();\n\t},\n\n\t// Rotates the icon by the `rotationAngle`, and keeps the icon and the shadow\n\t// upright on a rotated map\n\t_rotateIcon() {\n\t\tconst bearing = this.options.rotateWithView ? 0 : (this._map?.getBearing?.() ?? 0);\n\t\tthis._rotateElement(this._icon, bearing + (this.options.rotationAngle || 0), this.options.rotationOrigin);\n\t\tthis._rotateElement(this._shadow, bearing);\n\t},\n\n\t// Rotates an element positioned with `DomUtil.setPosition()` around its anchor (or `origin`)\n\t_rotateElement(el, angle, origin) {\n\t\tif (!el) { return; }\n\t\tif (angle % 360) {\n\t\t\tel.style.transform += ` rotate(${angle}deg)`;\n\t\t\tel.style.transformOrigin = origin ?? `${-parseFloat(el.style.marginLeft) || 0}px ${-parseFloat(el.style.marginTop) || 0}px`;\n\t\t} else if (el.style.transformOrigin) {\n\t\t\tel.style.transformOrigin = '';\n\t\t}\n\t}\n};\n/** @typedef {typeof markerRotationMethods} MarkerRotationMethods */\n\nMarker.include(markerRotationMethods);\n\nMarkerDrag.include({\n\t_onDrag(e) {\n\t\tonDrag.call(this, e);\n\t\t// dragging positions the icon without the rotation\n\t\tthis._marker._rotateIcon();\n\t}\n});\n"],"mappings":";;;AAIA,MAAM,EAAC,SAAS,WAAU,OAAO,WACjC,EAAC,SAAS,WAAU,WAAW;;;;;;;;;;;;;;;;AAiB/B,OAAO,QAAQ,EACd,SAAS;CACR,eAAe;CACf,gBAAgB,KAAA;CAChB,gBAAgB;AACjB,EACD,CAAC;;AAkED,OAAO,QAAQ;;;;;;;CA1Cd,iBAAiB,OAAO;EACvB,KAAK,QAAQ,gBAAgB;EAC7B,OAAO,KAAK,OAAO;CACpB;;;;;;;CAQA,kBAAkB,QAAQ;EACzB,KAAK,QAAQ,iBAAiB;EAC9B,OAAO,KAAK,OAAO;CACpB;CAEA,QAAQ,KAAK;EACZ,OAAO,KAAK,MAAM,GAAG;EACrB,KAAK,YAAY;CAClB;CAIA,cAAc;EACb,MAAM,UAAU,KAAK,QAAQ,iBAAiB,IAAK,KAAK,MAAM,aAAa,KAAK;EAChF,KAAK,eAAe,KAAK,OAAO,WAAW,KAAK,QAAQ,iBAAiB,IAAI,KAAK,QAAQ,cAAc;EACxG,KAAK,eAAe,KAAK,SAAS,OAAO;CAC1C;CAGA,eAAe,IAAI,OAAO,QAAQ;EACjC,IAAI,CAAC,IAAM;EACX,IAAI,QAAQ,KAAK;GAChB,GAAG,MAAM,aAAa,WAAW,MAAM;GACvC,GAAG,MAAM,kBAAkB,UAAU,GAAG,CAAC,WAAW,GAAG,MAAM,UAAU,KAAK,EAAE,KAAK,CAAC,WAAW,GAAG,MAAM,SAAS,KAAK,EAAE;EACzH,OAAO,IAAI,GAAG,MAAM,iBACnB,GAAG,MAAM,kBAAkB;CAE7B;AAIkC,CAAC;AAEpC,WAAW,QAAQ,EAClB,QAAQ,GAAG;CACV,OAAO,KAAK,MAAM,CAAC;CAEnB,KAAK,QAAQ,YAAY;AAC1B,EACD,CAAC"}
|
package/dist/images/layers.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26"><path fill="#b9b9b9" d="m.032 17.056 13-8 13 8-13 8z"/><path fill="#737373" d="m.032 17.056-.032.93 13 8 13-8 .032-.93-13 8z"/><path fill="#cdcdcd" d="m0 13.076 13-8 13 8-13 8z"/><path fill="#737373" d="M0 13.076v.91l13 8 13-8v-.91l-13 8z"/><path fill="#e9e9e9" fill-opacity=".585" stroke="#797979" stroke-width=".1" d="m0 8.986 13-8 13 8-13 8-13-8"/><path fill="#737373" d="M0 8.986v1l13 8 13-8v-1l-13 8z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round" viewBox="0 0 500 820"><defs><linearGradient id="a" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 478.727 62.272)scale(37.566)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#C2331B"/><stop offset="1" stop-color="#E2603F"/></linearGradient><linearGradient id="b" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 468.484 54.002)scale(19.053)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8F2D20"/><stop offset="1" stop-color="#B23A27"/></linearGradient></defs><path fill="url(#a)" stroke="url(#b)" stroke-width="1.1" stroke-linejoin="miter" stroke-miterlimit="10" d="M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z" transform="translate(-7889.1 -9807.44)scale(19.5417)"/><path fill="#FFF" d="m-90 2030 45-863a95 95 0 0 0-111-98l-859 151 116-320a65 65 0 0 0-20-73l-941-762 212-99a65 65 0 0 0 34-79l-186-572 542 115a65 65 0 0 0 73-38l105-247 423 454a65 65 0 0 0 111-57l-204-1052 327 189a65 65 0 0 0 91-27l332-652 332 652a65 65 0 0 0 91 27l327-189-204 1052a65 65 0 0 0 111 57l423-454 105 247a65 65 0 0 0 73 38l542-115-186 572a65 65 0 0 0 34 79l212 99-941 762a65 65 0 0 0-20 73l116 320-859-151a95 95 0 0 0-111 98l45 863z" transform="translate(250 258)scale(.068)"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 817.2 820"><radialGradient id="a" cx="526.6" cy="486.836" r="478.154" fx="275.876" fy="893.983" gradientUnits="userSpaceOnUse"><stop offset="0" style="stop-color:#5c5c5c;stop-opacity:.9477"/><stop offset=".112" style="stop-color:#474747;stop-opacity:.7805"/><stop offset=".34" style="stop-color:#202020;stop-opacity:.4413"/><stop offset=".523" style="stop-color:#090909;stop-opacity:.1692"/><stop offset=".637" style="stop-color:#000;stop-opacity:0"/></radialGradient><path d="M254.7 820.0L430.1 664.9L473.9 626.1L541.3 599.9L561.5 548.6L629.0 522.4L648.1 470.5L715.4 440.2L726.3 388.9L789.2 347.6L774.9 302.4L817.1 250.3L775.4 221.8L792.3 168.8L732.1 159.3L721.8 112.9L651.7 124.5L614.0 92.7L545.0 124.7L486.2 113.3L430.2 159.7L360.8 169.0L325.1 222.0L255.1 250.3L245.6 302.4L186.6 347.8L209.1 388.9L169.0 440.0L205.6 470.8L173.5 522.7L215.1 548.9L184.8 600.2L226.4 626.3L232.1 665.1Z" style="fill-rule:evenodd;clip-rule:evenodd;fill:url(#a);fill-opacity:.7;filter:blur(15px)"/></svg>
|
package/src/core/Browser.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
const chrome = userAgentContains('chrome');
|
|
2
|
-
|
|
3
|
-
const safari = !chrome && userAgentContains('safari');
|
|
4
|
-
|
|
5
|
-
const mobile = typeof orientation !== 'undefined';
|
|
6
|
-
|
|
7
|
-
const reducedMotion = navigator.preferences?.reducedMotion?.value ?
|
|
8
|
-
navigator.preferences.reducedMotion.value === 'reduce' :
|
|
9
|
-
typeof window === 'undefined' ? true : window?.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
10
|
-
|
|
11
|
-
const pointer = typeof window === 'undefined' ? false : !!window.PointerEvent;
|
|
12
|
-
|
|
13
|
-
const touchNative = typeof window === 'undefined' ? false : 'ontouchstart' in window || !!(window.TouchEvent);
|
|
14
|
-
|
|
15
|
-
const touch = touchNative || pointer;
|
|
16
|
-
|
|
17
|
-
function isRetina() {
|
|
18
|
-
return typeof window === 'undefined' || typeof window.devicePixelRatio === 'undefined' ? false : window.devicePixelRatio > 1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const mac = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platform.startsWith('Mac');
|
|
22
|
-
|
|
23
|
-
const linux = typeof navigator === 'undefined' || typeof navigator.platform === 'undefined' ? false : navigator.platform.startsWith('Linux');
|
|
24
|
-
|
|
25
|
-
function userAgentContains(str) {
|
|
26
|
-
if (typeof navigator === 'undefined' || typeof navigator.userAgent === 'undefined') {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return navigator.userAgent.toLowerCase().includes(str);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A namespace with static properties for browser/feature detection used by Maplair
|
|
34
|
-
* internally.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```js
|
|
38
|
-
* if (Browser.chrome) {
|
|
39
|
-
* alert('You are running Chrome!');
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
* @type {Readonly<Record<string, boolean>>}
|
|
43
|
-
*/
|
|
44
|
-
export default {
|
|
45
|
-
/**
|
|
46
|
-
* `true` for the Chrome browser.
|
|
47
|
-
* @type {boolean}
|
|
48
|
-
*/
|
|
49
|
-
chrome,
|
|
50
|
-
/**
|
|
51
|
-
* `true` for the Safari browser.
|
|
52
|
-
* @type {boolean}
|
|
53
|
-
*/
|
|
54
|
-
safari,
|
|
55
|
-
/**
|
|
56
|
-
* `true` for all browsers running in a mobile device.
|
|
57
|
-
* @type {boolean}
|
|
58
|
-
*/
|
|
59
|
-
mobile,
|
|
60
|
-
/**
|
|
61
|
-
* `true` if the user has
|
|
62
|
-
* [configured their environment for reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion#user_preferences).
|
|
63
|
-
* Determines whether animations should play or not.
|
|
64
|
-
* @type {boolean}
|
|
65
|
-
*/
|
|
66
|
-
reducedMotion,
|
|
67
|
-
/**
|
|
68
|
-
* `true` for all browsers supporting
|
|
69
|
-
* [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
|
|
70
|
-
* @type {boolean}
|
|
71
|
-
*/
|
|
72
|
-
pointer,
|
|
73
|
-
/**
|
|
74
|
-
* `true` for all browsers supporting either [touch](#browser-touch) or
|
|
75
|
-
* [pointer](#browser-pointer) events.
|
|
76
|
-
* Note: pointer events will be preferred (if available), and processed for all
|
|
77
|
-
* `touch*` listeners.
|
|
78
|
-
* @type {boolean}
|
|
79
|
-
*/
|
|
80
|
-
touch,
|
|
81
|
-
/**
|
|
82
|
-
* `true` for all browsers supporting
|
|
83
|
-
* [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
|
|
84
|
-
* **This does not necessarily mean** that the browser is running in a computer with
|
|
85
|
-
* a touchscreen, it only means that the browser is capable of understanding
|
|
86
|
-
* touch events.
|
|
87
|
-
* @type {boolean}
|
|
88
|
-
*/
|
|
89
|
-
touchNative,
|
|
90
|
-
/**
|
|
91
|
-
* `true` for browsers on a high-resolution "retina" screen or on any screen when
|
|
92
|
-
* browser's display zoom is more than 100%. Follows changes of the
|
|
93
|
-
* `devicePixelRatio`, e.g. when moving the window to another screen (see the map's
|
|
94
|
-
* `pixelratiochange` event).
|
|
95
|
-
* @type {boolean}
|
|
96
|
-
*/
|
|
97
|
-
get retina() {
|
|
98
|
-
return isRetina();
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* `true` when the browser is running in a Mac platform.
|
|
102
|
-
* @type {boolean}
|
|
103
|
-
*/
|
|
104
|
-
mac,
|
|
105
|
-
/**
|
|
106
|
-
* `true` when the browser is running in a Linux platform.
|
|
107
|
-
* @type {boolean}
|
|
108
|
-
*/
|
|
109
|
-
linux
|
|
110
|
-
};
|
package/src/images/layers.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26"><path fill="#b9b9b9" d="m.032 17.056 13-8 13 8-13 8z"/><path fill="#737373" d="m.032 17.056-.032.93 13 8 13-8 .032-.93-13 8z"/><path fill="#cdcdcd" d="m0 13.076 13-8 13 8-13 8z"/><path fill="#737373" d="M0 13.076v.91l13 8 13-8v-.91l-13 8z"/><path fill="#e9e9e9" fill-opacity=".585" stroke="#797979" stroke-width=".1" d="m0 8.986 13-8 13 8-13 8-13-8"/><path fill="#737373" d="M0 8.986v1l13 8 13-8v-1l-13 8z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round" viewBox="0 0 500 820"><defs><linearGradient id="a" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 478.727 62.272)scale(37.566)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#C2331B"/><stop offset="1" stop-color="#E2603F"/></linearGradient><linearGradient id="b" x1="0" x2="1" y1="0" y2="0" gradientTransform="rotate(-90 468.484 54.002)scale(19.053)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8F2D20"/><stop offset="1" stop-color="#B23A27"/></linearGradient></defs><path fill="url(#a)" stroke="url(#b)" stroke-width="1.1" stroke-linejoin="miter" stroke-miterlimit="10" d="M416.500 542.096L420.919 533.569L422.024 531.437L424.460 529.996L424.233 527.174L426.670 525.732L426.382 522.881L428.720 521.213L428.075 518.393L429.979 516.125L428.342 513.639L429.080 510.777L426.581 509.207L426.168 506.292L423.266 505.773L421.781 503.221L418.898 503.859L416.511 502.112L414.131 503.870L411.248 503.241L409.766 505.793L406.865 506.302L406.439 509.216L403.933 510.775L404.661 513.641L403.023 516.136L404.935 518.393L404.271 521.204L406.590 522.896L406.299 525.752L408.738 527.189L408.516 530.011L410.956 531.448L412.065 533.578Z" transform="translate(-7889.1 -9807.44)scale(19.5417)"/><path fill="#FFF" d="m-90 2030 45-863a95 95 0 0 0-111-98l-859 151 116-320a65 65 0 0 0-20-73l-941-762 212-99a65 65 0 0 0 34-79l-186-572 542 115a65 65 0 0 0 73-38l105-247 423 454a65 65 0 0 0 111-57l-204-1052 327 189a65 65 0 0 0 91-27l332-652 332 652a65 65 0 0 0 91 27l327-189-204 1052a65 65 0 0 0 111 57l423-454 105 247a65 65 0 0 0 73 38l542-115-186 572a65 65 0 0 0 34 79l212 99-941 762a65 65 0 0 0-20 73l116 320-859-151a95 95 0 0 0-111 98l45 863z" transform="translate(250 258)scale(.068)"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 817.2 820"><radialGradient id="a" cx="526.6" cy="486.836" r="478.154" fx="275.876" fy="893.983" gradientUnits="userSpaceOnUse"><stop offset="0" style="stop-color:#5c5c5c;stop-opacity:.9477"/><stop offset=".112" style="stop-color:#474747;stop-opacity:.7805"/><stop offset=".34" style="stop-color:#202020;stop-opacity:.4413"/><stop offset=".523" style="stop-color:#090909;stop-opacity:.1692"/><stop offset=".637" style="stop-color:#000;stop-opacity:0"/></radialGradient><path d="M254.7 820.0L430.1 664.9L473.9 626.1L541.3 599.9L561.5 548.6L629.0 522.4L648.1 470.5L715.4 440.2L726.3 388.9L789.2 347.6L774.9 302.4L817.1 250.3L775.4 221.8L792.3 168.8L732.1 159.3L721.8 112.9L651.7 124.5L614.0 92.7L545.0 124.7L486.2 113.3L430.2 159.7L360.8 169.0L325.1 222.0L255.1 250.3L245.6 302.4L186.6 347.8L209.1 388.9L169.0 440.0L205.6 470.8L173.5 522.7L215.1 548.9L184.8 600.2L226.4 626.3L232.1 665.1Z" style="fill-rule:evenodd;clip-rule:evenodd;fill:url(#a);fill-opacity:.7;filter:blur(15px)"/></svg>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import {Marker} from './Marker.js';
|
|
2
|
-
import {MarkerDrag} from './Marker.Drag.js';
|
|
3
|
-
|
|
4
|
-
// The methods extended below
|
|
5
|
-
const {_setPos: setPos} = Marker.prototype,
|
|
6
|
-
{_onDrag: onDrag} = MarkerDrag.prototype;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Options of `Marker` for the rotation of marker icons, see the
|
|
10
|
-
* [marker rotation](#marker-setrotationangle).
|
|
11
|
-
* @typedef {object} MarkerRotationOptions
|
|
12
|
-
* @lends MarkerOptions
|
|
13
|
-
* @property {number} [rotationAngle=0] Rotation of the icon in degrees, clockwise, e.g.
|
|
14
|
-
* for the heading of a vehicle. On a rotated map, the angle is relative to the screen,
|
|
15
|
-
* or to north with `rotateWithView`. The shadow is not rotated.
|
|
16
|
-
* @property {string} [rotationOrigin] The CSS
|
|
17
|
-
* [`transform-origin`](https://developer.mozilla.org/docs/Web/CSS/transform-origin) to
|
|
18
|
-
* rotate the icon around, e.g. `'center'`. By default the anchor of the icon.
|
|
19
|
-
* @property {boolean} [rotateWithView=false] On a rotated map (see
|
|
20
|
-
* `MaplairMap.setBearing()`), whether the icon rotates with the map (e.g. for arrows
|
|
21
|
-
* pointing in a geographic direction) instead of staying upright.
|
|
22
|
-
*/
|
|
23
|
-
Marker.include({
|
|
24
|
-
options: {
|
|
25
|
-
rotationAngle: 0,
|
|
26
|
-
rotationOrigin: undefined,
|
|
27
|
-
rotateWithView: false
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Methods of `Marker` for the rotation of marker icons, an optional feature: import
|
|
33
|
-
* this module to add the `rotationAngle`, `rotationOrigin` and `rotateWithView` options
|
|
34
|
-
* and `setRotationAngle()`/`setRotationOrigin()` to `Marker` (it is also part of the
|
|
35
|
-
* map rotation, see `MaplairMap.setBearing()`).
|
|
36
|
-
*
|
|
37
|
-
* ```js
|
|
38
|
-
* import 'maplair/marker-rotation';
|
|
39
|
-
*
|
|
40
|
-
* new Marker([47.27, 11.40], {rotationAngle: 45}).addTo(map);
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* Inspired by the [Leaflet.RotatedMarker](https://github.com/bbecquet/Leaflet.RotatedMarker) plugin.
|
|
44
|
-
* @lends Marker.prototype
|
|
45
|
-
*/
|
|
46
|
-
const markerRotationMethods = {
|
|
47
|
-
/**
|
|
48
|
-
* Changes the [`rotationAngle`](#markeroptions-rotationangle) of the icon.
|
|
49
|
-
* @group Marker rotation
|
|
50
|
-
* @param {number} angle
|
|
51
|
-
* @returns {this}
|
|
52
|
-
*/
|
|
53
|
-
setRotationAngle(angle) {
|
|
54
|
-
this.options.rotationAngle = angle;
|
|
55
|
-
return this.update();
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Changes the [`rotationOrigin`](#markeroptions-rotationorigin) of the icon.
|
|
60
|
-
* @group Marker rotation
|
|
61
|
-
* @param {string} origin
|
|
62
|
-
* @returns {this}
|
|
63
|
-
*/
|
|
64
|
-
setRotationOrigin(origin) {
|
|
65
|
-
this.options.rotationOrigin = origin;
|
|
66
|
-
return this.update();
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
_setPos(pos) {
|
|
70
|
-
setPos.call(this, pos);
|
|
71
|
-
this._rotateIcon();
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// Rotates the icon by the `rotationAngle`, and keeps the icon and the shadow
|
|
75
|
-
// upright on a rotated map
|
|
76
|
-
_rotateIcon() {
|
|
77
|
-
const bearing = this.options.rotateWithView ? 0 : (this._map?.getBearing?.() ?? 0);
|
|
78
|
-
this._rotateElement(this._icon, bearing + (this.options.rotationAngle || 0), this.options.rotationOrigin);
|
|
79
|
-
this._rotateElement(this._shadow, bearing);
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
// Rotates an element positioned with `DomUtil.setPosition()` around its anchor (or `origin`)
|
|
83
|
-
_rotateElement(el, angle, origin) {
|
|
84
|
-
if (!el) { return; }
|
|
85
|
-
if (angle % 360) {
|
|
86
|
-
el.style.transform += ` rotate(${angle}deg)`;
|
|
87
|
-
el.style.transformOrigin = origin ?? `${-parseFloat(el.style.marginLeft) || 0}px ${-parseFloat(el.style.marginTop) || 0}px`;
|
|
88
|
-
} else if (el.style.transformOrigin) {
|
|
89
|
-
el.style.transformOrigin = '';
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
/** @typedef {typeof markerRotationMethods} MarkerRotationMethods */
|
|
94
|
-
|
|
95
|
-
Marker.include(markerRotationMethods);
|
|
96
|
-
|
|
97
|
-
MarkerDrag.include({
|
|
98
|
-
_onDrag(e) {
|
|
99
|
-
onDrag.call(this, e);
|
|
100
|
-
// dragging positions the icon without the rotation
|
|
101
|
-
this._marker._rotateIcon();
|
|
102
|
-
}
|
|
103
|
-
});
|