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.
Files changed (305) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/dist/esm/Maplair.js +18 -17
  3. package/dist/esm/Maplair.js.map +1 -1
  4. package/dist/esm/_virtual/_rolldown/runtime.js +1 -2
  5. package/dist/esm/control/AttributionControl.js +25 -16
  6. package/dist/esm/control/AttributionControl.js.map +1 -1
  7. package/dist/esm/control/ButtonControl.js +10 -13
  8. package/dist/esm/control/ButtonControl.js.map +1 -1
  9. package/dist/esm/control/ContextMenu.js +2 -5
  10. package/dist/esm/control/ContextMenu.js.map +1 -1
  11. package/dist/esm/control/Control.js +10 -18
  12. package/dist/esm/control/Control.js.map +1 -1
  13. package/dist/esm/control/FullscreenControl.js +6 -9
  14. package/dist/esm/control/FullscreenControl.js.map +1 -1
  15. package/dist/esm/control/LayersControl.js +170 -65
  16. package/dist/esm/control/LayersControl.js.map +1 -1
  17. package/dist/esm/control/LegendControl.js +8 -11
  18. package/dist/esm/control/LegendControl.js.map +1 -1
  19. package/dist/esm/control/MiniMapControl.js +15 -18
  20. package/dist/esm/control/MiniMapControl.js.map +1 -1
  21. package/dist/esm/control/RotateControl.js +2 -5
  22. package/dist/esm/control/RotateControl.js.map +1 -1
  23. package/dist/esm/control/ScaleControl.js +8 -11
  24. package/dist/esm/control/ScaleControl.js.map +1 -1
  25. package/dist/esm/control/SearchControl.js +100 -19
  26. package/dist/esm/control/SearchControl.js.map +1 -1
  27. package/dist/esm/control/SideBySideControl.js +2 -5
  28. package/dist/esm/control/SideBySideControl.js.map +1 -1
  29. package/dist/esm/control/TextControl.js +6 -9
  30. package/dist/esm/control/TextControl.js.map +1 -1
  31. package/dist/esm/control/TimeControl.js +407 -0
  32. package/dist/esm/control/TimeControl.js.map +1 -0
  33. package/dist/esm/control/ZoomControl.js +23 -36
  34. package/dist/esm/control/ZoomControl.js.map +1 -1
  35. package/dist/esm/core/Class.js +28 -44
  36. package/dist/esm/core/Class.js.map +1 -1
  37. package/dist/esm/core/Events.js +22 -10
  38. package/dist/esm/core/Events.js.map +1 -1
  39. package/dist/esm/core/Handler.js +23 -14
  40. package/dist/esm/core/Handler.js.map +1 -1
  41. package/dist/esm/core/I18n.js +1 -2
  42. package/dist/esm/core/Util.js +15 -4
  43. package/dist/esm/core/Util.js.map +1 -1
  44. package/dist/esm/dom/DomEvent.DoubleTap.js +26 -24
  45. package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
  46. package/dist/esm/dom/DomEvent.PointerEvents.js +3 -18
  47. package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
  48. package/dist/esm/dom/DomEvent.js +18 -60
  49. package/dist/esm/dom/DomEvent.js.map +1 -1
  50. package/dist/esm/dom/DomUtil.js +15 -70
  51. package/dist/esm/dom/DomUtil.js.map +1 -1
  52. package/dist/esm/dom/Draggable.js +21 -21
  53. package/dist/esm/dom/Draggable.js.map +1 -1
  54. package/dist/esm/dom/PosAnimation.js +4 -27
  55. package/dist/esm/dom/PosAnimation.js.map +1 -1
  56. package/dist/esm/geo/LatLng.js +16 -7
  57. package/dist/esm/geo/LatLng.js.map +1 -1
  58. package/dist/esm/geo/LatLngBounds.js +9 -15
  59. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  60. package/dist/esm/geo/crs/CRS.js +1 -2
  61. package/dist/esm/geo/crs/EPSG3395.js +5 -6
  62. package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
  63. package/dist/esm/geo/crs/EPSG3857.js +5 -6
  64. package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
  65. package/dist/esm/geo/crs/EPSG4326.js +4 -5
  66. package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
  67. package/dist/esm/geo/crs/EarthCRS.js +3 -4
  68. package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
  69. package/dist/esm/geo/crs/SimpleCRS.js +4 -5
  70. package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
  71. package/dist/esm/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +5 -6
  72. package/dist/esm/geo/projection/LonLatProjection.js.map +1 -0
  73. package/dist/esm/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +4 -5
  74. package/dist/esm/geo/projection/MercatorProjection.js.map +1 -0
  75. package/dist/esm/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +5 -6
  76. package/dist/esm/geo/projection/SphericalMercatorProjection.js.map +1 -0
  77. package/dist/esm/geometry/Bounds.js +10 -14
  78. package/dist/esm/geometry/Bounds.js.map +1 -1
  79. package/dist/esm/geometry/LineUtil.js +37 -32
  80. package/dist/esm/geometry/LineUtil.js.map +1 -1
  81. package/dist/esm/geometry/Point.js +1 -2
  82. package/dist/esm/geometry/PolyUtil.js +24 -51
  83. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  84. package/dist/esm/geometry/Transformation.js +1 -2
  85. package/dist/esm/layer/BlanketOverlay.js +7 -10
  86. package/dist/esm/layer/BlanketOverlay.js.map +1 -1
  87. package/dist/esm/layer/Classification.js +1 -2
  88. package/dist/esm/layer/DivOverlay.js +16 -22
  89. package/dist/esm/layer/DivOverlay.js.map +1 -1
  90. package/dist/esm/layer/FeatureGroup.js +5 -4
  91. package/dist/esm/layer/FeatureGroup.js.map +1 -1
  92. package/dist/esm/layer/GeoJSON.Load.js +1 -2
  93. package/dist/esm/layer/GeoJSON.js +17 -155
  94. package/dist/esm/layer/GeoJSON.js.map +1 -1
  95. package/dist/esm/layer/GeoJSONUtil.js +74 -0
  96. package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
  97. package/dist/esm/layer/HeatLayer.js +17 -20
  98. package/dist/esm/layer/HeatLayer.js.map +1 -1
  99. package/dist/esm/layer/ImageOverlay.js +22 -29
  100. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  101. package/dist/esm/layer/Layer.js +9 -12
  102. package/dist/esm/layer/Layer.js.map +1 -1
  103. package/dist/esm/layer/LayerGroup.js +53 -3
  104. package/dist/esm/layer/LayerGroup.js.map +1 -1
  105. package/dist/esm/layer/Popup.js +35 -58
  106. package/dist/esm/layer/Popup.js.map +1 -1
  107. package/dist/esm/layer/SVGOverlay.js +3 -7
  108. package/dist/esm/layer/SVGOverlay.js.map +1 -1
  109. package/dist/esm/layer/Tooltip.js +31 -34
  110. package/dist/esm/layer/Tooltip.js.map +1 -1
  111. package/dist/esm/layer/VideoOverlay.js +13 -17
  112. package/dist/esm/layer/VideoOverlay.js.map +1 -1
  113. package/dist/esm/layer/marker/DefaultIcon.js +38 -49
  114. package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
  115. package/dist/esm/layer/marker/DivIcon.js +8 -11
  116. package/dist/esm/layer/marker/DivIcon.js.map +1 -1
  117. package/dist/esm/layer/marker/Icon.js +9 -12
  118. package/dist/esm/layer/marker/Icon.js.map +1 -1
  119. package/dist/esm/layer/marker/Marker.Drag.js +44 -5
  120. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  121. package/dist/esm/layer/marker/Marker.Move.js +5 -8
  122. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  123. package/dist/esm/layer/marker/Marker.js +115 -47
  124. package/dist/esm/layer/marker/Marker.js.map +1 -1
  125. package/dist/esm/layer/marker/MarkerClusterGroup.js +301 -0
  126. package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
  127. package/dist/esm/layer/marker/SvgIcon.js +7 -10
  128. package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
  129. package/dist/esm/layer/tile/GridLayer.js +89 -101
  130. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  131. package/dist/esm/layer/tile/TileLayer.js +36 -44
  132. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  133. package/dist/esm/layer/tile/WMSTileLayer.js +33 -27
  134. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  135. package/dist/esm/layer/vector/Canvas.js +8 -17
  136. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  137. package/dist/esm/layer/vector/Circle.js +6 -5
  138. package/dist/esm/layer/vector/Circle.js.map +1 -1
  139. package/dist/esm/layer/vector/CircleMarker.js +19 -10
  140. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  141. package/dist/esm/layer/vector/Path.DashAnimation.js +3 -5
  142. package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
  143. package/dist/esm/layer/vector/Path.ZoomStyles.js +1 -2
  144. package/dist/esm/layer/vector/Path.js +28 -22
  145. package/dist/esm/layer/vector/Path.js.map +1 -1
  146. package/dist/esm/layer/vector/Polygon.js +22 -7
  147. package/dist/esm/layer/vector/Polygon.js.map +1 -1
  148. package/dist/esm/layer/vector/Polyline.Decorations.js +3 -4
  149. package/dist/esm/layer/vector/Polyline.js +25 -10
  150. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  151. package/dist/esm/layer/vector/Rectangle.js +1 -2
  152. package/dist/esm/layer/vector/Renderer.getRenderer.js +17 -17
  153. package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
  154. package/dist/esm/layer/vector/Renderer.js +1 -2
  155. package/dist/esm/layer/vector/SVG.js +12 -9
  156. package/dist/esm/layer/vector/SVG.js.map +1 -1
  157. package/dist/esm/map/Hash.js +1 -2
  158. package/dist/esm/map/Map.Rotation.js +41 -22
  159. package/dist/esm/map/Map.Rotation.js.map +1 -1
  160. package/dist/esm/map/Map.js +125 -126
  161. package/dist/esm/map/Map.js.map +1 -1
  162. package/dist/esm/map/MapSync.js +1 -2
  163. package/dist/esm/map/handler/BoxZoomHandler.js +25 -47
  164. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  165. package/dist/esm/map/handler/DisplaceHandler.js +7 -10
  166. package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
  167. package/dist/esm/map/handler/DoubleClickZoomHandler.js +1 -2
  168. package/dist/esm/map/handler/DragHandler.js +20 -21
  169. package/dist/esm/map/handler/DragHandler.js.map +1 -1
  170. package/dist/esm/map/handler/KeyboardHandler.js +48 -68
  171. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  172. package/dist/esm/map/handler/PinchZoomHandler.js +13 -5
  173. package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
  174. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +4 -6
  175. package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
  176. package/dist/esm/map/handler/TapDragZoomHandler.js +1 -2
  177. package/dist/esm/map/handler/TapHoldHandler.js +13 -7
  178. package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
  179. package/dist/esm/package.js +2 -3
  180. package/dist/maplair-global-src.js +6495 -5981
  181. package/dist/maplair-global-src.js.map +1 -1
  182. package/dist/maplair-global.js +2 -2
  183. package/dist/maplair-global.js.map +1 -1
  184. package/dist/maplair-src.js +6206 -5673
  185. package/dist/maplair-src.js.map +1 -1
  186. package/dist/maplair.css +1 -1213
  187. package/dist/maplair.js +2 -2
  188. package/dist/maplair.js.map +1 -1
  189. package/i18n/cs.json +6 -0
  190. package/i18n/de.json +6 -0
  191. package/i18n/en.json +6 -0
  192. package/i18n/es.json +6 -0
  193. package/i18n/fr.json +6 -0
  194. package/i18n/hu.json +6 -0
  195. package/i18n/it.json +6 -0
  196. package/i18n/rm.json +6 -0
  197. package/i18n/sk.json +6 -0
  198. package/i18n/sl.json +6 -0
  199. package/package.json +11 -18
  200. package/src/Maplair.all.js +0 -1
  201. package/src/control/AttributionControl.js +25 -18
  202. package/src/control/ButtonControl.js +9 -11
  203. package/src/control/ContextMenu.js +3 -5
  204. package/src/control/Control.js +9 -19
  205. package/src/control/FullscreenControl.js +5 -7
  206. package/src/control/LayersControl.js +196 -86
  207. package/src/control/LegendControl.js +7 -9
  208. package/src/control/MiniMapControl.js +9 -11
  209. package/src/control/RotateControl.js +3 -5
  210. package/src/control/ScaleControl.js +7 -9
  211. package/src/control/SearchControl.js +102 -19
  212. package/src/control/SideBySideControl.js +3 -5
  213. package/src/control/TextControl.js +5 -7
  214. package/src/control/TimeControl.js +471 -0
  215. package/src/control/ZoomControl.js +22 -38
  216. package/src/control/index.js +1 -0
  217. package/src/core/Class.js +37 -45
  218. package/src/core/Events.js +22 -3
  219. package/src/core/Handler.js +25 -13
  220. package/src/core/Util.js +20 -2
  221. package/src/core/index.js +0 -1
  222. package/src/dom/DomEvent.DoubleTap.js +18 -10
  223. package/src/dom/DomEvent.PointerEvents.js +3 -26
  224. package/src/dom/DomEvent.js +17 -85
  225. package/src/dom/DomUtil.js +22 -78
  226. package/src/dom/Draggable.js +32 -23
  227. package/src/dom/PosAnimation.js +3 -25
  228. package/src/dom/index.js +0 -1
  229. package/src/geo/LatLng.js +20 -3
  230. package/src/geo/LatLngBounds.js +8 -15
  231. package/src/geo/crs/EPSG3395.js +4 -4
  232. package/src/geo/crs/EPSG3857.js +4 -4
  233. package/src/geo/crs/EPSG4326.js +3 -3
  234. package/src/geo/crs/EarthCRS.js +2 -8
  235. package/src/geo/crs/SimpleCRS.js +3 -3
  236. package/src/geo/index.js +1 -2
  237. package/src/geo/projection/{Projection.LonLat.js → LonLatProjection.js} +2 -2
  238. package/src/geo/projection/{Projection.Mercator.js → MercatorProjection.js} +2 -2
  239. package/src/geo/projection/{Projection.SphericalMercator.js → SphericalMercatorProjection.js} +2 -2
  240. package/src/geo/projection/index.js +5 -5
  241. package/src/geometry/Bounds.js +12 -17
  242. package/src/geometry/LineUtil.js +48 -49
  243. package/src/geometry/PolyUtil.js +39 -76
  244. package/src/layer/BlanketOverlay.js +6 -10
  245. package/src/layer/DivOverlay.js +16 -27
  246. package/src/layer/FeatureGroup.js +8 -2
  247. package/src/layer/GeoJSON.js +17 -218
  248. package/src/layer/GeoJSONUtil.js +85 -0
  249. package/src/layer/HeatLayer.js +10 -12
  250. package/src/layer/ImageOverlay.js +21 -32
  251. package/src/layer/Layer.js +8 -10
  252. package/src/layer/LayerGroup.js +72 -1
  253. package/src/layer/Popup.js +37 -62
  254. package/src/layer/SVGOverlay.js +1 -5
  255. package/src/layer/Tooltip.js +34 -36
  256. package/src/layer/VideoOverlay.js +12 -15
  257. package/src/layer/marker/DefaultIcon.js +40 -58
  258. package/src/layer/marker/DivIcon.js +9 -11
  259. package/src/layer/marker/Icon.js +9 -10
  260. package/src/layer/marker/Marker.Drag.js +54 -6
  261. package/src/layer/marker/Marker.Move.js +4 -6
  262. package/src/layer/marker/Marker.js +145 -52
  263. package/src/layer/marker/MarkerClusterGroup.js +370 -0
  264. package/src/layer/marker/SvgIcon.js +7 -9
  265. package/src/layer/marker/index.js +1 -0
  266. package/src/layer/tile/GridLayer.js +108 -135
  267. package/src/layer/tile/TileLayer.js +44 -49
  268. package/src/layer/tile/WMSTileLayer.js +31 -26
  269. package/src/layer/vector/Canvas.js +13 -19
  270. package/src/layer/vector/Circle.js +9 -3
  271. package/src/layer/vector/CircleMarker.js +19 -7
  272. package/src/layer/vector/Path.DashAnimation.js +1 -2
  273. package/src/layer/vector/Path.js +30 -21
  274. package/src/layer/vector/Polygon.js +29 -6
  275. package/src/layer/vector/Polyline.js +26 -7
  276. package/src/layer/vector/Renderer.getRenderer.js +20 -19
  277. package/src/layer/vector/SVG.js +17 -7
  278. package/src/map/Map.Rotation.js +40 -8
  279. package/src/map/Map.js +158 -153
  280. package/src/map/handler/BoxZoomHandler.js +30 -50
  281. package/src/map/handler/DisplaceHandler.js +6 -8
  282. package/src/map/handler/DragHandler.js +25 -28
  283. package/src/map/handler/KeyboardHandler.js +65 -90
  284. package/src/map/handler/PinchZoomHandler.js +16 -5
  285. package/src/map/handler/ScrollWheelZoomHandler.js +6 -4
  286. package/src/map/handler/TapHoldHandler.js +15 -4
  287. package/src/map/index.js +1 -1
  288. package/src/maplair.css +153 -98
  289. package/dist/esm/core/Browser.js +0 -100
  290. package/dist/esm/core/Browser.js.map +0 -1
  291. package/dist/esm/geo/projection/Projection.LonLat.js.map +0 -1
  292. package/dist/esm/geo/projection/Projection.Mercator.js.map +0 -1
  293. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +0 -1
  294. package/dist/esm/geo/projection/index.js +0 -14
  295. package/dist/esm/geo/projection/index.js.map +0 -1
  296. package/dist/esm/layer/marker/Marker.Rotation.js +0 -70
  297. package/dist/esm/layer/marker/Marker.Rotation.js.map +0 -1
  298. package/dist/images/layers.svg +0 -1
  299. package/dist/images/marker-icon.svg +0 -1
  300. package/dist/images/marker-shadow.svg +0 -1
  301. package/src/core/Browser.js +0 -110
  302. package/src/images/layers.svg +0 -1
  303. package/src/images/marker-icon.svg +0 -1
  304. package/src/images/marker-shadow.svg +0 -1
  305. 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"}
@@ -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,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
- };
@@ -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
- });