maplair 4.4.0 → 4.5.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 (121) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/esm/control/AttributionControl.js +20 -3
  3. package/dist/esm/control/AttributionControl.js.map +1 -1
  4. package/dist/esm/control/LayersControl.js +35 -20
  5. package/dist/esm/control/LayersControl.js.map +1 -1
  6. package/dist/esm/control/ScaleControl.js +3 -3
  7. package/dist/esm/control/ScaleControl.js.map +1 -1
  8. package/dist/esm/control/ZoomControl.js +1 -0
  9. package/dist/esm/control/ZoomControl.js.map +1 -1
  10. package/dist/esm/core/Util.js +1 -1
  11. package/dist/esm/core/Util.js.map +1 -1
  12. package/dist/esm/dom/DomEvent.PointerEvents.js +19 -2
  13. package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
  14. package/dist/esm/dom/Draggable.js +6 -2
  15. package/dist/esm/dom/Draggable.js.map +1 -1
  16. package/dist/esm/geo/LatLng.js +1 -1
  17. package/dist/esm/geo/LatLng.js.map +1 -1
  18. package/dist/esm/geo/LatLngBounds.js +1 -1
  19. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  20. package/dist/esm/geometry/Bounds.js +1 -1
  21. package/dist/esm/geometry/Bounds.js.map +1 -1
  22. package/dist/esm/geometry/Point.js +4 -2
  23. package/dist/esm/geometry/Point.js.map +1 -1
  24. package/dist/esm/geometry/PolyUtil.js +10 -3
  25. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  26. package/dist/esm/layer/BlanketOverlay.js +2 -1
  27. package/dist/esm/layer/BlanketOverlay.js.map +1 -1
  28. package/dist/esm/layer/DivOverlay.js +3 -3
  29. package/dist/esm/layer/DivOverlay.js.map +1 -1
  30. package/dist/esm/layer/ImageOverlay.js +1 -1
  31. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  32. package/dist/esm/layer/Layer.js +1 -1
  33. package/dist/esm/layer/Layer.js.map +1 -1
  34. package/dist/esm/layer/Popup.js +3 -4
  35. package/dist/esm/layer/Popup.js.map +1 -1
  36. package/dist/esm/layer/Tooltip.js +31 -22
  37. package/dist/esm/layer/Tooltip.js.map +1 -1
  38. package/dist/esm/layer/marker/Icon.js +25 -6
  39. package/dist/esm/layer/marker/Icon.js.map +1 -1
  40. package/dist/esm/layer/marker/Marker.Drag.js +5 -5
  41. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  42. package/dist/esm/layer/marker/Marker.js +5 -5
  43. package/dist/esm/layer/marker/Marker.js.map +1 -1
  44. package/dist/esm/layer/tile/GridLayer.js +11 -5
  45. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  46. package/dist/esm/layer/tile/TileLayer.js +10 -6
  47. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  48. package/dist/esm/layer/tile/WMSTileLayer.js +7 -3
  49. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  50. package/dist/esm/layer/vector/Canvas.js +2 -2
  51. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  52. package/dist/esm/layer/vector/Circle.js +2 -3
  53. package/dist/esm/layer/vector/Circle.js.map +1 -1
  54. package/dist/esm/layer/vector/CircleMarker.js +6 -3
  55. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  56. package/dist/esm/layer/vector/Path.ZoomStyles.js +4 -1
  57. package/dist/esm/layer/vector/Path.ZoomStyles.js.map +1 -1
  58. package/dist/esm/map/Map.Rotation.js +3 -2
  59. package/dist/esm/map/Map.Rotation.js.map +1 -1
  60. package/dist/esm/map/Map.js +58 -26
  61. package/dist/esm/map/Map.js.map +1 -1
  62. package/dist/esm/map/MapSync.js +1 -1
  63. package/dist/esm/map/MapSync.js.map +1 -1
  64. package/dist/esm/map/handler/BoxZoomHandler.js +2 -0
  65. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  66. package/dist/esm/map/handler/DragHandler.js +7 -2
  67. package/dist/esm/map/handler/DragHandler.js.map +1 -1
  68. package/dist/esm/map/handler/PinchZoomHandler.js +1 -1
  69. package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
  70. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +1 -1
  71. package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
  72. package/dist/esm/map/handler/TapDragZoomHandler.js +1 -1
  73. package/dist/esm/map/handler/TapDragZoomHandler.js.map +1 -1
  74. package/dist/esm/package.js +1 -1
  75. package/dist/maplair-global-src.js +289 -140
  76. package/dist/maplair-global-src.js.map +1 -1
  77. package/dist/maplair-global.js +2 -2
  78. package/dist/maplair-global.js.map +1 -1
  79. package/dist/maplair-src.js +289 -140
  80. package/dist/maplair-src.js.map +1 -1
  81. package/dist/maplair.css +1 -1
  82. package/dist/maplair.js +2 -2
  83. package/dist/maplair.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/control/AttributionControl.js +29 -3
  86. package/src/control/LayersControl.js +47 -27
  87. package/src/control/ScaleControl.js +6 -3
  88. package/src/control/ZoomControl.js +1 -0
  89. package/src/core/Util.js +1 -1
  90. package/src/dom/DomEvent.PointerEvents.js +22 -2
  91. package/src/dom/Draggable.js +6 -2
  92. package/src/geo/LatLng.js +2 -1
  93. package/src/geo/LatLngBounds.js +1 -1
  94. package/src/geometry/Bounds.js +1 -1
  95. package/src/geometry/Point.js +4 -2
  96. package/src/geometry/PolyUtil.js +12 -3
  97. package/src/layer/BlanketOverlay.js +5 -2
  98. package/src/layer/DivOverlay.js +3 -3
  99. package/src/layer/ImageOverlay.js +3 -2
  100. package/src/layer/Layer.js +1 -1
  101. package/src/layer/Popup.js +3 -4
  102. package/src/layer/Tooltip.js +34 -27
  103. package/src/layer/marker/Icon.js +25 -5
  104. package/src/layer/marker/Marker.Drag.js +6 -6
  105. package/src/layer/marker/Marker.js +5 -5
  106. package/src/layer/tile/GridLayer.js +20 -7
  107. package/src/layer/tile/TileLayer.js +14 -7
  108. package/src/layer/tile/WMSTileLayer.js +4 -2
  109. package/src/layer/vector/Canvas.js +2 -2
  110. package/src/layer/vector/Circle.js +3 -5
  111. package/src/layer/vector/CircleMarker.js +5 -2
  112. package/src/layer/vector/Path.ZoomStyles.js +5 -3
  113. package/src/map/Map.Rotation.js +6 -3
  114. package/src/map/Map.js +63 -32
  115. package/src/map/MapSync.js +1 -1
  116. package/src/map/handler/BoxZoomHandler.js +3 -0
  117. package/src/map/handler/DragHandler.js +5 -5
  118. package/src/map/handler/PinchZoomHandler.js +1 -1
  119. package/src/map/handler/ScrollWheelZoomHandler.js +1 -1
  120. package/src/map/handler/TapDragZoomHandler.js +1 -1
  121. package/src/maplair.css +12 -1
@@ -1,4 +1,4 @@
1
- import { setOptions } from "../../core/Util.js";
1
+ import { setOptions, toNumber } from "../../core/Util.js";
2
2
  import { Bounds } from "../../geometry/Bounds.js";
3
3
  import { Path } from "./Path.js";
4
4
  import { LatLng } from "../../geo/LatLng.js";
@@ -45,7 +45,7 @@ var CircleMarker = class CircleMarker extends Path {
45
45
  super();
46
46
  setOptions(this, options);
47
47
  this._latlng = new LatLng(latlng);
48
- this._radius = this.options.radius;
48
+ this.setRadius(this.options.radius);
49
49
  this.callInitHooks(CircleMarker);
50
50
  }
51
51
  /**
@@ -82,7 +82,10 @@ var CircleMarker = class CircleMarker extends Path {
82
82
  * @returns {this}
83
83
  */
84
84
  setRadius(radius) {
85
- this.options.radius = this._radius = radius;
85
+ const r = toNumber(radius);
86
+ if (isNaN(r)) throw new Error(`Invalid radius: ${radius}`);
87
+ /** @type {number} */
88
+ this._radius = this.options.radius = r;
86
89
  return this.redraw();
87
90
  }
88
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CircleMarker.js","names":[],"sources":["../../../../src/layer/vector/CircleMarker.js"],"sourcesContent":["import {Path} from './Path.js';\nimport * as Util from '../../core/Util.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {pointToGeoJSON} from '../GeoJSONUtil.js';\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {Feature} from 'geojson' */\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {MaplairEvent} from '../../core/Events.js' */\n/** @import {PathOptions} from './Path.js' */\n\n\n/**\n * Options of `CircleMarker`.\n * @typedef {object} CircleMarkerOptions\n * @property {boolean} [fill=true] Whether to fill the circle with color.\n * @property {number} [radius=10] Radius of the circle marker, in CSS pixels.\n * @extends PathOptions\n */\n\n/**\n * The event object of `move` of circle markers.\n * @typedef {object} CircleMarkerMoveEvent\n * @property {LatLng} oldLatLng The previous position of the circle marker.\n * @property {LatLng} latlng The new position of the circle marker.\n * @extends MaplairEvent\n */\n\n/**\n * A circle of a fixed size with radius specified in CSS pixels. Extends `Path`.\n *\n * @fires move {CircleMarkerMoveEvent} Fired when the marker is moved via\n * [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in\n * event arguments as `oldLatLng`, `latlng`.\n */\nexport class CircleMarker extends Path {\n\n\tstatic defaultOptions = {\n\t\tfill: true,\n\t\tradius: 10\n\t};\n\n\t/**\n\t * Instantiates a circle marker object given a geographical point, and an optional\n\t * options object.\n\t * @param {LatLngExpression} latlng\n\t * @param {CircleMarkerOptions} [options]\n\t */\n\tconstructor(latlng, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._latlng = new LatLng(latlng);\n\t\tthis._radius = this.options.radius;\n\n\t\tthis.callInitHooks(CircleMarker);\n\t}\n\n\t/**\n\t * @param {MaplairMap} map\n\t */\n\tbeforeAdd(map) {\n\t\tsuper.beforeAdd(map);\n\t\t// before the marker is drawn, see `DisplaceHandler`\n\t\tmap._displaceHandler?._beforeMarkerAdd(this);\n\t}\n\n\t/**\n\t * Sets the position of a circle marker to a new location.\n\t * @param {LatLngExpression} latlng\n\t * @returns {this}\n\t */\n\tsetLatLng(latlng) {\n\t\tconst oldLatLng = this._latlng;\n\t\tthis._latlng = new LatLng(latlng);\n\t\tthis.redraw();\n\n\t\treturn this.fire('move', {oldLatLng, latlng: this._latlng});\n\t}\n\n\t/**\n\t * Returns the current geographical position of the circle marker.\n\t * @returns {LatLng}\n\t */\n\tgetLatLng() {\n\t\treturn this._latlng;\n\t}\n\n\t/**\n\t * Sets the radius of a circle marker. Units are in CSS pixels.\n\t * @param {number} radius\n\t * @returns {this}\n\t */\n\tsetRadius(radius) {\n\t\tthis.options.radius = this._radius = radius;\n\t\treturn this.redraw();\n\t}\n\n\t/**\n\t * Returns the current radius of the circle. Units are in CSS pixels.\n\t * @returns {number}\n\t */\n\tgetRadius() {\n\t\treturn this._radius;\n\t}\n\n\t/**\n\t * Changes the appearance of the circle marker, also its `radius`.\n\t * @param {CircleMarkerOptions} options\n\t * @returns {this}\n\t */\n\tsetStyle(options) {\n\t\tsuper.setStyle(options);\n\t\tif (options?.radius !== undefined) {\n\t\t\tthis.setRadius(options.radius);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_project() {\n\t\t// snapped to whole pixels: subpixel precision is invisible on markers but slows down rendering many of them\n\t\tthis._point = this._renderer._latLngToLayerPoint(this._latlng)._round();\n\t\tthis._pxRadius = this._radius;\n\t\tthis._updateBounds();\n\t}\n\n\t_updateBounds() {\n\t\tconst r = this._pxRadius,\n\t\tr2 = this._pxRadiusY ?? r,\n\t\tw = this._clickTolerance(),\n\t\tp = [r + w, r2 + w];\n\t\tthis._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));\n\t}\n\n\t_update() {\n\t\tif (this._map) {\n\t\t\tthis._updatePath();\n\t\t}\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updateCircle(this);\n\t}\n\n\t_empty() {\n\t\treturn this._pxRadius && !this._renderer._bounds.intersects(this._pxBounds);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p) {\n\t\treturn p.distanceTo(this._point) <= this._pxRadius + this._clickTolerance();\n\t}\n\n\t/**\n\t * Coordinates values are rounded with [`formatNum`](#util-formatnum) to the\n\t * given `precision`. Returns a [`GeoJSON`](https://en.wikipedia.org/wiki/GeoJSON)\n\t * representation of the circle marker (as a GeoJSON `Point` Feature).\n\t * @param {number|false} [precision]\n\t * @returns {Feature}\n\t */\n\ttoGeoJSON(precision) {\n\t\treturn pointToGeoJSON(this, precision);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,eAAb,MAAa,qBAAqB,KAAK;CAEtC,OAAO,iBAAiB;EACvB,MAAM;EACN,QAAQ;CACT;;;;;;;CAQA,YAAY,QAAQ,SAAS;EAC5B,MAAM;EACN,WAAgB,MAAM,OAAO;EAC7B,KAAK,UAAU,IAAI,OAAO,MAAM;EAChC,KAAK,UAAU,KAAK,QAAQ;EAE5B,KAAK,cAAc,YAAY;CAChC;;;;CAKA,UAAU,KAAK;EACd,MAAM,UAAU,GAAG;EAEnB,IAAI,kBAAkB,iBAAiB,IAAI;CAC5C;;;;;;CAOA,UAAU,QAAQ;EACjB,MAAM,YAAY,KAAK;EACvB,KAAK,UAAU,IAAI,OAAO,MAAM;EAChC,KAAK,OAAO;EAEZ,OAAO,KAAK,KAAK,QAAQ;GAAC;GAAW,QAAQ,KAAK;EAAO,CAAC;CAC3D;;;;;CAMA,YAAY;EACX,OAAO,KAAK;CACb;;;;;;CAOA,UAAU,QAAQ;EACjB,KAAK,QAAQ,SAAS,KAAK,UAAU;EACrC,OAAO,KAAK,OAAO;CACpB;;;;;CAMA,YAAY;EACX,OAAO,KAAK;CACb;;;;;;CAOA,SAAS,SAAS;EACjB,MAAM,SAAS,OAAO;EACtB,IAAI,SAAS,WAAW,KAAA,GACvB,KAAK,UAAU,QAAQ,MAAM;EAE9B,OAAO;CACR;CAEA,WAAW;EAEV,KAAK,SAAS,KAAK,UAAU,oBAAoB,KAAK,OAAO,CAAC,CAAC,OAAO;EACtE,KAAK,YAAY,KAAK;EACtB,KAAK,cAAc;CACpB;CAEA,gBAAgB;EACf,MAAM,IAAI,KAAK,WACf,KAAK,KAAK,cAAc,GACxB,IAAI,KAAK,gBAAgB,GACzB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;EAClB,KAAK,YAAY,IAAI,OAAO,KAAK,OAAO,SAAS,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC;CACxE;CAEA,UAAU;EACT,IAAI,KAAK,MACR,KAAK,YAAY;CAEnB;CAEA,cAAc;EACb,KAAK,UAAU,cAAc,IAAI;CAClC;CAEA,SAAS;EACR,OAAO,KAAK,aAAa,CAAC,KAAK,UAAU,QAAQ,WAAW,KAAK,SAAS;CAC3E;CAGA,eAAe,GAAG;EACjB,OAAO,EAAE,WAAW,KAAK,MAAM,KAAK,KAAK,YAAY,KAAK,gBAAgB;CAC3E;;;;;;;;CASA,UAAU,WAAW;EACpB,OAAO,eAAe,MAAM,SAAS;CACtC;AACD"}
1
+ {"version":3,"file":"CircleMarker.js","names":["Util.toNumber"],"sources":["../../../../src/layer/vector/CircleMarker.js"],"sourcesContent":["import {Path} from './Path.js';\nimport * as Util from '../../core/Util.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {pointToGeoJSON} from '../GeoJSONUtil.js';\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {Feature} from 'geojson' */\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {MaplairEvent} from '../../core/Events.js' */\n/** @import {PathOptions} from './Path.js' */\n\n\n/**\n * Options of `CircleMarker`.\n * @typedef {object} CircleMarkerOptions\n * @property {boolean} [fill=true] Whether to fill the circle with color.\n * @property {number} [radius=10] Radius of the circle marker, in CSS pixels.\n * @extends PathOptions\n */\n\n/**\n * The event object of `move` of circle markers.\n * @typedef {object} CircleMarkerMoveEvent\n * @property {LatLng} oldLatLng The previous position of the circle marker.\n * @property {LatLng} latlng The new position of the circle marker.\n * @extends MaplairEvent\n */\n\n/**\n * A circle of a fixed size with radius specified in CSS pixels. Extends `Path`.\n *\n * @fires move {CircleMarkerMoveEvent} Fired when the marker is moved via\n * [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in\n * event arguments as `oldLatLng`, `latlng`.\n */\nexport class CircleMarker extends Path {\n\n\tstatic defaultOptions = {\n\t\tfill: true,\n\t\tradius: 10\n\t};\n\n\t/**\n\t * Instantiates a circle marker object given a geographical point, and an optional\n\t * options object.\n\t * @param {LatLngExpression} latlng\n\t * @param {CircleMarkerOptions} [options]\n\t */\n\tconstructor(latlng, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._latlng = new LatLng(latlng);\n\t\tthis.setRadius(this.options.radius);\n\n\t\tthis.callInitHooks(CircleMarker);\n\t}\n\n\t/**\n\t * @param {MaplairMap} map\n\t */\n\tbeforeAdd(map) {\n\t\tsuper.beforeAdd(map);\n\t\t// before the marker is drawn, see `DisplaceHandler`\n\t\tmap._displaceHandler?._beforeMarkerAdd(this);\n\t}\n\n\t/**\n\t * Sets the position of a circle marker to a new location.\n\t * @param {LatLngExpression} latlng\n\t * @returns {this}\n\t */\n\tsetLatLng(latlng) {\n\t\tconst oldLatLng = this._latlng;\n\t\tthis._latlng = new LatLng(latlng);\n\t\tthis.redraw();\n\n\t\treturn this.fire('move', {oldLatLng, latlng: this._latlng});\n\t}\n\n\t/**\n\t * Returns the current geographical position of the circle marker.\n\t * @returns {LatLng}\n\t */\n\tgetLatLng() {\n\t\treturn this._latlng;\n\t}\n\n\t/**\n\t * Sets the radius of a circle marker. Units are in CSS pixels.\n\t * @param {number} radius\n\t * @returns {this}\n\t */\n\tsetRadius(radius) {\n\t\tconst r = Util.toNumber(radius);\n\t\tif (isNaN(r)) { throw new Error(`Invalid radius: ${radius}`); }\n\t\t/** @type {number} */\n\t\tthis._radius = this.options.radius = r;\n\t\treturn this.redraw();\n\t}\n\n\t/**\n\t * Returns the current radius of the circle. Units are in CSS pixels.\n\t * @returns {number}\n\t */\n\tgetRadius() {\n\t\treturn this._radius;\n\t}\n\n\t/**\n\t * Changes the appearance of the circle marker, also its `radius`.\n\t * @param {CircleMarkerOptions} options\n\t * @returns {this}\n\t */\n\tsetStyle(options) {\n\t\tsuper.setStyle(options);\n\t\tif (options?.radius !== undefined) {\n\t\t\tthis.setRadius(options.radius);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_project() {\n\t\t// snapped to whole pixels: subpixel precision is invisible on markers but slows down rendering many of them\n\t\tthis._point = this._renderer._latLngToLayerPoint(this._latlng)._round();\n\t\tthis._pxRadius = this._radius;\n\t\tthis._updateBounds();\n\t}\n\n\t_updateBounds() {\n\t\tconst r = this._pxRadius,\n\t\tr2 = this._pxRadiusY ?? r,\n\t\tw = this._clickTolerance(),\n\t\tp = [r + w, r2 + w];\n\t\tthis._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));\n\t}\n\n\t_update() {\n\t\tif (this._map) {\n\t\t\tthis._updatePath();\n\t\t}\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updateCircle(this);\n\t}\n\n\t_empty() {\n\t\treturn this._pxRadius && !this._renderer._bounds.intersects(this._pxBounds);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p) {\n\t\treturn p.distanceTo(this._point) <= this._pxRadius + this._clickTolerance();\n\t}\n\n\t/**\n\t * Coordinates values are rounded with [`formatNum`](#util-formatnum) to the\n\t * given `precision`. Returns a [`GeoJSON`](https://en.wikipedia.org/wiki/GeoJSON)\n\t * representation of the circle marker (as a GeoJSON `Point` Feature).\n\t * @param {number|false} [precision]\n\t * @returns {Feature}\n\t */\n\ttoGeoJSON(precision) {\n\t\treturn pointToGeoJSON(this, precision);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,eAAb,MAAa,qBAAqB,KAAK;CAEtC,OAAO,iBAAiB;EACvB,MAAM;EACN,QAAQ;CACT;;;;;;;CAQA,YAAY,QAAQ,SAAS;EAC5B,MAAM;EACN,WAAgB,MAAM,OAAO;EAC7B,KAAK,UAAU,IAAI,OAAO,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KAAK,UAAU,QAAQ,WAAW,KAAK,SAAS;CAC3E;CAGA,eAAe,GAAG;EACjB,OAAO,EAAE,WAAW,KAAK,MAAM,KAAK,KAAK,YAAY,KAAK,gBAAgB;CAC3E;;;;;;;;CASA,UAAU,WAAW;EACpB,OAAO,eAAe,MAAM,SAAS;CACtC;AACD"}
@@ -67,7 +67,10 @@ Path.include({
67
67
  });
68
68
  CircleMarker.include({ setRadius(radius) {
69
69
  this._takeZoomStyles({ radius });
70
- return this._zoomStyles?.radius && this._map ? setRadius.call(this, evaluate(radius, this._map.getZoom())) : setRadius.call(this, radius);
70
+ if (!this._zoomStyles?.radius) return setRadius.call(this, radius);
71
+ if (this._map) return setRadius.call(this, evaluate(radius, this._map.getZoom()));
72
+ this.options.radius = this._radius = radius;
73
+ return this;
71
74
  } });
72
75
  Path.addInitHook(function() {
73
76
  this._takeZoomStyles(this.options);
@@ -1 +1 @@
1
- {"version":3,"file":"Path.ZoomStyles.js","names":[],"sources":["../../../../src/layer/vector/Path.ZoomStyles.js"],"sourcesContent":["import {Path} from './Path.js';\nimport {CircleMarker} from './CircleMarker.js';\n\n/**\n * A zoom-dependent style value, of the `weight` option of paths and the `radius` of\n * circle markers: either a function of the zoom or an object of zoom stops\n * `{zoom: value}`, using the value of the highest stop not above the zoom (or of the\n * lowest stop). The styles are updated on `zoomend`.\n *\n * Zoom-dependent styles are an optional feature, like the zoom expressions of\n * MapLibre: import this module to let the `weight` and `radius` options depend on the\n * zoom.\n *\n * ```js\n * import 'maplair/zoom-styles';\n *\n * new CircleMarker(latlng, {radius: {5: 3, 10: 6, 15: 10}}).addTo(map);\n * new Polyline(latlngs, {weight: zoom => zoom / 2}).addTo(map);\n * ```\n * @typedef {number|Record<number, number>|((zoom: number) => number)} ZoomStyle\n */\n\nconst zoomStyleNames = ['weight', 'radius'];\n\n// The value of `stops` (a function or an object of zoom stops) at `zoom`\nfunction evaluate(stops, zoom) {\n\tif (typeof stops === 'function') { return stops(zoom); }\n\tconst zooms = Object.keys(stops).map(Number).sort((a, b) => a - b);\n\treturn stops[zooms.findLast(z => z <= zoom) ?? zooms[0]];\n}\n\nconst {beforeAdd, setStyle} = Path.prototype,\n{setRadius} = CircleMarker.prototype;\n\nPath.include({\n\tgetEvents() {\n\t\t// also for zoom-dependent styles set later with `setStyle()`\n\t\treturn {zoomend: this._updateZoomStyles};\n\t},\n\n\tbeforeAdd(map) {\n\t\tbeforeAdd.call(this, map);\n\t\t// before the path is drawn\n\t\tthis._applyZoomStyles(map.getZoom());\n\t},\n\n\tsetStyle(style) {\n\t\tthis._takeZoomStyles(style);\n\t\tconst zoom = this._map?.getZoom();\n\t\tif (style && this._zoomStyles && zoom !== undefined) {\n\t\t\tstyle = {...style};\n\t\t\tfor (const [name, stops] of Object.entries(this._zoomStyles)) {\n\t\t\t\tif (Object.hasOwn(style, name)) {\n\t\t\t\t\tstyle[name] = evaluate(stops, zoom);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn setStyle.call(this, style);\n\t},\n\n\t// Keeps the zoom-dependent values of `style` (functions and objects) in\n\t// `_zoomStyles`, numbers replace them\n\t_takeZoomStyles(style) {\n\t\tfor (const name of zoomStyleNames) {\n\t\t\tif (!style || !Object.hasOwn(style, name)) { continue; }\n\t\t\tconst value = style[name];\n\t\t\tif (value && (typeof value === 'function' || typeof value === 'object')) {\n\t\t\t\tthis._zoomStyles = {...this._zoomStyles, [name]: value};\n\t\t\t} else if (this._zoomStyles) {\n\t\t\t\tdelete this._zoomStyles[name];\n\t\t\t}\n\t\t}\n\t},\n\n\t_applyZoomStyles(zoom) {\n\t\tif (!this._zoomStyles) { return; }\n\t\tconst values = {};\n\t\tfor (const [name, stops] of Object.entries(this._zoomStyles)) {\n\t\t\tvalues[name] = evaluate(stops, zoom);\n\t\t}\n\t\tsetStyle.call(this, values);\n\t\tif (values.radius !== undefined && this.setRadius) {\n\t\t\tsetRadius.call(this, values.radius);\n\t\t}\n\t},\n\n\t_updateZoomStyles() {\n\t\tthis._applyZoomStyles(this._map.getZoom());\n\t}\n});\n\nCircleMarker.include({\n\tsetRadius(radius) {\n\t\tthis._takeZoomStyles({radius});\n\t\treturn this._zoomStyles?.radius && this._map ?\n\t\t\tsetRadius.call(this, evaluate(radius, this._map.getZoom())) :\n\t\t\tsetRadius.call(this, radius);\n\t}\n});\n\nPath.addInitHook(function () {\n\tthis._takeZoomStyles(this.options);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,iBAAiB,CAAC,UAAU,QAAQ;AAG1C,SAAS,SAAS,OAAO,MAAM;CAC9B,IAAI,OAAO,UAAU,YAAc,OAAO,MAAM,IAAI;CACpD,MAAM,QAAQ,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACjE,OAAO,MAAM,MAAM,UAAS,MAAK,KAAK,IAAI,KAAK,MAAM;AACtD;AAEA,MAAM,EAAC,WAAW,aAAY,KAAK,WACnC,EAAC,cAAa,aAAa;AAE3B,KAAK,QAAQ;CACZ,YAAY;EAEX,OAAO,EAAC,SAAS,KAAK,kBAAiB;CACxC;CAEA,UAAU,KAAK;EACd,UAAU,KAAK,MAAM,GAAG;EAExB,KAAK,iBAAiB,IAAI,QAAQ,CAAC;CACpC;CAEA,SAAS,OAAO;EACf,KAAK,gBAAgB,KAAK;EAC1B,MAAM,OAAO,KAAK,MAAM,QAAQ;EAChC,IAAI,SAAS,KAAK,eAAe,SAAS,KAAA,GAAW;GACpD,QAAQ,EAAC,GAAG,MAAK;GACjB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,WAAW,GAC1D,IAAI,OAAO,OAAO,OAAO,IAAI,GAC5B,MAAM,QAAQ,SAAS,OAAO,IAAI;EAGrC;EACA,OAAO,SAAS,KAAK,MAAM,KAAK;CACjC;CAIA,gBAAgB,OAAO;EACtB,KAAK,MAAM,QAAQ,gBAAgB;GAClC,IAAI,CAAC,SAAS,CAAC,OAAO,OAAO,OAAO,IAAI,GAAK;GAC7C,MAAM,QAAQ,MAAM;GACpB,IAAI,UAAU,OAAO,UAAU,cAAc,OAAO,UAAU,WAC7D,KAAK,cAAc;IAAC,GAAG,KAAK;KAAc,OAAO;GAAK;QAChD,IAAI,KAAK,aACf,OAAO,KAAK,YAAY;EAE1B;CACD;CAEA,iBAAiB,MAAM;EACtB,IAAI,CAAC,KAAK,aAAe;EACzB,MAAM,SAAS,CAAC;EAChB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,WAAW,GAC1D,OAAO,QAAQ,SAAS,OAAO,IAAI;EAEpC,SAAS,KAAK,MAAM,MAAM;EAC1B,IAAI,OAAO,WAAW,KAAA,KAAa,KAAK,WACvC,UAAU,KAAK,MAAM,OAAO,MAAM;CAEpC;CAEA,oBAAoB;EACnB,KAAK,iBAAiB,KAAK,KAAK,QAAQ,CAAC;CAC1C;AACD,CAAC;AAED,aAAa,QAAQ,EACpB,UAAU,QAAQ;CACjB,KAAK,gBAAgB,EAAC,OAAM,CAAC;CAC7B,OAAO,KAAK,aAAa,UAAU,KAAK,OACvC,UAAU,KAAK,MAAM,SAAS,QAAQ,KAAK,KAAK,QAAQ,CAAC,CAAC,IAC1D,UAAU,KAAK,MAAM,MAAM;AAC7B,EACD,CAAC;AAED,KAAK,YAAY,WAAY;CAC5B,KAAK,gBAAgB,KAAK,OAAO;AAClC,CAAC"}
1
+ {"version":3,"file":"Path.ZoomStyles.js","names":[],"sources":["../../../../src/layer/vector/Path.ZoomStyles.js"],"sourcesContent":["import {Path} from './Path.js';\nimport {CircleMarker} from './CircleMarker.js';\n\n/**\n * A zoom-dependent style value, of the `weight` option of paths and the `radius` of\n * circle markers: either a function of the zoom or an object of zoom stops\n * `{zoom: value}`, using the value of the highest stop not above the zoom (or of the\n * lowest stop). The styles are updated on `zoomend`.\n *\n * Zoom-dependent styles are an optional feature, like the zoom expressions of\n * MapLibre: import this module to let the `weight` and `radius` options depend on the\n * zoom.\n *\n * ```js\n * import 'maplair/zoom-styles';\n *\n * new CircleMarker(latlng, {radius: {5: 3, 10: 6, 15: 10}}).addTo(map);\n * new Polyline(latlngs, {weight: zoom => zoom / 2}).addTo(map);\n * ```\n * @typedef {number|Record<number, number>|((zoom: number) => number)} ZoomStyle\n */\n\nconst zoomStyleNames = ['weight', 'radius'];\n\n// The value of `stops` (a function or an object of zoom stops) at `zoom`\nfunction evaluate(stops, zoom) {\n\tif (typeof stops === 'function') { return stops(zoom); }\n\tconst zooms = Object.keys(stops).map(Number).sort((a, b) => a - b);\n\treturn stops[zooms.findLast(z => z <= zoom) ?? zooms[0]];\n}\n\nconst {beforeAdd, setStyle} = Path.prototype,\n{setRadius} = CircleMarker.prototype;\n\nPath.include({\n\tgetEvents() {\n\t\t// also for zoom-dependent styles set later with `setStyle()`\n\t\treturn {zoomend: this._updateZoomStyles};\n\t},\n\n\tbeforeAdd(map) {\n\t\tbeforeAdd.call(this, map);\n\t\t// before the path is drawn\n\t\tthis._applyZoomStyles(map.getZoom());\n\t},\n\n\tsetStyle(style) {\n\t\tthis._takeZoomStyles(style);\n\t\tconst zoom = this._map?.getZoom();\n\t\tif (style && this._zoomStyles && zoom !== undefined) {\n\t\t\tstyle = {...style};\n\t\t\tfor (const [name, stops] of Object.entries(this._zoomStyles)) {\n\t\t\t\tif (Object.hasOwn(style, name)) {\n\t\t\t\t\tstyle[name] = evaluate(stops, zoom);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn setStyle.call(this, style);\n\t},\n\n\t// Keeps the zoom-dependent values of `style` (functions and objects) in\n\t// `_zoomStyles`, numbers replace them\n\t_takeZoomStyles(style) {\n\t\tfor (const name of zoomStyleNames) {\n\t\t\tif (!style || !Object.hasOwn(style, name)) { continue; }\n\t\t\tconst value = style[name];\n\t\t\tif (value && (typeof value === 'function' || typeof value === 'object')) {\n\t\t\t\tthis._zoomStyles = {...this._zoomStyles, [name]: value};\n\t\t\t} else if (this._zoomStyles) {\n\t\t\t\tdelete this._zoomStyles[name];\n\t\t\t}\n\t\t}\n\t},\n\n\t_applyZoomStyles(zoom) {\n\t\tif (!this._zoomStyles) { return; }\n\t\tconst values = {};\n\t\tfor (const [name, stops] of Object.entries(this._zoomStyles)) {\n\t\t\tvalues[name] = evaluate(stops, zoom);\n\t\t}\n\t\tsetStyle.call(this, values);\n\t\tif (values.radius !== undefined && this.setRadius) {\n\t\t\tsetRadius.call(this, values.radius);\n\t\t}\n\t},\n\n\t_updateZoomStyles() {\n\t\tthis._applyZoomStyles(this._map.getZoom());\n\t}\n});\n\nCircleMarker.include({\n\tsetRadius(radius) {\n\t\tthis._takeZoomStyles({radius});\n\t\tif (!this._zoomStyles?.radius) { return setRadius.call(this, radius); }\n\t\tif (this._map) { return setRadius.call(this, evaluate(radius, this._map.getZoom())); }\n\t\t// evaluated when the circle marker is added to a map\n\t\tthis.options.radius = this._radius = radius;\n\t\treturn this;\n\t}\n});\n\nPath.addInitHook(function () {\n\tthis._takeZoomStyles(this.options);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,iBAAiB,CAAC,UAAU,QAAQ;AAG1C,SAAS,SAAS,OAAO,MAAM;CAC9B,IAAI,OAAO,UAAU,YAAc,OAAO,MAAM,IAAI;CACpD,MAAM,QAAQ,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACjE,OAAO,MAAM,MAAM,UAAS,MAAK,KAAK,IAAI,KAAK,MAAM;AACtD;AAEA,MAAM,EAAC,WAAW,aAAY,KAAK,WACnC,EAAC,cAAa,aAAa;AAE3B,KAAK,QAAQ;CACZ,YAAY;EAEX,OAAO,EAAC,SAAS,KAAK,kBAAiB;CACxC;CAEA,UAAU,KAAK;EACd,UAAU,KAAK,MAAM,GAAG;EAExB,KAAK,iBAAiB,IAAI,QAAQ,CAAC;CACpC;CAEA,SAAS,OAAO;EACf,KAAK,gBAAgB,KAA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AS,KAAK,UAAU;CACrC,OAAO;AACR,EACD,CAAC;AAED,KAAK,YAAY,WAAY;CAC5B,KAAK,gBAAgB,KAAK,OAAO;AAClC,CAAC"}
@@ -237,7 +237,8 @@ GridLayer.include({ _getTiledPixelBounds(center) {
237
237
  /** @typedef {typeof blanketOverlayRotationMethods} BlanketOverlayMapRotationMethods */
238
238
  BlanketOverlay.include({
239
239
  _updateTransform(center, zoom) {
240
- const scale = this._map.getZoomScale(zoom, this._zoom), viewHalf = this._map._getViewSize().multiplyBy(.5 + this.options.padding), currentCenterPoint = this._map.project(this._center, zoom), topLeftOffset = viewHalf.multiplyBy(-scale)._add(currentCenterPoint)._subtract(this._map._getNewPixelOrigin(center, zoom))._round();
240
+ const scale = this._map.getZoomScale(zoom, this._zoom), viewHalf = this._map._getViewSize().multiplyBy(.5 + this.options.padding), currentCenterPoint = this._map.project(this._center, zoom), topLeftOffset = viewHalf.multiplyBy(-scale)._add(currentCenterPoint)._subtract(this._map._getNewPixelOrigin(center, zoom));
241
+ if (scale === 1) this._map._snapLayerPoint(topLeftOffset);
241
242
  setTransform(this._container, topLeftOffset, scale);
242
243
  },
243
244
  _onMoveEnd(ev) {
@@ -272,7 +273,7 @@ DivOverlay.include({
272
273
  },
273
274
  _updatePosition() {
274
275
  if (!this._map) return;
275
- const map = this._map, pos = map.latLngToLayerPoint(this._latlng)._round(), anchor = map._rotateToPane(new Point(this._getAnchor()));
276
+ const map = this._map, pos = map._snapLayerPoint(map.latLngToLayerPoint(this._latlng)), anchor = map._rotateToPane(new Point(this._getAnchor()));
276
277
  let offset = Point.from(this.options.offset);
277
278
  const transformed = this._zoomAnimated || this.options.overflow || map._bearing;
278
279
  if (!transformed) offset = offset.add(pos).add(anchor);
@@ -1 +1 @@
1
- {"version":3,"file":"Map.Rotation.js","names":["DomUtil.create","DomUtil.getPosition","DomUtil.getScale","PointerEvents.getPointers"],"sources":["../../../src/map/Map.Rotation.js"],"sourcesContent":["import {MaplairMap} from './Map.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as PointerEvents from '../dom/DomEvent.PointerEvents.js';\nimport {Draggable} from '../dom/Draggable.js';\nimport {Point} from '../geometry/Point.js';\nimport {Bounds} from '../geometry/Bounds.js';\nimport {BlanketOverlay} from '../layer/BlanketOverlay.js';\nimport {GridLayer} from '../layer/tile/GridLayer.js';\nimport {DivOverlay} from '../layer/DivOverlay.js';\nimport {Popup} from '../layer/Popup.js';\nimport {Tooltip} from '../layer/Tooltip.js';\nimport {Marker} from '../layer/marker/Marker.js';\nimport {MarkerDrag} from '../layer/marker/Marker.Drag.js';\nimport {DragHandler} from './handler/DragHandler.js';\nimport {PinchZoomHandler} from './handler/PinchZoomHandler.js';\nimport {ScrollWheelZoomHandler} from './handler/ScrollWheelZoomHandler.js';\nimport {TapDragZoomHandler} from './handler/TapDragZoomHandler.js';\nimport {RotateControl} from '../control/RotateControl.js';\n/** @import {MaplairEvent} from '../core/Events.js' */\n/** @import {LatLng} from '../geo/LatLng.js' */\n/** @import {PointExpression} from '../geometry/Point.js' */\n/** @import {PanOptions, InvalidateSizeOptions} from './Map.js' */\n\nexport {RotateControl};\n\n// The bearing in degrees in the range [0, 360)\nfunction normalizeBearing(bearing) {\n\treturn ((Number(bearing) % 360) + 360) % 360;\n}\n\n// Rotates `point` clockwise (on the screen) by `degrees` around the origin\nfunction rotatePoint(point, degrees) {\n\tconst angle = degrees * Math.PI / 180,\n\tcos = Math.cos(angle),\n\tsin = Math.sin(angle);\n\treturn new Point(point.x * cos - point.y * sin, point.x * sin + point.y * cos);\n}\n\n// The maps of the rotated panes, see `Draggable`\nconst rotatedMaps = new WeakMap();\n\n// Possible size savings: about 60% of the code of this module (about 7–8 kB of\n// its 13 kB minified) are copies of core methods, which are overridden because\n// the rotation changes a computation in their middle:\n// * Popup#_adjustPan, MarkerDrag#_adjustPan, DragHandler#_onDragEnd: the offsets\n// for panBy() in container pixels (about 1.1–1.3 kB each)\n// * PinchZoomHandler#_onPointerMove (1.6 kB) and ScrollWheelZoomHandler#_panBy:\n// the rotation by two fingers, the pinch and pan offsets in the rotated frame\n// * MaplairMap#invalidateSize, #_tryAnimatedPan, #_continuousZoom, #getPixelBounds,\n// GridLayer#_getTiledPixelBounds, BlanketOverlay#_updateTransform, #_onMoveEnd,\n// #_resizeContainer, DivOverlay#_updatePosition, #_setContainerPosition,\n// Popup#_animateZoom: the bounding box of the rotated view, the upright overlays\n// Most of these copies could be replaced by small extension points in the core\n// classes, which this module overrides instead: e.g. MaplairMap#_rotateToPane(offset),\n// #_rotateToContainer(offset) and #_getViewSize() returning the offset or size\n// unchanged, used where the copied methods differ (well below 1 kB in core, for\n// all maps); or by splitting the core methods, so that the computations in\n// question become methods of their own (e.g. the pinch center from the offset of\n// the fingers, the inertia offset, the box of a popup in container pixels).\n// Both would change the pre-existing classes, which this module leaves untouched.\n\n// The methods extended below\nconst {panBy} = MaplairMap.prototype,\n{getEvents: getDivOverlayEvents} = DivOverlay.prototype,\n{_setPosition: setTooltipPosition} = Tooltip.prototype,\n{getEvents: getMarkerEvents, _positionElements: positionMarkerElements} = Marker.prototype,\n{_onDown: onDraggableDown, _updatePosition: updateDraggablePosition} = Draggable.prototype,\n{_onPointerStart: onPinchStart} = PinchZoomHandler.prototype,\n{_onDown: onTapDragDown} = TapDragZoomHandler.prototype,\n{_pinchTo: pinchTo} = ScrollWheelZoomHandler.prototype;\n\n/**\n * Map options of the map rotation (`maplair/map-rotation`).\n * @typedef {object} RotationMapOptions\n * @lends MaplairMapOptions\n * @property {number} [bearing=0] Initial rotation of the map in degrees: the compass\n * direction pointing up, clockwise from north (e.g. `90` for east up), see\n * `setBearing()`.\n * @property {boolean} [pinchRotate=false] Whether the map can be rotated by turning two\n * fingers, see `setBearing()`.\n */\n\nMaplairMap.mergeOptions({\n\tbearing: 0,\n\tpinchRotate: false\n});\n\nMaplairMap.addInitHook(function () {\n\tif (this.options.bearing || this.options.pinchRotate || this.options.rotateControl) {\n\t\tthis._rotate(this.options.bearing);\n\t\tif (this._loaded) {\n\t\t\tthis.fire('moveend');\n\t\t}\n\t}\n});\n\nRotateControl.register(MaplairMap);\n\n/**\n * Methods of `MaplairMap` for the map rotation. The rotation of the map is an optional\n * feature: import this module (`maplair/map-rotation`) to add the `bearing`,\n * `pinchRotate` and `rotateControl` options, `setBearing()`, `getBearing()` and the\n * `rotate` event to `MaplairMap`, and the `RotateControl`. Maps not using it don't\n * contain its code.\n *\n * The map pane is wrapped in a pane rotated around the center of the container.\n * Container/layer point conversions, `getPixelBounds()` and `getBounds()` account\n * for the rotation; grid layers and vector renderers cover the bounding box of\n * the rotated view; markers, popups and tooltips stay upright (see the Marker\n * option `rotateWithView`); dragging, `panBy()`, the keyboard, pinch, tap-drag,\n * touchpad and continuous zoom work in container pixels.\n *\n * @example\n * ```js\n * import {MaplairMap} from 'maplair';\n * import {RotateControl} from 'maplair/map-rotation';\n *\n * const map = new MaplairMap('map', {bearing: 30, pinchRotate: true, rotateControl: true});\n * ```\n *\n * @lends MaplairMap.prototype\n * @fires MaplairMap#rotate {MaplairEvent} Fired when the bearing of the map changes,\n * see `setBearing()`.\n */\nconst mapRotationMethods = {\n\t/**\n\t * Rotates the map around the center of the view, so that the compass direction\n\t * `bearing` (in degrees, clockwise from north) points up. Markers, popups and\n\t * tooltips stay upright. With `{animate: true}`, the map rotates smoothly (the\n\t * shorter way round).\n\t * @group Map rotation\n\t * @param {number} bearing\n\t * @param {{animate?: boolean}} [options]\n\t * @returns {this}\n\t */\n\tsetBearing(bearing, options) {\n\t\tbearing = normalizeBearing(bearing);\n\t\tconst from = this.getBearing();\n\t\tif (!this._rotatePane && !bearing) { return this; }\n\t\tif (bearing === from) { return this; }\n\n\t\tthis._stop();\n\t\tif (!options?.animate || !this._loaded || this._prefersReducedMotion()) {\n\t\t\tthis._rotate(bearing);\n\t\t\treturn this._loaded ? this.fire('movestart').fire('move').fire('moveend') : this;\n\t\t}\n\n\t\t// the shorter way round\n\t\tconst delta = ((bearing - from + 540) % 360) - 180,\n\t\tstart = performance.now(),\n\t\tduration = 250;\n\t\tthis.fire('movestart');\n\t\tconst frame = () => {\n\t\t\tconst t = Math.min(1, (performance.now() - start) / duration);\n\t\t\tthis._rotate(from + delta * (1 - (1 - t) ** 2));\n\t\t\tthis.fire('move');\n\t\t\tif (t < 1) {\n\t\t\t\t// cancelled by `_stop()`\n\t\t\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\t\t} else {\n\t\t\t\tthis.fire('moveend');\n\t\t\t}\n\t\t};\n\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\treturn this;\n\t},\n\n\t// Applies the bearing without the events of a view change (e.g. while pinching)\n\t_rotate(bearing) {\n\t\tbearing = normalizeBearing(bearing);\n\t\tif (!this._rotatePane) {\n\t\t\t// the map pane is wrapped in a pane rotated around the center of the container\n\t\t\tconst rotatePane = this._rotatePane = DomUtil.create('div', 'maplair-rotate-pane');\n\t\t\trotatedMaps.set(rotatePane, this);\n\t\t\tthis._mapPane.before(rotatePane);\n\t\t\trotatePane.append(this._mapPane);\n\t\t}\n\t\tif (bearing === this.getBearing()) { return; }\n\n\t\tthis._bearing = bearing;\n\t\tthis._rotatePane.style.transform = bearing ? `rotate(${-bearing}deg)` : '';\n\n\t\tif (this._loaded) {\n\t\t\tthis.fire('rotate');\n\t\t}\n\t},\n\n\t/**\n\t * Returns the rotation of the map, see `setBearing()`.\n\t * @group Map rotation\n\t * @returns {number}\n\t */\n\tgetBearing() {\n\t\treturn this._bearing ?? 0;\n\t},\n\n\t// Rotates an offset in container (screen) pixels to the frame of the rotated map pane\n\t_rotateToPane(point) {\n\t\treturn this._bearing ? rotatePoint(point, this._bearing) : point;\n\t},\n\n\t// Rotates an offset in the frame of the rotated map pane to container (screen) pixels\n\t_rotateToContainer(point) {\n\t\treturn this._bearing ? rotatePoint(point, -this._bearing) : point;\n\t},\n\n\t// The size of the bounding box of the rotated view, in pixels of the map pane\n\t_getViewSize() {\n\t\tconst size = this.getSize();\n\t\tif (!this._bearing) { return size; }\n\t\tconst angle = this._bearing * Math.PI / 180,\n\t\tcos = Math.abs(Math.cos(angle)),\n\t\tsin = Math.abs(Math.sin(angle));\n\t\treturn new Point(size.x * cos + size.y * sin, size.x * sin + size.y * cos);\n\t},\n\n\t// Counter-rotates `el` (positioned with `DomUtil.setPosition()`) around its CSS\n\t// `transformOrigin`, so that it stays upright on a rotated map.\n\t_rotateUpright(el, transformOrigin) {\n\t\tif (this._bearing) {\n\t\t\tel.style.transform += ` rotate(${this._bearing}deg)`;\n\t\t\tel.style.transformOrigin = transformOrigin;\n\t\t} else if (el.style.transformOrigin) {\n\t\t\tel.style.transformOrigin = '';\n\t\t}\n\t},\n\n\t/**\n\t * Overrides `containerPointToLayerPoint()` of `MaplairMap` (documented there) to\n\t * account for the rotation.\n\t * @internal\n\t * @param {PointExpression} point\n\t * @returns {Point}\n\t */\n\tcontainerPointToLayerPoint(point) { // (Point)\n\t\tpoint = Point.from(point);\n\t\tif (this._bearing) {\n\t\t\t// the map pane is rotated around the center of the container\n\t\t\tconst center = this.getSize()._divideBy(2);\n\t\t\tpoint = this._rotateToPane(point.subtract(center))._add(center);\n\t\t}\n\t\treturn point.subtract(this._getMapPanePos());\n\t},\n\n\t/**\n\t * Overrides `layerPointToContainerPoint()` of `MaplairMap` (documented there) to\n\t * account for the rotation.\n\t * @internal\n\t * @param {PointExpression} point\n\t * @returns {Point}\n\t */\n\tlayerPointToContainerPoint(point) { // (Point)\n\t\tpoint = Point.from(point).add(this._getMapPanePos());\n\t\tif (this._bearing) {\n\t\t\tconst center = this.getSize()._divideBy(2);\n\t\t\tpoint = this._rotateToContainer(point.subtract(center))._add(center);\n\t\t}\n\t\treturn point;\n\t},\n\n\t/**\n\t * Overrides `getPixelBounds()` of `MaplairMap` (documented there): the bounding box\n\t * of the rotated view.\n\t * @internal\n\t * @param {LatLng} [center]\n\t * @param {number} [zoom]\n\t * @returns {Bounds}\n\t */\n\tgetPixelBounds(center, zoom) {\n\t\tconst topLeftPoint = this._getTopLeftPoint(center, zoom);\n\t\tif (!this._bearing) {\n\t\t\treturn new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\n\t\t}\n\t\t// the bounding box of the rotated view\n\t\tconst pixelCenter = topLeftPoint.add(this.getSize()._divideBy(2)),\n\t\thalf = this._getViewSize()._divideBy(2);\n\t\treturn new Bounds(pixelCenter.subtract(half), pixelCenter.add(half));\n\t},\n\n\t/**\n\t * Overrides `panBy()` of `MaplairMap` (documented there): `panBy()` takes offsets in\n\t * container pixels, the map pane moves in its rotated frame.\n\t * @internal\n\t * @param {PointExpression} offset\n\t * @param {PanOptions} [options]\n\t * @returns {this}\n\t */\n\tpanBy(offset, options) {\n\t\treturn panBy.call(this, this._rotateToPane(Point.from(offset)), options);\n\t},\n\n\t_tryAnimatedPan(center, options) {\n\t\t// difference between the new and current centers in pixels\n\t\t// difference in the frame of the map pane, which `_panBy()` moves\n\t\tconst offset = this.latLngToLayerPoint(center)._subtract(this._getCenterLayerPoint())._round();\n\n\t\t// don't animate too far unless animate: true specified in options\n\t\tif (options?.animate !== true && !this.getSize().contains(this._rotateToContainer(offset))) { return false; }\n\n\t\tthis._panBy(offset, options);\n\n\t\treturn true;\n\t},\n\n\t/**\n\t * Overrides `invalidateSize()` of `MaplairMap` (documented there) to pan in container\n\t * pixels.\n\t * @internal\n\t * @param {boolean|InvalidateSizeOptions} [options]\n\t * @returns {this}\n\t */\n\tinvalidateSize(options) {\n\t\tif (!this._loaded) { return this; }\n\n\t\toptions = {\n\t\t\tanimate: false,\n\t\t\tpan: true,\n\t\t\t...(options === true ? {animate: true} : options)\n\t\t};\n\n\t\tconst oldSize = this.getSize();\n\t\tthis._sizeChanged = true;\n\t\tthis._lastCenter = null;\n\n\t\tconst newSize = this.getSize(),\n\t\toldCenter = oldSize.divideBy(2).round(),\n\t\tnewCenter = newSize.divideBy(2).round(),\n\t\toffset = oldCenter.subtract(newCenter);\n\n\t\tif (!offset.x && !offset.y) { return this; }\n\n\t\tif (options.animate && options.pan) {\n\t\t\tthis.panBy(this._rotateToContainer(offset));\n\n\t\t} else {\n\t\t\tif (options.pan) {\n\t\t\t\tthis._rawPanBy(offset);\n\t\t\t}\n\n\t\t\tthis.fire('move');\n\n\t\t\tif (options.debounceMoveend) {\n\t\t\t\tclearTimeout(this._sizeTimer);\n\t\t\t\tthis._sizeTimer = setTimeout(this.fire.bind(this, 'moveend'), 200);\n\t\t\t} else {\n\t\t\t\tthis.fire('moveend');\n\t\t\t}\n\t\t}\n\n\t\treturn this.fire('resize', {\n\t\t\toldSize,\n\t\t\tnewSize\n\t\t});\n\t},\n\n\t// Zooms to `center` and `zoom` frame by frame around the zoom origin at `offset`\n\t// from the center (as the CSS zoom animation does), see the `continuousZoom` option.\n\t_continuousZoom(center, zoom, offset, options) {\n\t\tconst startZoom = this._zoom,\n\t\toriginOffset = offset.multiplyBy(-1),\n\t\torigin = this.layerPointToLatLng(this._getCenterLayerPoint().add(offset)),\n\t\tstart = performance.now(),\n\t\tduration = 250;\n\n\t\tthis._moveStart(true, options.noMoveStart ?? false);\n\n\t\tconst frame = () => {\n\t\t\tconst t = Math.min(1, (performance.now() - start) / duration);\n\t\t\tif (t < 1) {\n\t\t\t\t// ease out, like the CSS zoom transition\n\t\t\t\tconst z = startZoom + (zoom - startZoom) * (1 - (1 - t) ** 2);\n\t\t\t\tthis._move(this.unproject(this.project(origin, z).add(originOffset), z), z, {continuous: true});\n\t\t\t\t// cancelled by `_stop()`\n\t\t\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\t\t} else {\n\t\t\t\tthis._move(center, zoom)._moveEnd(true);\n\t\t\t}\n\t\t};\n\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t}\n};\n/** @typedef {typeof mapRotationMethods} MapRotationMethods */\n\nMaplairMap.include(mapRotationMethods);\n\n/**\n * Methods of `GridLayer` for the map rotation: the tiles cover the bounding box of the\n * rotated view.\n * @lends GridLayer.prototype\n */\nconst gridLayerRotationMethods = {\n\t_getTiledPixelBounds(center) {\n\t\tconst map = this._map,\n\t\tmapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),\n\t\tscale = map.getZoomScale(mapZoom, this._tileZoom),\n\t\tpixelCenter = map.project(center, this._tileZoom).floor(),\n\t\thalfSize = map._getViewSize().divideBy(scale * 2);\n\n\t\treturn new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));\n\t}\n};\n/** @typedef {typeof gridLayerRotationMethods} GridLayerMapRotationMethods */\n\nGridLayer.include(gridLayerRotationMethods);\n\n/**\n * Methods of `BlanketOverlay` for the map rotation: the overlay covers the bounding\n * box of the rotated view.\n * @lends BlanketOverlay.prototype\n */\nconst blanketOverlayRotationMethods = {\n\t_updateTransform(center, zoom) {\n\t\tconst scale = this._map.getZoomScale(zoom, this._zoom),\n\t\tviewHalf = this._map._getViewSize().multiplyBy(0.5 + this.options.padding),\n\t\tcurrentCenterPoint = this._map.project(this._center, zoom),\n\t\ttopLeftOffset = viewHalf.multiplyBy(-scale)._add(currentCenterPoint)\n\t\t\t._subtract(this._map._getNewPixelOrigin(center, zoom))\n\t\t\t._round();\n\n\t\tDomUtil.setTransform(this._container, topLeftOffset, scale);\n\t},\n\n\t_onMoveEnd(ev) {\n\t\t// Update pixel bounds of renderer container (for positioning/sizing/clipping later)\n\t\t// the bounding box of the (possibly rotated) view, extended by the padding\n\t\tconst p = this.options.padding,\n\t\tsize = this._map._getViewSize();\n\t\tif (!size.multiplyBy(1 + p * 2).round().equals(this._containerSize)) {\n\t\t\t// e.g. after rotating the map\n\t\t\tthis._resizeContainer();\n\t\t}\n\t\tconst min = this._map._getCenterLayerPoint().subtract(size.multiplyBy(0.5 + p)).round();\n\n\t\tthis._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());\n\n\t\tthis._center = this._map.getCenter();\n\t\tthis._zoom = this._map.getZoom();\n\t\tthis._updateTransform(this._center, this._zoom);\n\n\t\tthis._onSettled(ev);\n\t},\n\n\t_resizeContainer() {\n\t\tconst p = this.options.padding,\n\t\tsize = this._containerSize = this._map._getViewSize().multiplyBy(1 + p * 2).round();\n\t\tthis._container.style.width = `${size.x}px`;\n\t\tthis._container.style.height = `${size.y}px`;\n\t\treturn size;\n\t}\n};\n/** @typedef {typeof blanketOverlayRotationMethods} BlanketOverlayMapRotationMethods */\n\nBlanketOverlay.include(blanketOverlayRotationMethods);\n\n/**\n * Methods of `DivOverlay` for the map rotation: the overlays stay upright.\n * @lends DivOverlay.prototype\n */\nconst divOverlayRotationMethods = {\n\t/**\n\t * Overrides `getEvents()` of `DivOverlay` to update the position on rotation.\n\t * @internal\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\treturn {...getDivOverlayEvents.call(this), rotate: this._updatePosition};\n\t},\n\n\t_updatePosition() {\n\t\tif (!this._map) { return; }\n\n\t\tconst map = this._map,\n\t\tpos = map.latLngToLayerPoint(this._latlng)._round(),\n\t\t// on a rotated map, the anchor is relative to the upright overlay\n\t\tanchor = map._rotateToPane(new Point(this._getAnchor()));\n\t\tlet offset = Point.from(this.options.offset);\n\n\t\tconst transformed = this._zoomAnimated || this.options.overflow || map._bearing;\n\t\tif (!transformed) {\n\t\t\toffset = offset.add(pos).add(anchor);\n\t\t}\n\n\t\tconst bottom = this._containerBottom = -offset.y,\n\t\tleft = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;\n\n\t\t// bottom position the overlay in case the height of the overlay changes (images loading etc)\n\t\tif (this.options.overflow) {\n\t\t\t// relative to the top of the viewport instead of the pane origin\n\t\t\tthis._container.style.top = 'auto';\n\t\t\tthis._container.style.bottom = `calc(100% + ${bottom}px)`;\n\t\t} else {\n\t\t\tthis._container.style.bottom = `${bottom}px`;\n\t\t}\n\t\tthis._container.style.left = `${left}px`;\n\n\t\tif (transformed) {\n\t\t\t// upright around the anchored point (below the bottom margin, see `Popup`)\n\t\t\tthis._setContainerPosition(pos.add(anchor), `${-left}px calc(100% + ${bottom + (this._containerMarginBottom ?? 0)}px)`);\n\t\t}\n\t},\n\n\t// Positions the container at the given layer point. An overflowing overlay\n\t// lives in the top layer of the page, so it is positioned in viewport coordinates.\n\t// `transformOrigin` is the point around which the container is kept upright on a rotated map.\n\t_setContainerPosition(pos, transformOrigin) {\n\t\tthis._containerPos = pos;\n\t\tif (this.options.overflow) {\n\t\t\tconst mapContainer = this._map._container,\n\t\t\trect = mapContainer.getBoundingClientRect();\n\t\t\tpos = this._map.layerPointToContainerPoint(pos)\n\t\t\t\t._add(new Point(rect.left + mapContainer.clientLeft, rect.top + mapContainer.clientTop));\n\t\t}\n\t\tDomUtil.setPosition(this._container, pos);\n\t\tif (!this.options.overflow) {\n\t\t\tthis._map._rotateUpright(this._container, transformOrigin);\n\t\t}\n\t}\n};\n/** @typedef {typeof divOverlayRotationMethods} DivOverlayMapRotationMethods */\n\nDivOverlay.include(divOverlayRotationMethods);\n\n/**\n * Methods of `Popup` for the map rotation: the popup stays upright, autopanning in\n * container pixels.\n * @lends Popup.prototype\n */\nconst popupRotationMethods = {\n\t_animateZoom(e) {\n\t\tconst pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),\n\t\tanchor = this._map._rotateToPane(new Point(this._getAnchor()));\n\t\tthis._setContainerPosition(pos.add(anchor), this._container.style.transformOrigin);\n\t},\n\n\t_adjustPan() {\n\t\tif (!this.options.autoPan) { return; }\n\t\tthis._map._panAnim?.stop();\n\n\t\t// We can endlessly recurse if keepInView is set and the view resets.\n\t\t// Let's guard against that by exiting early if we're responding to our own autopan.\n\t\tif (this._autopanning) {\n\t\t\tthis._autopanning = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst map = this._map,\n\t\tmarginBottom = this._containerMarginBottom ?? (parseInt(getComputedStyle(this._container).marginBottom, 10) || 0),\n\t\tcontainerHeight = this._containerHeight + marginBottom,\n\t\tcontainerWidth = this._containerWidth,\n\t\t// the top left corner, relative to the (upright) anchored point\n\t\ttopLeft = new Point(this._containerLeft, -containerHeight - this._containerBottom);\n\n\t\tconst containerPos = map.layerPointToContainerPoint(this._getContainerPosition())._add(topLeft),\n\t\tpadding = Point.from(this.options.autoPanPadding),\n\t\tpaddingTL = Point.from(this.options.autoPanPaddingTopLeft ?? padding),\n\t\tpaddingBR = Point.from(this.options.autoPanPaddingBottomRight ?? padding),\n\t\tsize = map.getSize();\n\t\tlet dx = 0,\n\t\tdy = 0;\n\n\t\tif (containerPos.x + containerWidth + paddingBR.x > size.x) { // right\n\t\t\tdx = containerPos.x + containerWidth - size.x + paddingBR.x;\n\t\t}\n\t\tif (containerPos.x - dx - paddingTL.x < 0) { // left\n\t\t\tdx = containerPos.x - paddingTL.x;\n\t\t}\n\t\tif (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom\n\t\t\tdy = containerPos.y + containerHeight - size.y + paddingBR.y;\n\t\t}\n\t\tif (containerPos.y - dy - paddingTL.y < 0) { // top\n\t\t\tdy = containerPos.y - paddingTL.y;\n\t\t}\n\n\t\t// see the `autopanstart` event of `Popup`\n\t\tif (dx || dy) {\n\t\t\t// Track that we're autopanning, as this function will be re-ran on moveend\n\t\t\tif (this.options.keepInView) {\n\t\t\t\tthis._autopanning = true;\n\t\t\t}\n\n\t\t\tmap\n\t\t\t\t.fire('autopanstart')\n\t\t\t\t.panBy([dx, dy]);\n\t\t}\n\t}\n};\n/** @typedef {typeof popupRotationMethods} PopupMapRotationMethods */\n\nPopup.include(popupRotationMethods);\n\n// The margins of the directions, see `.maplair-tooltip-top` etc. in maplair.css\nconst tooltipMargins = {\n\ttop: [0, -6],\n\tbottom: [0, 6],\n\tleft: [-6, 0],\n\tright: [6, 0]\n};\n\n/**\n * Methods of `Tooltip` for the map rotation: the tooltip stays upright.\n * @lends Tooltip.prototype\n */\nconst tooltipRotationMethods = {\n\t// On a rotated map, the tooltip is positioned at its source and kept upright\n\t// around it (taking the margin of the direction into account)\n\t_setPosition(pos) {\n\t\tsetTooltipPosition.call(this, pos);\n\t\tconst container = this._container;\n\t\tif (this.options.overflow) { return; }\n\t\tif (!this._map._bearing) {\n\t\t\tcontainer.style.left = container.style.top = '';\n\t\t\treturn;\n\t\t}\n\t\tconst delta = this._containerPos.subtract(pos),\n\t\tdirection = Object.keys(tooltipMargins).find(d => container.classList.contains(`maplair-tooltip-${d}`)),\n\t\tmargin = tooltipMargins[direction] ?? [0, 0];\n\t\tcontainer.style.left = `${delta.x}px`;\n\t\tcontainer.style.top = `${delta.y}px`;\n\t\tthis._setContainerPosition(pos, `${-delta.x - margin[0]}px ${-delta.y - margin[1]}px`);\n\t}\n};\n/** @typedef {typeof tooltipRotationMethods} TooltipMapRotationMethods */\n\nTooltip.include(tooltipRotationMethods);\n\n/**\n * Options of `Marker` for the map rotation.\n * @typedef {object} MarkerMapRotationOptions\n * @lends MarkerOptions\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. The `rotation` of\n * the marker is relative to the screen, or to north with `rotateWithView`.\n */\nMarker.include({\n\toptions: {\n\t\trotateWithView: false\n\t}\n});\n\n/**\n * Methods of `Marker` for the map rotation: the marker is updated on rotation, and\n * its icon and shadow stay upright.\n * @lends Marker.prototype\n */\nconst markerRotationMethods = {\n\t/**\n\t * Overrides `getEvents()` of `Marker` to update the marker on rotation.\n\t * @internal\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\treturn {...getMarkerEvents.call(this), rotate: this.update};\n\t},\n\n\t_positionElements(pos) {\n\t\tpositionMarkerElements.call(this, pos);\n\t\tconst bearing = this.options.rotateWithView ? 0 : (this._map?.getBearing() ?? 0);\n\t\tif (!bearing) { return; }\n\t\tfor (const el of [this._icon, this._shadow]) {\n\t\t\tif (el) { el.style.transform += ` rotate(${bearing}deg)`; }\n\t\t}\n\t}\n};\n/** @typedef {typeof markerRotationMethods} MarkerMapRotationMethods */\n\nMarker.include(markerRotationMethods);\n\n/**\n * Methods of `MarkerDrag` for the map rotation: autopanning in container pixels.\n * @lends MarkerDrag.prototype\n */\nconst markerDragRotationMethods = {\n\t_adjustPan(e) {\n\t\tconst marker = this._marker,\n\t\tmap = marker._map,\n\t\tspeed = this._marker.options.autoPanSpeed,\n\t\tpadding = this._marker.options.autoPanPadding,\n\t\ticonPos = DomUtil.getPosition(marker._icon),\n\t\tbounds = map.getPixelBounds(),\n\t\torigin = map.getPixelOrigin();\n\n\t\tconst panBounds = new Bounds(\n\t\t\tbounds.min._subtract(origin).add(padding),\n\t\t\tbounds.max._subtract(origin).subtract(padding)\n\t\t);\n\n\t\tif (!panBounds.contains(iconPos)) {\n\t\t\t// Compute incremental movement\n\t\t\tconst movement = new Point(\n\t\t\t\t(Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) -\n\t\t\t\t\t(Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x),\n\n\t\t\t\t(Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) -\n\t\t\t\t\t(Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)\n\t\t\t).multiplyBy(speed);\n\n\t\t\tmap.panBy(map._rotateToContainer(movement), {animate: false});\n\n\t\t\tthis._draggable._newPos._add(movement);\n\t\t\tthis._draggable._startPos._add(movement);\n\n\t\t\tDomUtil.setPosition(marker._icon, this._draggable._newPos);\n\t\t\tthis._onDrag(e);\n\n\t\t\tthis._panRequest = requestAnimationFrame(this._adjustPan.bind(this, e));\n\t\t}\n\t}\n};\n/** @typedef {typeof markerDragRotationMethods} MarkerDragMapRotationMethods */\n\nMarkerDrag.include(markerDragRotationMethods);\n\n/**\n * Methods of `Draggable` for the map rotation: dragging in the rotated frame of the\n * map pane.\n * @lends Draggable.prototype\n */\nconst draggableRotationMethods = {\n\t_onDown(e) {\n\t\tonDraggableDown.call(this, e);\n\t\t// on a rotated map, the element moves in the rotated frame of the map pane,\n\t\t// and the rotated pane is scaled by its bounding box (see `DomUtil.getScale()`)\n\t\tconst rotatePane = this._element.closest?.('.maplair-rotate-pane');\n\t\tthis._rotatedMap = rotatePane && rotatedMaps.get(rotatePane);\n\t\tif (this._rotatedMap && this._parentScale) {\n\t\t\tthis._parentScale = DomUtil.getScale(rotatePane.parentNode);\n\t\t}\n\t},\n\n\t_updatePosition() {\n\t\tconst map = this._rotatedMap;\n\t\tif (map?._bearing) {\n\t\t\tthis._newPos = this._startPos.add(map._rotateToPane(this._newPos.subtract(this._startPos)));\n\t\t}\n\t\tupdateDraggablePosition.call(this);\n\t}\n};\n/** @typedef {typeof draggableRotationMethods} DraggableMapRotationMethods */\n\nDraggable.include(draggableRotationMethods);\n\n/**\n * Methods of `DragHandler` for the map rotation: the inertia in container pixels.\n * @lends DragHandler.prototype\n */\nconst dragHandlerRotationMethods = {\n\t_onDragEnd(e) {\n\t\tconst map = this._map,\n\t\toptions = map.options,\n\n\t\tnoInertia = !options.inertia || e.noInertia || this._times.length < 2;\n\n\t\tmap.fire('dragend', e);\n\n\t\tif (noInertia) {\n\t\t\tmap.fire('moveend');\n\n\t\t} else {\n\t\t\tthis._prunePositions(Date.now());\n\n\t\t\tconst direction = this._lastPos.subtract(this._positions[0]),\n\t\t\tduration = (this._lastTime - this._times[0]) / 1000,\n\t\t\tease = options.easeLinearity,\n\n\t\t\tspeedVector = direction.multiplyBy(ease / duration),\n\t\t\tspeed = speedVector.distanceTo([0, 0]),\n\n\t\t\tlimitedSpeed = Math.min(options.inertiaMaxSpeed, speed),\n\t\t\tlimitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),\n\n\t\t\tmaxOffset = map.getSize().divideBy(2);\n\n\t\t\tlet decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),\n\t\t\toffset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();\n\n\t\t\t// with reduced motion, shorten the coast to fit within half the map size, see DragHandler\n\t\t\tif (map._prefersReducedMotion() && !maxOffset.contains(offset)) {\n\t\t\t\tconst k = Math.min(maxOffset.x / Math.abs(offset.x), maxOffset.y / Math.abs(offset.y));\n\t\t\t\toffset = offset.multiplyBy(k).round();\n\t\t\t\tdecelerationDuration *= Math.sqrt(k);\n\t\t\t}\n\n\t\t\tif (!offset.x && !offset.y) {\n\t\t\t\tmap.fire('moveend');\n\n\t\t\t} else {\n\t\t\t\toffset = map._limitOffset(offset, map.options.maxBounds);\n\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t// the offset of the map pane, `panBy()` takes container pixels\n\t\t\t\t\tmap.panBy(map._rotateToContainer(offset), {\n\t\t\t\t\t\tduration: decelerationDuration,\n\t\t\t\t\t\teaseLinearity: ease,\n\t\t\t\t\t\tnoMoveStart: true,\n\t\t\t\t\t\tanimate: true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n};\n/** @typedef {typeof dragHandlerRotationMethods} DragHandlerMapRotationMethods */\n\nDragHandler.include(dragHandlerRotationMethods);\n\n// The time (ms) without further wheel events after which a touchpad pan ends, see `ScrollWheelZoomHandler`\nconst gestureEndDelay = 150;\n\n// The angle (degrees) the fingers have to turn before the map starts rotating\nconst rotateThreshold = 15;\n\nfunction angleOf(p1, p2) {\n\treturn Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;\n}\n\n/**\n * Methods of `PinchZoomHandler` for the map rotation: rotating by turning two fingers\n * (see the map option `pinchRotate`), pinching in the rotated frame.\n * @lends PinchZoomHandler.prototype\n */\nconst pinchZoomHandlerRotationMethods = {\n\t_onPointerStart(e) {\n\t\tonPinchStart.call(this, e);\n\t\tconst pointers = PointerEvents.getPointers();\n\t\tif (this._zooming && pointers.length === 2) {\n\t\t\tthis._startAngle = angleOf(...pointers.map(p => this._map.pointerEventToContainerPoint(p)));\n\t\t\tthis._startBearing = this._map.getBearing();\n\t\t\tthis._rotating = false;\n\t\t}\n\t},\n\n\t_onPointerMove(e) {\n\t\tconst pointers = PointerEvents.getPointers();\n\t\tif (pointers.length !== 2 || !this._zooming) { return; }\n\n\t\tconst map = this._map,\n\t\tp1 = map.pointerEventToContainerPoint(pointers[0]),\n\t\tp2 = map.pointerEventToContainerPoint(pointers[1]),\n\t\tscale = p1.distanceTo(p2) / this._startDist;\n\n\t\tthis._zoom = map.getScaleZoom(scale, this._startZoom);\n\n\t\tif (map.options.pinchRotate) {\n\t\t\tconst angle = angleOf(p1, p2);\n\t\t\tlet delta = ((angle - this._startAngle + 540) % 360) - 180;\n\t\t\tif (!this._rotating && Math.abs(delta) > rotateThreshold) {\n\t\t\t\t// start rotating from the threshold on, without a jump\n\t\t\t\tthis._rotating = true;\n\t\t\t\tthis._startAngle += Math.sign(delta) * rotateThreshold;\n\t\t\t\tdelta -= Math.sign(delta) * rotateThreshold;\n\t\t\t}\n\t\t\tif (this._rotating) {\n\t\t\t\t// turning the fingers clockwise turns the map clockwise\n\t\t\t\tmap._rotate(this._startBearing - delta);\n\t\t\t}\n\t\t}\n\n\t\tif (!map.options.bounceAtZoomLimits && (\n\t\t\t(this._zoom < map.getMinZoom() && scale < 1) ||\n\t\t\t\t(this._zoom > map.getMaxZoom() && scale > 1))) {\n\t\t\tthis._zoom = map._limitZoom(this._zoom);\n\t\t}\n\n\t\tif (map.options.pinchZoom === 'center') {\n\t\t\tthis._center = this._startLatLng;\n\t\t\tif (scale === 1 && !this._rotating) { return; }\n\t\t} else {\n\t\t\t// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng\n\t\t\tconst delta = map._rotateToPane(p1._add(p2)._divideBy(2)._subtract(this._centerPoint));\n\t\t\tif (scale === 1 && delta.x === 0 && delta.y === 0 && !this._rotating) { return; }\n\t\t\tthis._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);\n\t\t}\n\n\t\tif (!this._moved) {\n\t\t\tmap._setUserEvent(e);\n\t\t\tmap._moveStart(true, false);\n\t\t\tthis._moved = true;\n\t\t}\n\n\t\tcancelAnimationFrame(this._animRequest);\n\n\t\tconst moveFn = map._move.bind(map, this._center, this._zoom, {pinch: true}, undefined);\n\t\tthis._animRequest = requestAnimationFrame(moveFn.bind(this));\n\n\t\te.preventDefault();\n\t}\n};\n/** @typedef {typeof pinchZoomHandlerRotationMethods} PinchZoomHandlerMapRotationMethods */\n\nPinchZoomHandler.include(pinchZoomHandlerRotationMethods);\n\n/**\n * Methods of `TapDragZoomHandler` for the map rotation: the zoom origin in the rotated\n * frame.\n * @lends TapDragZoomHandler.prototype\n */\nconst tapDragZoomHandlerRotationMethods = {\n\t_onDown(e) {\n\t\tonTapDragDown.call(this, e);\n\t\t// the offset of the zoom origin in the rotated frame of the map pane\n\t\tif (this._zooming && this._aroundOffset) {\n\t\t\tthis._aroundOffset = this._map._rotateToPane(this._aroundOffset);\n\t\t}\n\t}\n};\n/** @typedef {typeof tapDragZoomHandlerRotationMethods} TapDragZoomHandlerMapRotationMethods */\n\nTapDragZoomHandler.include(tapDragZoomHandlerRotationMethods);\n\n/**\n * Methods of `ScrollWheelZoomHandler` for the map rotation: zooming and panning in the\n * rotated frame.\n * @lends ScrollWheelZoomHandler.prototype\n */\nconst scrollWheelZoomHandlerRotationMethods = {\n\t_pinchTo(e, zoom, eased) {\n\t\tpinchTo.call(this, e, zoom, eased);\n\t\t// the offset of the zoom origin in the rotated frame of the map pane\n\t\tif (this._pinch && !this._pinch.rotated) {\n\t\t\tthis._pinch.offset = this._map._rotateToPane(this._pinch.offset);\n\t\t\tthis._pinch.rotated = true;\n\t\t}\n\t},\n\n\t// Pans the map by the wheel deltas, as by scrolling with two fingers on a touchpad.\n\t_panBy(e) {\n\t\tDomEvent.stop(e);\n\t\tconst map = this._map;\n\t\tif (map._animatingZoom) { return; }\n\n\t\tconst factor = e.deltaMode === 1 ? 20 : e.deltaMode === 2 ? 60 : 1;\n\t\tlet offset = new Point(e.deltaX * factor, e.deltaY * factor);\n\t\tif (e.shiftKey && !e.deltaX) {\n\t\t\t// Shift with a mouse wheel scrolls horizontally\n\t\t\toffset = new Point(offset.y, 0);\n\t\t}\n\t\t// in the rotated frame of the map pane\n\t\toffset = map._rotateToPane(offset);\n\t\tif (map.options.maxBounds) {\n\t\t\toffset = map._limitOffset(offset, map.options.maxBounds);\n\t\t}\n\n\t\tif (!this._panning) {\n\t\t\tmap._stop();\n\t\t\tthis._panning = true;\n\t\t\tmap._setUserEvent(e);\n\t\t\tmap.fire('movestart');\n\t\t}\n\t\tmap._rawPanBy(offset.round());\n\t\tmap.fire('move');\n\n\t\tclearTimeout(this._panTimer);\n\t\tthis._panTimer = setTimeout(this._endPan.bind(this), gestureEndDelay);\n\t}\n};\n/** @typedef {typeof scrollWheelZoomHandlerRotationMethods} ScrollWheelZoomHandlerMapRotationMethods */\n\nScrollWheelZoomHandler.include(scrollWheelZoomHandlerRotationMethods);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,iBAAiB,SAAS;CAClC,QAAS,OAAO,OAAO,IAAI,MAAO,OAAO;AAC1C;AAGA,SAAS,YAAY,OAAO,SAAS;CACpC,MAAM,QAAQ,UAAU,KAAK,KAAK,KAClC,MAAM,KAAK,IAAI,KAAK,GACpB,MAAM,KAAK,IAAI,KAAK;CACpB,OAAO,IAAI,MAAM,MAAM,IAAI,MAAM,MAAM,IAAI,KAAK,MAAM,IAAI,MAAM,MAAM,IAAI,GAAG;AAC9E;AAGA,MAAM,8BAAc,IAAI,QAAQ;AAuBhC,MAAM,EAAC,UAAS,WAAW,WAC3B,EAAC,WAAW,wBAAuB,WAAW,WAC9C,EAAC,cAAc,uBAAsB,QAAQ,WAC7C,EAAC,WAAW,iBAAiB,mBAAmB,2BAA0B,OAAO,WACjF,EAAC,SAAS,iBAAiB,iBAAiB,4BAA2B,UAAU,WACjF,EAAC,iBAAiB,iBAAgB,iBAAiB,WACnD,EAAC,SAAS,kBAAiB,mBAAmB,WAC9C,EAAC,UAAU,YAAW,uBAAuB;;;;;;;;;;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I,IAAI,gBAAkB;EAE1B,MAAM,SAAS,EAAE,cAAc,IAAI,KAAK,EAAE,cAAc,IAAI,KAAK;EACjE,IAAI,SAAS,IAAI,MAAM,EAAE,SAAS,QAAQ,EAAE,SAAS,MAAM;EAC3D,IAAI,EAAE,YAAY,CAAC,EAAE,QAEpB,SAAS,IAAI,MAAM,OAAO,GAAG,CAAC;EAG/B,SAAS,IAAI,cAAc,MAAM;EACjC,IAAI,IAAI,QAAQ,WACf,SAAS,IAAI,aAAa,QAAQ,IAAI,QAAQ,SAAS;EAGxD,IAAI,CAAC,KAAK,UAAU;GACnB,IAAI,MAAM;GACV,KAAK,WAAW;GAChB,IAAI,cAAc,CAAC;GACnB,IAAI,KAAK,WAAW;EACrB;EACA,IAAI,UAAU,OAAO,MAAM,CAAC;EAC5B,IAAI,KAAK,MAAM;EAEf,aAAa,KAAK,SAAS;EAC3B,KAAK,YAAY,WAAW,KAAK,QAAQ,KAAK,IAAI,GAAG,eAAe;CACrE;AAIkE,CAAC"}
1
+ {"version":3,"file":"Map.Rotation.js","names":["DomUtil.create","DomUtil.getPosition","DomUtil.getScale","PointerEvents.getPointers"],"sources":["../../../src/map/Map.Rotation.js"],"sourcesContent":["import {MaplairMap} from './Map.js';\nimport * as DomUtil from '../dom/DomUtil.js';\nimport * as DomEvent from '../dom/DomEvent.js';\nimport * as PointerEvents from '../dom/DomEvent.PointerEvents.js';\nimport {Draggable} from '../dom/Draggable.js';\nimport {Point} from '../geometry/Point.js';\nimport {Bounds} from '../geometry/Bounds.js';\nimport {BlanketOverlay} from '../layer/BlanketOverlay.js';\nimport {GridLayer} from '../layer/tile/GridLayer.js';\nimport {DivOverlay} from '../layer/DivOverlay.js';\nimport {Popup} from '../layer/Popup.js';\nimport {Tooltip} from '../layer/Tooltip.js';\nimport {Marker} from '../layer/marker/Marker.js';\nimport {MarkerDrag} from '../layer/marker/Marker.Drag.js';\nimport {DragHandler} from './handler/DragHandler.js';\nimport {PinchZoomHandler} from './handler/PinchZoomHandler.js';\nimport {ScrollWheelZoomHandler} from './handler/ScrollWheelZoomHandler.js';\nimport {TapDragZoomHandler} from './handler/TapDragZoomHandler.js';\nimport {RotateControl} from '../control/RotateControl.js';\n/** @import {MaplairEvent} from '../core/Events.js' */\n/** @import {LatLng} from '../geo/LatLng.js' */\n/** @import {PointExpression} from '../geometry/Point.js' */\n/** @import {PanOptions, InvalidateSizeOptions} from './Map.js' */\n\nexport {RotateControl};\n\n// The bearing in degrees in the range [0, 360)\nfunction normalizeBearing(bearing) {\n\treturn ((Number(bearing) % 360) + 360) % 360;\n}\n\n// Rotates `point` clockwise (on the screen) by `degrees` around the origin\nfunction rotatePoint(point, degrees) {\n\tconst angle = degrees * Math.PI / 180,\n\tcos = Math.cos(angle),\n\tsin = Math.sin(angle);\n\treturn new Point(point.x * cos - point.y * sin, point.x * sin + point.y * cos);\n}\n\n// The maps of the rotated panes, see `Draggable`\nconst rotatedMaps = new WeakMap();\n\n// Possible size savings: about 60% of the code of this module (about 7–8 kB of\n// its 13 kB minified) are copies of core methods, which are overridden because\n// the rotation changes a computation in their middle:\n// * Popup#_adjustPan, MarkerDrag#_adjustPan, DragHandler#_onDragEnd: the offsets\n// for panBy() in container pixels (about 1.1–1.3 kB each)\n// * PinchZoomHandler#_onPointerMove (1.6 kB) and ScrollWheelZoomHandler#_panBy:\n// the rotation by two fingers, the pinch and pan offsets in the rotated frame\n// * MaplairMap#invalidateSize, #_tryAnimatedPan, #_continuousZoom, #getPixelBounds,\n// GridLayer#_getTiledPixelBounds, BlanketOverlay#_updateTransform, #_onMoveEnd,\n// #_resizeContainer, DivOverlay#_updatePosition, #_setContainerPosition,\n// Popup#_animateZoom: the bounding box of the rotated view, the upright overlays\n// Most of these copies could be replaced by small extension points in the core\n// classes, which this module overrides instead: e.g. MaplairMap#_rotateToPane(offset),\n// #_rotateToContainer(offset) and #_getViewSize() returning the offset or size\n// unchanged, used where the copied methods differ (well below 1 kB in core, for\n// all maps); or by splitting the core methods, so that the computations in\n// question become methods of their own (e.g. the pinch center from the offset of\n// the fingers, the inertia offset, the box of a popup in container pixels).\n// Both would change the pre-existing classes, which this module leaves untouched.\n\n// The methods extended below\nconst {panBy} = MaplairMap.prototype,\n{getEvents: getDivOverlayEvents} = DivOverlay.prototype,\n{_setPosition: setTooltipPosition} = Tooltip.prototype,\n{getEvents: getMarkerEvents, _positionElements: positionMarkerElements} = Marker.prototype,\n{_onDown: onDraggableDown, _updatePosition: updateDraggablePosition} = Draggable.prototype,\n{_onPointerStart: onPinchStart} = PinchZoomHandler.prototype,\n{_onDown: onTapDragDown} = TapDragZoomHandler.prototype,\n{_pinchTo: pinchTo} = ScrollWheelZoomHandler.prototype;\n\n/**\n * Map options of the map rotation (`maplair/map-rotation`).\n * @typedef {object} RotationMapOptions\n * @lends MaplairMapOptions\n * @property {number} [bearing=0] Initial rotation of the map in degrees: the compass\n * direction pointing up, clockwise from north (e.g. `90` for east up), see\n * `setBearing()`.\n * @property {boolean} [pinchRotate=false] Whether the map can be rotated by turning two\n * fingers, see `setBearing()`.\n */\n\nMaplairMap.mergeOptions({\n\tbearing: 0,\n\tpinchRotate: false\n});\n\nMaplairMap.addInitHook(function () {\n\tif (this.options.bearing || this.options.pinchRotate || this.options.rotateControl) {\n\t\tthis._rotate(this.options.bearing);\n\t\tif (this._loaded) {\n\t\t\tthis.fire('moveend');\n\t\t}\n\t}\n});\n\nRotateControl.register(MaplairMap);\n\n/**\n * Methods of `MaplairMap` for the map rotation. The rotation of the map is an optional\n * feature: import this module (`maplair/map-rotation`) to add the `bearing`,\n * `pinchRotate` and `rotateControl` options, `setBearing()`, `getBearing()` and the\n * `rotate` event to `MaplairMap`, and the `RotateControl`. Maps not using it don't\n * contain its code.\n *\n * The map pane is wrapped in a pane rotated around the center of the container.\n * Container/layer point conversions, `getPixelBounds()` and `getBounds()` account\n * for the rotation; grid layers and vector renderers cover the bounding box of\n * the rotated view; markers, popups and tooltips stay upright (see the Marker\n * option `rotateWithView`); dragging, `panBy()`, the keyboard, pinch, tap-drag,\n * touchpad and continuous zoom work in container pixels.\n *\n * @example\n * ```js\n * import {MaplairMap} from 'maplair';\n * import {RotateControl} from 'maplair/map-rotation';\n *\n * const map = new MaplairMap('map', {bearing: 30, pinchRotate: true, rotateControl: true});\n * ```\n *\n * @lends MaplairMap.prototype\n * @fires MaplairMap#rotate {MaplairEvent} Fired when the bearing of the map changes,\n * see `setBearing()`.\n */\nconst mapRotationMethods = {\n\t/**\n\t * Rotates the map around the center of the view, so that the compass direction\n\t * `bearing` (in degrees, clockwise from north) points up. Markers, popups and\n\t * tooltips stay upright. With `{animate: true}`, the map rotates smoothly (the\n\t * shorter way round).\n\t * @group Map rotation\n\t * @param {number} bearing\n\t * @param {{animate?: boolean}} [options]\n\t * @returns {this}\n\t */\n\tsetBearing(bearing, options) {\n\t\tbearing = normalizeBearing(bearing);\n\t\tconst from = this.getBearing();\n\t\tif (!this._rotatePane && !bearing) { return this; }\n\t\tif (bearing === from) { return this; }\n\n\t\tthis._stop();\n\t\tif (!options?.animate || !this._loaded || this._prefersReducedMotion()) {\n\t\t\tthis._rotate(bearing);\n\t\t\treturn this._loaded ? this.fire('movestart').fire('move').fire('moveend') : this;\n\t\t}\n\n\t\t// the shorter way round\n\t\tconst delta = ((bearing - from + 540) % 360) - 180,\n\t\tstart = performance.now(),\n\t\tduration = 250;\n\t\tthis.fire('movestart');\n\t\tconst frame = () => {\n\t\t\tconst t = Math.min(1, (performance.now() - start) / duration);\n\t\t\tthis._rotate(from + delta * (1 - (1 - t) ** 2));\n\t\t\tthis.fire('move');\n\t\t\tif (t < 1) {\n\t\t\t\t// cancelled by `_stop()`\n\t\t\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\t\t} else {\n\t\t\t\tthis.fire('moveend');\n\t\t\t}\n\t\t};\n\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\treturn this;\n\t},\n\n\t// Applies the bearing without the events of a view change (e.g. while pinching)\n\t_rotate(bearing) {\n\t\tbearing = normalizeBearing(bearing);\n\t\tif (!this._rotatePane) {\n\t\t\t// the map pane is wrapped in a pane rotated around the center of the container\n\t\t\tconst rotatePane = this._rotatePane = DomUtil.create('div', 'maplair-rotate-pane');\n\t\t\trotatedMaps.set(rotatePane, this);\n\t\t\tthis._mapPane.before(rotatePane);\n\t\t\trotatePane.append(this._mapPane);\n\t\t}\n\t\tif (bearing === this.getBearing()) { return; }\n\n\t\tthis._bearing = bearing;\n\t\tthis._rotatePane.style.transform = bearing ? `rotate(${-bearing}deg)` : '';\n\n\t\tif (this._loaded) {\n\t\t\tthis.fire('rotate');\n\t\t}\n\t},\n\n\t/**\n\t * Returns the rotation of the map, see `setBearing()`.\n\t * @group Map rotation\n\t * @returns {number}\n\t */\n\tgetBearing() {\n\t\treturn this._bearing ?? 0;\n\t},\n\n\t// Rotates an offset in container (screen) pixels to the frame of the rotated map pane\n\t_rotateToPane(point) {\n\t\treturn this._bearing ? rotatePoint(point, this._bearing) : point;\n\t},\n\n\t// Rotates an offset in the frame of the rotated map pane to container (screen) pixels\n\t_rotateToContainer(point) {\n\t\treturn this._bearing ? rotatePoint(point, -this._bearing) : point;\n\t},\n\n\t// The size of the bounding box of the rotated view, in pixels of the map pane\n\t_getViewSize() {\n\t\tconst size = this.getSize();\n\t\tif (!this._bearing) { return size; }\n\t\tconst angle = this._bearing * Math.PI / 180,\n\t\tcos = Math.abs(Math.cos(angle)),\n\t\tsin = Math.abs(Math.sin(angle));\n\t\treturn new Point(size.x * cos + size.y * sin, size.x * sin + size.y * cos);\n\t},\n\n\t// Counter-rotates `el` (positioned with `DomUtil.setPosition()`) around its CSS\n\t// `transformOrigin`, so that it stays upright on a rotated map.\n\t_rotateUpright(el, transformOrigin) {\n\t\tif (this._bearing) {\n\t\t\tel.style.transform += ` rotate(${this._bearing}deg)`;\n\t\t\tel.style.transformOrigin = transformOrigin;\n\t\t} else if (el.style.transformOrigin) {\n\t\t\tel.style.transformOrigin = '';\n\t\t}\n\t},\n\n\t/**\n\t * Overrides `containerPointToLayerPoint()` of `MaplairMap` (documented there) to\n\t * account for the rotation.\n\t * @internal\n\t * @param {PointExpression} point\n\t * @returns {Point}\n\t */\n\tcontainerPointToLayerPoint(point) { // (Point)\n\t\tpoint = Point.from(point);\n\t\tif (this._bearing) {\n\t\t\t// the map pane is rotated around the center of the container\n\t\t\tconst center = this.getSize()._divideBy(2);\n\t\t\tpoint = this._rotateToPane(point.subtract(center))._add(center);\n\t\t}\n\t\treturn point.subtract(this._getMapPanePos());\n\t},\n\n\t/**\n\t * Overrides `layerPointToContainerPoint()` of `MaplairMap` (documented there) to\n\t * account for the rotation.\n\t * @internal\n\t * @param {PointExpression} point\n\t * @returns {Point}\n\t */\n\tlayerPointToContainerPoint(point) { // (Point)\n\t\tpoint = Point.from(point).add(this._getMapPanePos());\n\t\tif (this._bearing) {\n\t\t\tconst center = this.getSize()._divideBy(2);\n\t\t\tpoint = this._rotateToContainer(point.subtract(center))._add(center);\n\t\t}\n\t\treturn point;\n\t},\n\n\t/**\n\t * Overrides `getPixelBounds()` of `MaplairMap` (documented there): the bounding box\n\t * of the rotated view.\n\t * @internal\n\t * @param {LatLng} [center]\n\t * @param {number} [zoom]\n\t * @returns {Bounds}\n\t */\n\tgetPixelBounds(center, zoom) {\n\t\tconst topLeftPoint = this._getTopLeftPoint(center, zoom);\n\t\tif (!this._bearing) {\n\t\t\treturn new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\n\t\t}\n\t\t// the bounding box of the rotated view\n\t\tconst pixelCenter = topLeftPoint.add(this.getSize()._divideBy(2)),\n\t\thalf = this._getViewSize()._divideBy(2);\n\t\treturn new Bounds(pixelCenter.subtract(half), pixelCenter.add(half));\n\t},\n\n\t/**\n\t * Overrides `panBy()` of `MaplairMap` (documented there): `panBy()` takes offsets in\n\t * container pixels, the map pane moves in its rotated frame.\n\t * @internal\n\t * @param {PointExpression} offset\n\t * @param {PanOptions} [options]\n\t * @returns {this}\n\t */\n\tpanBy(offset, options) {\n\t\treturn panBy.call(this, this._rotateToPane(Point.from(offset)), options);\n\t},\n\n\t_tryAnimatedPan(center, options) {\n\t\t// difference between the new and current centers in pixels\n\t\t// difference in the frame of the map pane, which `_panBy()` moves\n\t\tconst offset = this.latLngToLayerPoint(center)._subtract(this._getCenterLayerPoint())._round();\n\n\t\t// don't animate too far unless animate: true specified in options\n\t\tif (options?.animate !== true && !this.getSize().contains(this._rotateToContainer(offset))) { return false; }\n\n\t\tthis._panBy(offset, options);\n\n\t\treturn true;\n\t},\n\n\t/**\n\t * Overrides `invalidateSize()` of `MaplairMap` (documented there) to pan in container\n\t * pixels.\n\t * @internal\n\t * @param {boolean|InvalidateSizeOptions} [options]\n\t * @returns {this}\n\t */\n\tinvalidateSize(options) {\n\t\tif (!this._loaded) { return this; }\n\n\t\toptions = {\n\t\t\tanimate: false,\n\t\t\tpan: true,\n\t\t\t...(options === true ? {animate: true} : options)\n\t\t};\n\n\t\tconst oldSize = this.getSize();\n\t\tthis._sizeChanged = true;\n\t\tthis._lastCenter = null;\n\n\t\tconst newSize = this.getSize(),\n\t\toldCenter = oldSize.divideBy(2).round(),\n\t\tnewCenter = newSize.divideBy(2).round(),\n\t\toffset = oldCenter.subtract(newCenter);\n\n\t\tif (!offset.x && !offset.y) { return this; }\n\n\t\tif (options.animate && options.pan) {\n\t\t\tthis.panBy(this._rotateToContainer(offset));\n\n\t\t} else {\n\t\t\tif (options.pan) {\n\t\t\t\tthis._rawPanBy(offset);\n\t\t\t}\n\n\t\t\tthis.fire('move');\n\n\t\t\tif (options.debounceMoveend) {\n\t\t\t\tclearTimeout(this._sizeTimer);\n\t\t\t\tthis._sizeTimer = setTimeout(this.fire.bind(this, 'moveend'), 200);\n\t\t\t} else {\n\t\t\t\tthis.fire('moveend');\n\t\t\t}\n\t\t}\n\n\t\treturn this.fire('resize', {\n\t\t\toldSize,\n\t\t\tnewSize\n\t\t});\n\t},\n\n\t// Zooms to `center` and `zoom` frame by frame around the zoom origin at `offset`\n\t// from the center (as the CSS zoom animation does), see the `continuousZoom` option.\n\t_continuousZoom(center, zoom, offset, options) {\n\t\tconst startZoom = this._zoom,\n\t\toriginOffset = offset.multiplyBy(-1),\n\t\torigin = this.layerPointToLatLng(this._getCenterLayerPoint().add(offset)),\n\t\tstart = performance.now(),\n\t\tduration = 250;\n\n\t\tthis._moveStart(true, options.noMoveStart ?? false);\n\n\t\tconst frame = () => {\n\t\t\tconst t = Math.min(1, (performance.now() - start) / duration);\n\t\t\tif (t < 1) {\n\t\t\t\t// ease out, like the CSS zoom transition\n\t\t\t\tconst z = startZoom + (zoom - startZoom) * (1 - (1 - t) ** 2);\n\t\t\t\tthis._move(this.unproject(this.project(origin, z).add(originOffset), z), z, {continuous: true});\n\t\t\t\t// cancelled by `_stop()`\n\t\t\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t\t\t} else {\n\t\t\t\tthis._move(center, zoom)._moveEnd(true);\n\t\t\t}\n\t\t};\n\t\tthis._flyToFrame = requestAnimationFrame(frame);\n\t}\n};\n/** @typedef {typeof mapRotationMethods} MapRotationMethods */\n\nMaplairMap.include(mapRotationMethods);\n\n/**\n * Methods of `GridLayer` for the map rotation: the tiles cover the bounding box of the\n * rotated view.\n * @lends GridLayer.prototype\n */\nconst gridLayerRotationMethods = {\n\t_getTiledPixelBounds(center) {\n\t\tconst map = this._map,\n\t\tmapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),\n\t\tscale = map.getZoomScale(mapZoom, this._tileZoom),\n\t\tpixelCenter = map.project(center, this._tileZoom).floor(),\n\t\thalfSize = map._getViewSize().divideBy(scale * 2);\n\n\t\treturn new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));\n\t}\n};\n/** @typedef {typeof gridLayerRotationMethods} GridLayerMapRotationMethods */\n\nGridLayer.include(gridLayerRotationMethods);\n\n/**\n * Methods of `BlanketOverlay` for the map rotation: the overlay covers the bounding\n * box of the rotated view.\n * @lends BlanketOverlay.prototype\n */\nconst blanketOverlayRotationMethods = {\n\t_updateTransform(center, zoom) {\n\t\tconst scale = this._map.getZoomScale(zoom, this._zoom),\n\t\tviewHalf = this._map._getViewSize().multiplyBy(0.5 + this.options.padding),\n\t\tcurrentCenterPoint = this._map.project(this._center, zoom),\n\t\ttopLeftOffset = viewHalf.multiplyBy(-scale)._add(currentCenterPoint)\n\t\t\t._subtract(this._map._getNewPixelOrigin(center, zoom));\n\n\t\t// a scaled container is resampled anyway, and rounding where its corner lands would make its content away\n\t\t// from the corner jitter against the zoom motion\n\t\tif (scale === 1) { this._map._snapLayerPoint(topLeftOffset); }\n\n\t\tDomUtil.setTransform(this._container, topLeftOffset, scale);\n\t},\n\n\t_onMoveEnd(ev) {\n\t\t// Update pixel bounds of renderer container (for positioning/sizing/clipping later)\n\t\t// the bounding box of the (possibly rotated) view, extended by the padding\n\t\tconst p = this.options.padding,\n\t\tsize = this._map._getViewSize();\n\t\tif (!size.multiplyBy(1 + p * 2).round().equals(this._containerSize)) {\n\t\t\t// e.g. after rotating the map\n\t\t\tthis._resizeContainer();\n\t\t}\n\t\tconst min = this._map._getCenterLayerPoint().subtract(size.multiplyBy(0.5 + p)).round();\n\n\t\tthis._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());\n\n\t\tthis._center = this._map.getCenter();\n\t\tthis._zoom = this._map.getZoom();\n\t\tthis._updateTransform(this._center, this._zoom);\n\n\t\tthis._onSettled(ev);\n\t},\n\n\t_resizeContainer() {\n\t\tconst p = this.options.padding,\n\t\tsize = this._containerSize = this._map._getViewSize().multiplyBy(1 + p * 2).round();\n\t\tthis._container.style.width = `${size.x}px`;\n\t\tthis._container.style.height = `${size.y}px`;\n\t\treturn size;\n\t}\n};\n/** @typedef {typeof blanketOverlayRotationMethods} BlanketOverlayMapRotationMethods */\n\nBlanketOverlay.include(blanketOverlayRotationMethods);\n\n/**\n * Methods of `DivOverlay` for the map rotation: the overlays stay upright.\n * @lends DivOverlay.prototype\n */\nconst divOverlayRotationMethods = {\n\t/**\n\t * Overrides `getEvents()` of `DivOverlay` to update the position on rotation.\n\t * @internal\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\treturn {...getDivOverlayEvents.call(this), rotate: this._updatePosition};\n\t},\n\n\t_updatePosition() {\n\t\tif (!this._map) { return; }\n\n\t\tconst map = this._map,\n\t\tpos = map._snapLayerPoint(map.latLngToLayerPoint(this._latlng)),\n\t\t// on a rotated map, the anchor is relative to the upright overlay\n\t\tanchor = map._rotateToPane(new Point(this._getAnchor()));\n\t\tlet offset = Point.from(this.options.offset);\n\n\t\tconst transformed = this._zoomAnimated || this.options.overflow || map._bearing;\n\t\tif (!transformed) {\n\t\t\toffset = offset.add(pos).add(anchor);\n\t\t}\n\n\t\tconst bottom = this._containerBottom = -offset.y,\n\t\tleft = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;\n\n\t\t// bottom position the overlay in case the height of the overlay changes (images loading etc)\n\t\tif (this.options.overflow) {\n\t\t\t// relative to the top of the viewport instead of the pane origin\n\t\t\tthis._container.style.top = 'auto';\n\t\t\tthis._container.style.bottom = `calc(100% + ${bottom}px)`;\n\t\t} else {\n\t\t\tthis._container.style.bottom = `${bottom}px`;\n\t\t}\n\t\tthis._container.style.left = `${left}px`;\n\n\t\tif (transformed) {\n\t\t\t// upright around the anchored point (below the bottom margin, see `Popup`)\n\t\t\tthis._setContainerPosition(pos.add(anchor), `${-left}px calc(100% + ${bottom + (this._containerMarginBottom ?? 0)}px)`);\n\t\t}\n\t},\n\n\t// Positions the container at the given layer point. An overflowing overlay\n\t// lives in the top layer of the page, so it is positioned in viewport coordinates.\n\t// `transformOrigin` is the point around which the container is kept upright on a rotated map.\n\t_setContainerPosition(pos, transformOrigin) {\n\t\tthis._containerPos = pos;\n\t\tif (this.options.overflow) {\n\t\t\tconst mapContainer = this._map._container,\n\t\t\trect = mapContainer.getBoundingClientRect();\n\t\t\tpos = this._map.layerPointToContainerPoint(pos)\n\t\t\t\t._add(new Point(rect.left + mapContainer.clientLeft, rect.top + mapContainer.clientTop));\n\t\t}\n\t\tDomUtil.setPosition(this._container, pos);\n\t\tif (!this.options.overflow) {\n\t\t\tthis._map._rotateUpright(this._container, transformOrigin);\n\t\t}\n\t}\n};\n/** @typedef {typeof divOverlayRotationMethods} DivOverlayMapRotationMethods */\n\nDivOverlay.include(divOverlayRotationMethods);\n\n/**\n * Methods of `Popup` for the map rotation: the popup stays upright, autopanning in\n * container pixels.\n * @lends Popup.prototype\n */\nconst popupRotationMethods = {\n\t_animateZoom(e) {\n\t\tconst pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),\n\t\tanchor = this._map._rotateToPane(new Point(this._getAnchor()));\n\t\tthis._setContainerPosition(pos.add(anchor), this._container.style.transformOrigin);\n\t},\n\n\t_adjustPan() {\n\t\tif (!this.options.autoPan) { return; }\n\t\tthis._map._panAnim?.stop();\n\n\t\t// We can endlessly recurse if keepInView is set and the view resets.\n\t\t// Let's guard against that by exiting early if we're responding to our own autopan.\n\t\tif (this._autopanning) {\n\t\t\tthis._autopanning = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst map = this._map,\n\t\tmarginBottom = this._containerMarginBottom ?? (parseInt(getComputedStyle(this._container).marginBottom, 10) || 0),\n\t\tcontainerHeight = this._containerHeight + marginBottom,\n\t\tcontainerWidth = this._containerWidth,\n\t\t// the top left corner, relative to the (upright) anchored point\n\t\ttopLeft = new Point(this._containerLeft, -containerHeight - this._containerBottom);\n\n\t\tconst containerPos = map.layerPointToContainerPoint(this._getContainerPosition())._add(topLeft),\n\t\tpadding = Point.from(this.options.autoPanPadding),\n\t\tpaddingTL = Point.from(this.options.autoPanPaddingTopLeft ?? padding),\n\t\tpaddingBR = Point.from(this.options.autoPanPaddingBottomRight ?? padding),\n\t\tsize = map.getSize();\n\t\tlet dx = 0,\n\t\tdy = 0;\n\n\t\tif (containerPos.x + containerWidth + paddingBR.x > size.x) { // right\n\t\t\tdx = containerPos.x + containerWidth - size.x + paddingBR.x;\n\t\t}\n\t\tif (containerPos.x - dx - paddingTL.x < 0) { // left\n\t\t\tdx = containerPos.x - paddingTL.x;\n\t\t}\n\t\tif (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom\n\t\t\tdy = containerPos.y + containerHeight - size.y + paddingBR.y;\n\t\t}\n\t\tif (containerPos.y - dy - paddingTL.y < 0) { // top\n\t\t\tdy = containerPos.y - paddingTL.y;\n\t\t}\n\n\t\t// see the `autopanstart` event of `Popup`\n\t\tif (dx || dy) {\n\t\t\t// Track that we're autopanning, as this function will be re-ran on moveend\n\t\t\tif (this.options.keepInView) {\n\t\t\t\tthis._autopanning = true;\n\t\t\t}\n\n\t\t\tmap\n\t\t\t\t.fire('autopanstart')\n\t\t\t\t.panBy([dx, dy]);\n\t\t}\n\t}\n};\n/** @typedef {typeof popupRotationMethods} PopupMapRotationMethods */\n\nPopup.include(popupRotationMethods);\n\n// The margins of the directions, see `.maplair-tooltip-top` etc. in maplair.css\nconst tooltipMargins = {\n\ttop: [0, -6],\n\tbottom: [0, 6],\n\tleft: [-6, 0],\n\tright: [6, 0]\n};\n\n/**\n * Methods of `Tooltip` for the map rotation: the tooltip stays upright.\n * @lends Tooltip.prototype\n */\nconst tooltipRotationMethods = {\n\t// On a rotated map, the tooltip is positioned at its source and kept upright\n\t// around it (taking the margin of the direction into account)\n\t_setPosition(pos) {\n\t\tsetTooltipPosition.call(this, pos);\n\t\tconst container = this._container;\n\t\tif (this.options.overflow) { return; }\n\t\tif (!this._map._bearing) {\n\t\t\tcontainer.style.left = container.style.top = '';\n\t\t\treturn;\n\t\t}\n\t\tconst delta = this._containerPos.subtract(pos),\n\t\tdirection = Object.keys(tooltipMargins).find(d => container.classList.contains(`maplair-tooltip-${d}`)),\n\t\tmargin = tooltipMargins[direction] ?? [0, 0];\n\t\tcontainer.style.left = `${delta.x}px`;\n\t\tcontainer.style.top = `${delta.y}px`;\n\t\tthis._setContainerPosition(pos, `${-delta.x - margin[0]}px ${-delta.y - margin[1]}px`);\n\t}\n};\n/** @typedef {typeof tooltipRotationMethods} TooltipMapRotationMethods */\n\nTooltip.include(tooltipRotationMethods);\n\n/**\n * Options of `Marker` for the map rotation.\n * @typedef {object} MarkerMapRotationOptions\n * @lends MarkerOptions\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. The `rotation` of\n * the marker is relative to the screen, or to north with `rotateWithView`.\n */\nMarker.include({\n\toptions: {\n\t\trotateWithView: false\n\t}\n});\n\n/**\n * Methods of `Marker` for the map rotation: the marker is updated on rotation, and\n * its icon and shadow stay upright.\n * @lends Marker.prototype\n */\nconst markerRotationMethods = {\n\t/**\n\t * Overrides `getEvents()` of `Marker` to update the marker on rotation.\n\t * @internal\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\treturn {...getMarkerEvents.call(this), rotate: this.update};\n\t},\n\n\t_positionElements(pos) {\n\t\tpositionMarkerElements.call(this, pos);\n\t\tconst bearing = this.options.rotateWithView ? 0 : (this._map?.getBearing() ?? 0);\n\t\tif (!bearing) { return; }\n\t\tfor (const el of [this._icon, this._shadow]) {\n\t\t\tif (el) { el.style.transform += ` rotate(${bearing}deg)`; }\n\t\t}\n\t}\n};\n/** @typedef {typeof markerRotationMethods} MarkerMapRotationMethods */\n\nMarker.include(markerRotationMethods);\n\n/**\n * Methods of `MarkerDrag` for the map rotation: autopanning in container pixels.\n * @lends MarkerDrag.prototype\n */\nconst markerDragRotationMethods = {\n\t_adjustPan(e) {\n\t\tconst marker = this._marker,\n\t\tmap = marker._map,\n\t\tspeed = this._marker.options.autoPanSpeed,\n\t\tpadding = this._marker.options.autoPanPadding,\n\t\ticonPos = DomUtil.getPosition(marker._icon),\n\t\tbounds = map.getPixelBounds(),\n\t\torigin = map.getPixelOrigin();\n\n\t\tconst panBounds = new Bounds(\n\t\t\tbounds.min._subtract(origin).add(padding),\n\t\t\tbounds.max._subtract(origin).subtract(padding)\n\t\t);\n\n\t\tif (!panBounds.contains(iconPos)) {\n\t\t\t// Compute incremental movement\n\t\t\tconst movement = new Point(\n\t\t\t\t(Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) -\n\t\t\t\t\t(Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x),\n\n\t\t\t\t(Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) -\n\t\t\t\t\t(Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)\n\t\t\t).multiplyBy(speed);\n\n\t\t\tmap.panBy(map._rotateToContainer(movement), {animate: false});\n\n\t\t\tthis._draggable._newPos._add(movement);\n\t\t\tthis._draggable._startPos._add(movement);\n\n\t\t\tDomUtil.setPosition(marker._icon, this._draggable._newPos);\n\t\t\tthis._onDrag(e);\n\n\t\t\tthis._panRequest = requestAnimationFrame(this._adjustPan.bind(this, e));\n\t\t}\n\t}\n};\n/** @typedef {typeof markerDragRotationMethods} MarkerDragMapRotationMethods */\n\nMarkerDrag.include(markerDragRotationMethods);\n\n/**\n * Methods of `Draggable` for the map rotation: dragging in the rotated frame of the\n * map pane.\n * @lends Draggable.prototype\n */\nconst draggableRotationMethods = {\n\t_onDown(e) {\n\t\tonDraggableDown.call(this, e);\n\t\t// on a rotated map, the element moves in the rotated frame of the map pane,\n\t\t// and the rotated pane is scaled by its bounding box (see `DomUtil.getScale()`)\n\t\tconst rotatePane = this._element.closest?.('.maplair-rotate-pane');\n\t\tthis._rotatedMap = rotatePane && rotatedMaps.get(rotatePane);\n\t\tif (this._rotatedMap && this._parentScale) {\n\t\t\tthis._parentScale = DomUtil.getScale(rotatePane.parentNode);\n\t\t}\n\t},\n\n\t_updatePosition() {\n\t\tconst map = this._rotatedMap;\n\t\tif (map?._bearing) {\n\t\t\tthis._newPos = this._startPos.add(map._rotateToPane(this._newPos.subtract(this._startPos)));\n\t\t}\n\t\tupdateDraggablePosition.call(this);\n\t}\n};\n/** @typedef {typeof draggableRotationMethods} DraggableMapRotationMethods */\n\nDraggable.include(draggableRotationMethods);\n\n/**\n * Methods of `DragHandler` for the map rotation: the inertia in container pixels.\n * @lends DragHandler.prototype\n */\nconst dragHandlerRotationMethods = {\n\t_onDragEnd(e) {\n\t\tconst map = this._map,\n\t\toptions = map.options,\n\n\t\tnoInertia = !options.inertia || e.noInertia || this._times.length < 2;\n\n\t\tmap.fire('dragend', e);\n\n\t\tif (noInertia) {\n\t\t\tmap.fire('moveend');\n\n\t\t} else {\n\t\t\tthis._prunePositions(Date.now());\n\n\t\t\tconst direction = this._lastPos.subtract(this._positions[0]),\n\t\t\tduration = (this._lastTime - this._times[0]) / 1000,\n\t\t\tease = options.easeLinearity,\n\n\t\t\tspeedVector = direction.multiplyBy(ease / duration),\n\t\t\tspeed = speedVector.distanceTo([0, 0]),\n\n\t\t\tlimitedSpeed = Math.min(options.inertiaMaxSpeed, speed),\n\t\t\tlimitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),\n\n\t\t\tmaxOffset = map.getSize().divideBy(2);\n\n\t\t\tlet decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),\n\t\t\toffset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();\n\n\t\t\t// with reduced motion, shorten the coast to fit within half the map size, see DragHandler\n\t\t\tif (map._prefersReducedMotion() && !maxOffset.contains(offset)) {\n\t\t\t\tconst k = Math.min(maxOffset.x / Math.abs(offset.x), maxOffset.y / Math.abs(offset.y));\n\t\t\t\toffset = offset.multiplyBy(k).round();\n\t\t\t\tdecelerationDuration *= Math.sqrt(k);\n\t\t\t}\n\n\t\t\tif (!offset.x && !offset.y) {\n\t\t\t\tmap.fire('moveend');\n\n\t\t\t} else {\n\t\t\t\toffset = map._limitOffset(offset, map.options.maxBounds);\n\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t// the offset of the map pane, `panBy()` takes container pixels\n\t\t\t\t\tmap.panBy(map._rotateToContainer(offset), {\n\t\t\t\t\t\tduration: decelerationDuration,\n\t\t\t\t\t\teaseLinearity: ease,\n\t\t\t\t\t\tnoMoveStart: true,\n\t\t\t\t\t\tanimate: true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n};\n/** @typedef {typeof dragHandlerRotationMethods} DragHandlerMapRotationMethods */\n\nDragHandler.include(dragHandlerRotationMethods);\n\n// The time (ms) without further wheel events after which a touchpad pan ends, see `ScrollWheelZoomHandler`\nconst gestureEndDelay = 150;\n\n// The angle (degrees) the fingers have to turn before the map starts rotating\nconst rotateThreshold = 15;\n\nfunction angleOf(p1, p2) {\n\treturn Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;\n}\n\n/**\n * Methods of `PinchZoomHandler` for the map rotation: rotating by turning two fingers\n * (see the map option `pinchRotate`), pinching in the rotated frame.\n * @lends PinchZoomHandler.prototype\n */\nconst pinchZoomHandlerRotationMethods = {\n\t_onPointerStart(e) {\n\t\tonPinchStart.call(this, e);\n\t\tconst pointers = PointerEvents.getPointers();\n\t\tif (this._zooming && pointers.length === 2) {\n\t\t\tthis._startAngle = angleOf(...pointers.map(p => this._map.pointerEventToContainerPoint(p)));\n\t\t\tthis._startBearing = this._map.getBearing();\n\t\t\tthis._rotating = false;\n\t\t}\n\t},\n\n\t_onPointerMove(e) {\n\t\tconst pointers = PointerEvents.getPointers();\n\t\tif (pointers.length !== 2 || !this._zooming) { return; }\n\n\t\tconst map = this._map,\n\t\tp1 = map.pointerEventToContainerPoint(pointers[0]),\n\t\tp2 = map.pointerEventToContainerPoint(pointers[1]),\n\t\tscale = p1.distanceTo(p2) / this._startDist;\n\n\t\tthis._zoom = map.getScaleZoom(scale, this._startZoom);\n\n\t\tif (map.options.pinchRotate) {\n\t\t\tconst angle = angleOf(p1, p2);\n\t\t\tlet delta = ((angle - this._startAngle + 540) % 360) - 180;\n\t\t\tif (!this._rotating && Math.abs(delta) > rotateThreshold) {\n\t\t\t\t// start rotating from the threshold on, without a jump\n\t\t\t\tthis._rotating = true;\n\t\t\t\tthis._startAngle += Math.sign(delta) * rotateThreshold;\n\t\t\t\tdelta -= Math.sign(delta) * rotateThreshold;\n\t\t\t}\n\t\t\tif (this._rotating) {\n\t\t\t\t// turning the fingers clockwise turns the map clockwise\n\t\t\t\tmap._rotate(this._startBearing - delta);\n\t\t\t}\n\t\t}\n\n\t\tif (!map.options.bounceAtZoomLimits && (\n\t\t\t(this._zoom < map.getMinZoom() && scale < 1) ||\n\t\t\t\t(this._zoom > map.getMaxZoom() && scale > 1))) {\n\t\t\tthis._zoom = map._limitZoom(this._zoom);\n\t\t}\n\n\t\tif (map.options.pinchZoom === 'center') {\n\t\t\tthis._center = this._startLatLng;\n\t\t\tif (scale === 1 && !this._rotating) { return; }\n\t\t} else {\n\t\t\t// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng\n\t\t\tconst delta = map._rotateToPane(p1._add(p2)._divideBy(2)._subtract(this._centerPoint));\n\t\t\tif (scale === 1 && delta.x === 0 && delta.y === 0 && !this._rotating) { return; }\n\t\t\tthis._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);\n\t\t}\n\n\t\tif (!this._moved) {\n\t\t\tmap._setUserEvent(e);\n\t\t\tmap._moveStart(true, false);\n\t\t\tthis._moved = true;\n\t\t}\n\n\t\tcancelAnimationFrame(this._animRequest);\n\n\t\tconst moveFn = map._move.bind(map, this._center, this._zoom, {pinch: true}, undefined);\n\t\tthis._animRequest = requestAnimationFrame(moveFn.bind(this));\n\n\t\te.preventDefault();\n\t}\n};\n/** @typedef {typeof pinchZoomHandlerRotationMethods} PinchZoomHandlerMapRotationMethods */\n\nPinchZoomHandler.include(pinchZoomHandlerRotationMethods);\n\n/**\n * Methods of `TapDragZoomHandler` for the map rotation: the zoom origin in the rotated\n * frame.\n * @lends TapDragZoomHandler.prototype\n */\nconst tapDragZoomHandlerRotationMethods = {\n\t_onDown(e) {\n\t\tonTapDragDown.call(this, e);\n\t\t// the offset of the zoom origin in the rotated frame of the map pane\n\t\tif (this._zooming && this._aroundOffset) {\n\t\t\tthis._aroundOffset = this._map._rotateToPane(this._aroundOffset);\n\t\t}\n\t}\n};\n/** @typedef {typeof tapDragZoomHandlerRotationMethods} TapDragZoomHandlerMapRotationMethods */\n\nTapDragZoomHandler.include(tapDragZoomHandlerRotationMethods);\n\n/**\n * Methods of `ScrollWheelZoomHandler` for the map rotation: zooming and panning in the\n * rotated frame.\n * @lends ScrollWheelZoomHandler.prototype\n */\nconst scrollWheelZoomHandlerRotationMethods = {\n\t_pinchTo(e, zoom, eased) {\n\t\tpinchTo.call(this, e, zoom, eased);\n\t\t// the offset of the zoom origin in the rotated frame of the map pane\n\t\tif (this._pinch && !this._pinch.rotated) {\n\t\t\tthis._pinch.offset = this._map._rotateToPane(this._pinch.offset);\n\t\t\tthis._pinch.rotated = true;\n\t\t}\n\t},\n\n\t// Pans the map by the wheel deltas, as by scrolling with two fingers on a touchpad.\n\t_panBy(e) {\n\t\tDomEvent.stop(e);\n\t\tconst map = this._map;\n\t\tif (map._animatingZoom) { return; }\n\n\t\tconst factor = e.deltaMode === 1 ? 20 : e.deltaMode === 2 ? 60 : 1;\n\t\tlet offset = new Point(e.deltaX * factor, e.deltaY * factor);\n\t\tif (e.shiftKey && !e.deltaX) {\n\t\t\t// Shift with a mouse wheel scrolls horizontally\n\t\t\toffset = new Point(offset.y, 0);\n\t\t}\n\t\t// in the rotated frame of the map pane\n\t\toffset = map._rotateToPane(offset);\n\t\tif (map.options.maxBounds) {\n\t\t\toffset = map._limitOffset(offset, map.options.maxBounds);\n\t\t}\n\n\t\tif (!this._panning) {\n\t\t\tmap._stop();\n\t\t\tthis._panning = true;\n\t\t\tmap._setUserEvent(e);\n\t\t\tmap.fire('movestart');\n\t\t}\n\t\tmap._rawPanBy(offset.round());\n\t\tmap.fire('move');\n\n\t\tclearTimeout(this._panTimer);\n\t\tthis._panTimer = setTimeout(this._endPan.bind(this), gestureEndDelay);\n\t}\n};\n/** @typedef {typeof scrollWheelZoomHandlerRotationMethods} ScrollWheelZoomHandlerMapRotationMethods */\n\nScrollWheelZoomHandler.include(scrollWheelZoomHandlerRotationMethods);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,iBAAiB,SAAS;CAClC,QAAS,OAAO,OAAO,IAAI,MAAO,OAAO;AAC1C;AAGA,SAAS,YAAY,OAAO,SAAS;CACpC,MAAM,QAAQ,UAAU,KAAK,KAAK,KAClC,MAAM,KAAK,IAAI,KAAK,GACpB,MAAM,KAAK,IAAI,KAAK;CACpB,OAAO,IAAI,MAAM,MAAM,IAAI,MAAM,MAAM,IAAI,KAAK,MAAM,IAAI,MAAM,MAAM,IAAI,GAAG;AAC9E;AAGA,MAAM,8BAAc,IAAI,QAAQ;AAuBhC,MAAM,EAAC,UAAS,WAAW,WAC3B,EAAC,WAAW,wBAAuB,WAAW,WAC9C,EAAC,cAAc,uBAAsB,QAAQ,WAC7C,EAAC,WAAW,iBAAiB,mBAAmB,2BAA0B,OAAO,WACjF,EAAC,SAAS,iBAAiB,iBAAiB,4BAA2B,UAAU,WACjF,EAAC,iBAAiB,iBAAgB,iBAAiB,WACnD,EAAC,SAAS,kBAAiB,mBAAmB,WAC9C,EAAC,UAAU,YAAW,uBAAuB;;;;;;;;;;;AAa7C,WAAW,aAAa;CACvB,SAAS;CACT,aAAa;AACd,CAAC;AAED,WAAW,YAAY,WAAY;CAClC,IAAI,KAAK,QAAQ,WAAW,KAAK,QAAQ,eAAe,KAAK,QAAQ,eAAe;EACnF,KAAK,QAAQ,KAAK,QAAQ,OAAO;EACjC,IAAI,KAAK,SACR,KAAK,KAAK,SAAS;CAErB;AACD,CAAC;AAED,cAAc,SAAS,UAAU;;AA+RjC,WAAW,QAAQ;;;;;;;;;;;CAxPlB,WAAW,SAAS,SAAS;EAC5B,UAAU,iBAAiB,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,QAAQ,IAAI,QAAQ,SAAS;EAGxD,IAAI,CAAC,KAAK,UAAU;GACnB,IAAI,MAAM;GACV,KAAK,WAAW;GAChB,IAAI,cAAc,CAAC;GACnB,IAAI,KAAK,WAAW;EACrB;EACA,IAAI,UAAU,OAAO,MAAM,CAAC;EAC5B,IAAI,KAAK,MAAM;EAEf,aAAa,KAAK,SAAS;EAC3B,KAAK,YAAY,WAAW,KAAK,QAAQ,KAAK,IAAI,GAAG,eAAe;CACrE;AAIkE,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { setOptions, stamp } from "../core/Util.js";
2
2
  import { Point } from "../geometry/Point.js";
3
- import { disablePointerDetection, enablePointerDetection, simulateDblclick } from "../dom/DomEvent.PointerEvents.js";
3
+ import { disablePointerDetection, enablePointerDetection, isClickDisabled, simulateDblclick } from "../dom/DomEvent.PointerEvents.js";
4
4
  import { getPointerPosition, isExternalTarget, off, on } from "../dom/DomEvent.js";
5
- import { create, get, getPosition, setPosition, setTransform } from "../dom/DomUtil.js";
5
+ import { create, get, getPosition, getScale, setPosition, setTransform } from "../dom/DomUtil.js";
6
6
  import { Control } from "../control/Control.js";
7
7
  import { I18n } from "../core/I18n.js";
8
8
  import { AttributionControl } from "../control/AttributionControl.js";
@@ -542,6 +542,7 @@ var MaplairMap = class MaplairMap extends Evented {
542
542
  center: requestedCenter,
543
543
  zoom: targetZoom
544
544
  };
545
+ this._subpixelOrigin = true;
545
546
  const from = this.project(this.getCenter()), to = this.project(targetCenter), size = this.getSize(), startZoom = this._zoom;
546
547
  const w0 = Math.max(size.x, size.y), w1 = w0 * this.getZoomScale(startZoom, targetZoom), u1 = to.distanceTo(from) || 1, rho = 1.42, rho2 = rho * rho;
547
548
  function r(i) {
@@ -563,6 +564,7 @@ var MaplairMap = class MaplairMap extends Evented {
563
564
  this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), this.getScaleZoom(Math.cosh(r0 + rho * s) / Math.cosh(r0), startZoom), { flyTo: true });
564
565
  } else {
565
566
  const zoomChanged = this._zoom !== targetZoom;
567
+ this._subpixelOrigin = false;
566
568
  this._move(targetCenter, targetZoom);
567
569
  if (!zoomChanged) this.fire("zoom");
568
570
  this._moveEnd(true);
@@ -647,7 +649,7 @@ var MaplairMap = class MaplairMap extends Evented {
647
649
  this.options.minZoom = zoom;
648
650
  if (this._loaded && oldZoom !== zoom) {
649
651
  this.fire("zoomlevelschange");
650
- if (this.getZoom() < this.options.minZoom) return this.setZoom(zoom);
652
+ if (this._targetZoom() < this.options.minZoom) return this.setZoom(zoom);
651
653
  }
652
654
  return this;
653
655
  }
@@ -662,7 +664,7 @@ var MaplairMap = class MaplairMap extends Evented {
662
664
  this.options.maxZoom = zoom;
663
665
  if (this._loaded && oldZoom !== zoom) {
664
666
  this.fire("zoomlevelschange");
665
- if (this.getZoom() > this.options.maxZoom) return this.setZoom(zoom);
667
+ if (this._targetZoom() > this.options.maxZoom) return this.setZoom(zoom);
666
668
  }
667
669
  return this;
668
670
  }
@@ -942,7 +944,12 @@ var MaplairMap = class MaplairMap extends Evented {
942
944
  bounds = LatLngBounds.from(bounds);
943
945
  padding = Point.from(padding ?? [0, 0]);
944
946
  let zoom = this.getZoom() ?? 0;
945
- const min = this.getMinZoom(), max = this.getMaxZoom(), nw = bounds.getNorthWest(), se = bounds.getSouthEast(), size = this.getSize().subtract(padding), boundsSize = new Bounds(this.project(se, zoom), this.project(nw, zoom)).getSize(), snap = this.options.zoomSnap, scalex = Math.max(size.x, 0) / boundsSize.x, scaley = Math.max(size.y, 0) / boundsSize.y, scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
947
+ const min = this.getMinZoom(), max = this.getMaxZoom(), size = this.getSize().subtract(padding), corners = [
948
+ bounds.getNorthWest(),
949
+ bounds.getNorthEast(),
950
+ bounds.getSouthEast(),
951
+ bounds.getSouthWest()
952
+ ], boundsSize = new Bounds(corners.map((c) => this.project(c, zoom))).getSize(), snap = this.options.zoomSnap, scalex = Math.max(size.x, 0) / boundsSize.x, scaley = Math.max(size.y, 0) / boundsSize.y, scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
946
953
  zoom = this.getScaleZoom(scale, zoom);
947
954
  if (snap) {
948
955
  zoom = Math.round(zoom / (snap / 100)) * (snap / 100);
@@ -1181,7 +1188,18 @@ var MaplairMap = class MaplairMap extends Evented {
1181
1188
  * @returns {Point}
1182
1189
  */
1183
1190
  pointerEventToContainerPoint(e) {
1184
- return getPointerPosition(e, this._container);
1191
+ if (!this._animatingZoom) return getPointerPosition(e, this._container);
1192
+ if (!this._containerRect) {
1193
+ const el = this._container, { x, y, boundingClientRect: r } = getScale(el);
1194
+ this._containerRect = {
1195
+ x,
1196
+ y,
1197
+ left: r.left + el.clientLeft * x,
1198
+ top: r.top + el.clientTop * y
1199
+ };
1200
+ }
1201
+ const c = this._containerRect;
1202
+ return new Point((e.clientX - c.left) / c.x, (e.clientY - c.top) / c.y);
1185
1203
  }
1186
1204
  /**
1187
1205
  * Given a PointerEvent object, returns the pixel coordinate relative to
@@ -1346,7 +1364,7 @@ var MaplairMap = class MaplairMap extends Evented {
1346
1364
  this._lastCenterPanePos = this._getMapPanePos();
1347
1365
  this._pixelOrigin = this._getNewPixelOrigin(center);
1348
1366
  if (!suppressEvent) {
1349
- if (zoomChanged || data?.pinch) this.fire("zoom", data);
1367
+ if (zoomChanged || data?.pinch || data?.flyTo) this.fire("zoom", data);
1350
1368
  this.fire("move", data);
1351
1369
  } else if (data?.pinch) this.fire("zoom", data);
1352
1370
  return this;
@@ -1361,6 +1379,10 @@ var MaplairMap = class MaplairMap extends Evented {
1361
1379
  this._targetView = null;
1362
1380
  cancelAnimationFrame(this._flyToFrame);
1363
1381
  cancelAnimationFrame(this._zoomAnimFrame);
1382
+ if (this._subpixelOrigin) {
1383
+ this._subpixelOrigin = false;
1384
+ this._move(this._lastCenter, this._zoom, { flyTo: true });
1385
+ }
1364
1386
  this._panAnim?.stop();
1365
1387
  return this;
1366
1388
  }
@@ -1433,17 +1455,17 @@ var MaplairMap = class MaplairMap extends Evented {
1433
1455
  if (!targets.length && !dragging && !isHover && this.listens(type, true)) targets = [this];
1434
1456
  return targets;
1435
1457
  }
1436
- _isClickDisabled(el) {
1437
- while (el && el !== this._container) {
1438
- if (el["_maplair_disable_click"] || !el.parentNode) return true;
1439
- el = el.parentNode;
1440
- }
1441
- }
1442
1458
  _handleDOMEvent(e) {
1443
1459
  const el = e.target;
1444
1460
  if (e.type === "click") simulateDblclick(e, this._container);
1445
- if (!this._loaded || e.type === "click" && this._isClickDisabled(el)) return;
1446
- const type = e.type, move = type === "pointermove", hovered = this._hoveredCanvasLayer, skip = type === "pointerover" || type === "pointerout" || type.startsWith("key") || this._animatingZoom || move && this.dragging?.moving(), layer = skip ? void 0 : this._canvasLayerAt(e, type === "click"), leftMap = type === "pointerout" && !this._container.contains(e.relatedTarget);
1461
+ if (!this._loaded || e.type === "click" && isClickDisabled(el, this._container)) return;
1462
+ const type = e.type, move = type === "pointermove", hovered = this._hoveredCanvasLayer, skip = type === "pointerover" || type === "pointerout" || type.startsWith("key") || this._animatingZoom || move && this.dragging?.moving(), leftMap = type === "pointerout" && !this._container.contains(e.relatedTarget);
1463
+ let layer = skip ? void 0 : this._canvasLayerAt(e, type === "click");
1464
+ if (type === "pointerdown") this._pressedCanvasLayer = skip ? void 0 : layer ?? null;
1465
+ else if (type === "click" && e.detail > 0 && this._pressedCanvasLayer !== void 0) {
1466
+ if (layer !== this._pressedCanvasLayer) layer = void 0;
1467
+ this._pressedCanvasLayer = void 0;
1468
+ }
1447
1469
  if (layer !== hovered && (move && !skip || leftMap)) {
1448
1470
  if (hovered) this._fireDOMEvent(e, "pointerout", [hovered]);
1449
1471
  this._container.classList.toggle("maplair-interactive", !!layer);
@@ -1512,7 +1534,11 @@ var MaplairMap = class MaplairMap extends Evented {
1512
1534
  }
1513
1535
  _getNewPixelOrigin(center, zoom) {
1514
1536
  const viewHalf = this.getSize()._divideBy(2);
1515
- return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();
1537
+ const origin = this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos());
1538
+ return this._subpixelOrigin ? origin : origin._round();
1539
+ }
1540
+ _snapLayerPoint(point) {
1541
+ return this._subpixelOrigin ? point : point._round();
1516
1542
  }
1517
1543
  _latLngToNewLayerPoint(latlng, zoom, center) {
1518
1544
  const topLeft = this._getNewPixelOrigin(center, zoom);
@@ -1539,7 +1565,12 @@ var MaplairMap = class MaplairMap extends Evented {
1539
1565
  return offset.add(this._getBoundsOffset(newBounds, bounds));
1540
1566
  }
1541
1567
  _getBoundsOffset(pxBounds, maxBounds, zoom) {
1542
- const projectedMaxBounds = new Bounds(this.project(maxBounds.getNorthEast(), zoom), this.project(maxBounds.getSouthWest(), zoom)), minOffset = projectedMaxBounds.min.subtract(pxBounds.min), maxOffset = projectedMaxBounds.max.subtract(pxBounds.max), dx = this._rebound(minOffset.x, -maxOffset.x), dy = this._rebound(minOffset.y, -maxOffset.y);
1568
+ const corners = [
1569
+ maxBounds.getNorthWest(),
1570
+ maxBounds.getNorthEast(),
1571
+ maxBounds.getSouthEast(),
1572
+ maxBounds.getSouthWest()
1573
+ ], projectedMaxBounds = new Bounds(corners.map((c) => this.project(c, zoom))), minOffset = projectedMaxBounds.min.subtract(pxBounds.min), maxOffset = projectedMaxBounds.max.subtract(pxBounds.max), dx = this._rebound(minOffset.x, -maxOffset.x), dy = this._rebound(minOffset.y, -maxOffset.y);
1543
1574
  return new Point(dx, dy);
1544
1575
  }
1545
1576
  _rebound(left, right) {
@@ -1621,18 +1652,16 @@ var MaplairMap = class MaplairMap extends Evented {
1621
1652
  this._zoomAnimFrame = requestAnimationFrame(() => {
1622
1653
  this._zoomAnimFrame = null;
1623
1654
  if (userEvent) this._setUserEvent(userEvent);
1624
- this._moveStart(true, options.noMoveStart ?? false)._animateZoom(center, zoom, true);
1655
+ this._moveStart(true, options.noMoveStart ?? false)._animateZoom(center, zoom);
1625
1656
  });
1626
1657
  return true;
1627
1658
  }
1628
- _animateZoom(center, zoom, startAnim, noUpdate) {
1659
+ _animateZoom(center, zoom, noUpdate) {
1629
1660
  if (!this._mapPane) return;
1630
- if (startAnim) {
1631
- this._animatingZoom = true;
1632
- this._animateToCenter = center;
1633
- this._animateToZoom = zoom;
1634
- this._mapPane.classList.add("maplair-zoom-anim");
1635
- }
1661
+ this._animatingZoom = true;
1662
+ this._animateToCenter = center;
1663
+ this._animateToZoom = zoom;
1664
+ this._mapPane.classList.add("maplair-zoom-anim");
1636
1665
  this.fire("zoomanim", {
1637
1666
  center,
1638
1667
  zoom,
@@ -1640,10 +1669,13 @@ var MaplairMap = class MaplairMap extends Evented {
1640
1669
  });
1641
1670
  if (!this._tempFireZoomEvent) this._tempFireZoomEvent = this._zoom !== this._animateToZoom;
1642
1671
  this._move(this._animateToCenter, this._animateToZoom, void 0, true);
1643
- this._transitionEndTimer = setTimeout(this._onZoomTransitionEnd.bind(this), zoomAnimDuration);
1672
+ clearTimeout(this._transitionEndTimer);
1673
+ this._transitionEndTimer = setTimeout(this._onZoomTransitionEnd.bind(this), 1e3);
1644
1674
  }
1645
1675
  _onZoomTransitionEnd() {
1646
1676
  if (!this._animatingZoom) return;
1677
+ clearTimeout(this._transitionEndTimer);
1678
+ this._containerRect = null;
1647
1679
  this._mapPane?.classList.remove("maplair-zoom-anim");
1648
1680
  this._animatingZoom = false;
1649
1681
  this._move(this.getCenter(), this._animateToZoom, void 0, true);