maplair 4.0.0-alpha.2 → 4.0.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 (82) hide show
  1. package/CHANGELOG.md +22 -38
  2. package/LICENSE +1 -1
  3. package/README.md +10 -9
  4. package/dist/esm/control/SearchControl.js +1 -1
  5. package/dist/esm/control/SearchControl.js.map +1 -1
  6. package/dist/esm/geo/LatLng.js +20 -2
  7. package/dist/esm/geo/LatLng.js.map +1 -1
  8. package/dist/esm/geo/LatLngBounds.js +19 -7
  9. package/dist/esm/geo/LatLngBounds.js.map +1 -1
  10. package/dist/esm/geo/crs/CRS.js +4 -3
  11. package/dist/esm/geo/crs/CRS.js.map +1 -1
  12. package/dist/esm/geo/projection/Projection.LonLat.js +2 -2
  13. package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -1
  14. package/dist/esm/geo/projection/Projection.Mercator.js +2 -2
  15. package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -1
  16. package/dist/esm/geo/projection/Projection.SphericalMercator.js +2 -2
  17. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -1
  18. package/dist/esm/geometry/Bounds.js +19 -7
  19. package/dist/esm/geometry/Bounds.js.map +1 -1
  20. package/dist/esm/geometry/Point.js +23 -5
  21. package/dist/esm/geometry/Point.js.map +1 -1
  22. package/dist/esm/geometry/PolyUtil.js +1 -1
  23. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  24. package/dist/esm/layer/DivOverlay.js +1 -1
  25. package/dist/esm/layer/DivOverlay.js.map +1 -1
  26. package/dist/esm/layer/GeoJSON.js +1 -1
  27. package/dist/esm/layer/GeoJSON.js.map +1 -1
  28. package/dist/esm/layer/Popup.js +1 -1
  29. package/dist/esm/layer/Popup.js.map +1 -1
  30. package/dist/esm/layer/marker/DivIcon.js +1 -1
  31. package/dist/esm/layer/marker/DivIcon.js.map +1 -1
  32. package/dist/esm/layer/marker/Icon.js +2 -2
  33. package/dist/esm/layer/marker/Icon.js.map +1 -1
  34. package/dist/esm/layer/marker/Marker.Move.js +1 -1
  35. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  36. package/dist/esm/layer/marker/Marker.js +2 -2
  37. package/dist/esm/layer/marker/Marker.js.map +1 -1
  38. package/dist/esm/layer/tile/GridLayer.js +1 -1
  39. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  40. package/dist/esm/layer/vector/Polyline.js +1 -1
  41. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  42. package/dist/esm/map/Map.Rotation.js +5 -5
  43. package/dist/esm/map/Map.Rotation.js.map +1 -1
  44. package/dist/esm/map/Map.js +19 -19
  45. package/dist/esm/map/Map.js.map +1 -1
  46. package/dist/esm/map/handler/DragHandler.js +1 -1
  47. package/dist/esm/map/handler/DragHandler.js.map +1 -1
  48. package/dist/esm/map/handler/KeyboardHandler.js +2 -2
  49. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  50. package/dist/esm/package.js +1 -1
  51. package/dist/maplair-global-src.js +134 -73
  52. package/dist/maplair-global-src.js.map +1 -1
  53. package/dist/maplair-global.js +3 -3
  54. package/dist/maplair-global.js.map +1 -1
  55. package/dist/maplair-src.js +134 -73
  56. package/dist/maplair-src.js.map +1 -1
  57. package/dist/maplair.js +3 -3
  58. package/dist/maplair.js.map +1 -1
  59. package/package.json +4 -4
  60. package/src/control/SearchControl.js +2 -2
  61. package/src/geo/LatLng.js +21 -2
  62. package/src/geo/LatLngBounds.js +20 -7
  63. package/src/geo/crs/CRS.js +4 -3
  64. package/src/geo/projection/Projection.LonLat.js +2 -2
  65. package/src/geo/projection/Projection.Mercator.js +2 -2
  66. package/src/geo/projection/Projection.SphericalMercator.js +2 -2
  67. package/src/geometry/Bounds.js +20 -7
  68. package/src/geometry/Point.js +24 -5
  69. package/src/geometry/PolyUtil.js +1 -1
  70. package/src/layer/DivOverlay.js +1 -1
  71. package/src/layer/GeoJSON.js +1 -1
  72. package/src/layer/Popup.js +3 -3
  73. package/src/layer/marker/DivIcon.js +1 -1
  74. package/src/layer/marker/Icon.js +2 -2
  75. package/src/layer/marker/Marker.Move.js +1 -1
  76. package/src/layer/marker/Marker.js +2 -2
  77. package/src/layer/tile/GridLayer.js +1 -1
  78. package/src/layer/vector/Polyline.js +1 -1
  79. package/src/map/Map.Rotation.js +7 -7
  80. package/src/map/Map.js +21 -21
  81. package/src/map/handler/DragHandler.js +1 -1
  82. package/src/map/handler/KeyboardHandler.js +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"GridLayer.js","names":["Browser","Util.throttle","DomUtil.create","Util.falseFn","Util.wrapNum"],"sources":["../../../../src/layer/tile/GridLayer.js"],"sourcesContent":["import {Layer} from '../Layer.js';\nimport Browser from '../../core/Browser.js';\nimport * as Util from '../../core/Util.js';\nimport * as DomUtil from '../../dom/DomUtil.js';\nimport {Point} from '../../geometry/Point.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\n/** @import {LatLngBoundsExpression} from '../../geo/LatLngBounds.js' */\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {MaplairEvent, TileEvent, TileErrorEvent} from '../../core/Events.js' */\n/** @import {LayerOptions} from '../Layer.js' */\n\n/**\n * Options of `GridLayer`.\n * @typedef {object} GridLayerOptions\n * @property {number|Point} [tileSize=256] Width and height of tiles in the grid. Use a\n * number if width and height are equal, or `Point(width, height)` otherwise.\n * @property {number} [opacity=1] Opacity of the tiles. Can be used in the `createTile()`\n * function.\n * @property {string|null} [placeholder=null] A CSS\n * [`background`](https://developer.mozilla.org/docs/Web/CSS/background) shown in place\n * of tiles while they are loading, e.g. `'#ddd'` or\n * `'url(loading.svg) center no-repeat #eee'`. Tiles with a placeholder appear without\n * fading in.\n * @property {boolean} [updateWhenIdle] Load new tiles only when panning ends. Defaults\n * to `false` (tiles are loaded _during_ panning) unless the browser is configured for\n * reduced motion.\n * @property {boolean} [updateWhenZooming=true] By default, a smooth zoom animation\n * (during a [pinch zoom](#map-pinchzoom) or a [`flyTo()`](#map-flyto)) will update grid\n * layers every integer zoom level. Setting this option to `false` will update the grid\n * layer only when the smooth animation ends.\n * @property {number} [updateInterval] Tiles will not update more than once every\n * `updateInterval` milliseconds when panning. Defaults to `200`, increased to five\n * seconds if the browser is configured for reduced motion.\n * @property {number} [zIndex=1] The explicit zIndex of the tile layer.\n * @property {LatLngBoundsExpression|null} [bounds=null] If set, tiles will only be\n * loaded inside the set `LatLngBounds`.\n * @property {number} [minZoom=0] The minimum zoom level down to which this layer will\n * be displayed (inclusive).\n * @property {number} [maxZoom] The maximum zoom level up to which this layer will be\n * displayed (inclusive).\n * @property {number} [maxNativeZoom] Maximum zoom number the tile source has available.\n * If it is specified, the tiles on all zoom levels higher than `maxNativeZoom` will be\n * loaded from `maxNativeZoom` level and auto-scaled.\n * @property {number} [minNativeZoom] Minimum zoom number the tile source has available.\n * If it is specified, the tiles on all zoom levels lower than `minNativeZoom` will be\n * loaded from `minNativeZoom` level and auto-scaled.\n * @property {boolean} [noWrap=false] Whether the layer is wrapped around the\n * antimeridian. If `true`, the GridLayer will only be displayed once at low zoom\n * levels. Has no effect when the [map CRS](#maplairmapoptions-crs) doesn't wrap around.\n * Can be used in combination with [`bounds`](#gridlayeroptions-bounds) to prevent\n * requesting tiles outside the CRS limits.\n * @property {string} [pane='tilePane'] `Map pane` where the grid layer will be added.\n * @property {string} [className=''] A custom class name to assign to the tile layer.\n * Empty by default.\n * @property {boolean} [pixelated=false] Whether to scale the tiles with\n * nearest-neighbour interpolation (`image-rendering: pixelated`) instead of smoothing\n * them, so that their pixels stay crisp, e.g. while zooming or beyond `maxNativeZoom`.\n * Useful for raster data, pixel art or scientific imagery.\n * @property {number} [keepBuffer=2] When panning the map, keep this many rows and\n * columns of tiles before unloading them.\n * @extends LayerOptions\n */\n\n/**\n * The callback of asynchronous `createTile()`, to be called with an error (or `null`)\n * and the tile when the tile has finished loading and drawing.\n * @typedef {(error: any, tile: HTMLElement) => void} TileDoneCallback\n */\n\n/**\n * Generic class for handling a tiled grid of HTML elements. This is the base class for\n * all tile layers and replaces `TileLayer.Canvas`. GridLayer can be extended to create\n * a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will\n * handle creating and animating these DOM elements for you.\n *\n * Layers extending `GridLayer` shall reimplement the [`createTile()`](#gridlayer-createtile)\n * method.\n *\n * @example\n * ### Synchronous usage\n *\n * To create a custom layer, extend GridLayer and implement the `createTile()` method,\n * which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level)\n * coordinates to draw your tile.\n *\n * ```js\n * class CanvasLayer extends GridLayer {\n * createTile(coords) {\n * // create a <canvas> element for drawing\n * const tile = DomUtil.create('canvas', 'maplair-tile');\n *\n * // setup tile width and height according to the options\n * const size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // get a canvas context and draw something on it using coords.x, coords.y and coords.z\n * const ctx = tile.getContext('2d');\n *\n * // return the tile so it can be rendered on screen\n * return tile;\n * }\n * }\n * ```\n *\n * @example\n * ### Asynchronous usage\n *\n * Tile creation can also be asynchronous, this is useful when using a third-party\n * drawing library. Once the tile is finished drawing it can be passed to the `done()`\n * callback.\n *\n * ```js\n * class CanvasLayer extends GridLayer {\n * createTile(coords, done) {\n * const error;\n *\n * // create a <canvas> element for drawing\n * const tile = DomUtil.create('canvas', 'maplair-tile');\n *\n * // setup tile width and height according to the options\n * const size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // draw something asynchronously and pass the tile to the done() callback\n * setTimeout(function() {\n * done(error, tile);\n * }, 1000);\n *\n * return tile;\n * }\n * }\n * ```\n *\n * @fires loading {MaplairEvent} Fired when the grid layer starts loading tiles.\n * @fires tileunload {TileEvent} Fired when a tile is removed (e.g. when a tile goes off\n * the screen).\n * @fires tileloadstart {TileEvent} Fired when a tile is requested and starts loading.\n * @fires tileerror {TileErrorEvent} Fired when there is an error loading a tile.\n * @fires tileload {TileEvent} Fired when a tile loads.\n * @fires load {MaplairEvent} Fired when the grid layer loaded all visible tiles.\n */\nexport class GridLayer extends Layer {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\ttileSize: 256,\n\t\t\topacity: 1,\n\t\t\tplaceholder: null,\n\t\t\tupdateWhenIdle: !Browser.reducedMotion,\n\t\t\tupdateWhenZooming: true,\n\t\t\tupdateInterval: Browser.reducedMotion ? 5000 : 200,\n\t\t\tzIndex: 1,\n\t\t\tbounds: null,\n\t\t\tminZoom: 0,\n\t\t\tmaxZoom: undefined,\n\t\t\tmaxNativeZoom: undefined,\n\t\t\tminNativeZoom: undefined,\n\t\t\tnoWrap: false,\n\t\t\tpane: 'tilePane',\n\t\t\tclassName: '',\n\t\t\tpixelated: false,\n\t\t\tkeepBuffer: 2\n\t\t});\n\t}\n\n\t/**\n\t * Creates a new instance of GridLayer with the supplied options.\n\t * @param {GridLayerOptions} [options]\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\n\t\tthis.callInitHooks(GridLayer);\n\t}\n\n\t/**\n\t * Creates the container of the tiles and loads the tiles.\n\t * @overload\n\t * @param {MaplairMap} map\n\t * @returns {void}\n\t */\n\tonAdd() {\n\t\tthis._initContainer();\n\n\t\tthis._levels = {};\n\t\tthis._tiles = {};\n\n\t\tthis._resetView(); // implicit _update() call\n\t}\n\n\t/**\n\t * Registers the zoom limits of the layer on the map.\n\t * @param {MaplairMap} map\n\t */\n\tbeforeAdd(map) {\n\t\tmap._addZoomLimit(this);\n\t}\n\n\t/**\n\t * Removes the tiles from the map.\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tthis._removeKeptLevel();\n\t\tthis._removeAllTiles();\n\t\tthis._container.remove();\n\t\tmap._removeZoomLimit(this);\n\t\tthis._container = null;\n\t\tthis._tileZoom = undefined;\n\t\tclearTimeout(this._pruneTimeout);\n\t}\n\n\t/**\n\t * Brings the tile layer to the top of all tile layers.\n\t * @returns {this}\n\t */\n\tbringToFront() {\n\t\tif (this._map) {\n\t\t\tDomUtil.toFront(this._container);\n\t\t\tthis._setAutoZIndex(Math.max);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Brings the tile layer to the bottom of all tile layers.\n\t * @returns {this}\n\t */\n\tbringToBack() {\n\t\tif (this._map) {\n\t\t\tDomUtil.toBack(this._container);\n\t\t\tthis._setAutoZIndex(Math.min);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the HTML element that contains the tiles for this layer.\n\t * @returns {HTMLElement}\n\t */\n\tgetContainer() {\n\t\treturn this._container;\n\t}\n\n\t/**\n\t * Changes the [opacity](#gridlayeroptions-opacity) of the grid layer.\n\t * @param {number} opacity\n\t * @returns {this}\n\t */\n\tsetOpacity(opacity) {\n\t\tthis.options.opacity = opacity;\n\t\tthis._updateOpacity();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Changes the [zIndex](#gridlayeroptions-zindex) of the grid layer.\n\t * @param {number} zIndex\n\t * @returns {this}\n\t */\n\tsetZIndex(zIndex) {\n\t\tthis.options.zIndex = zIndex;\n\t\tthis._updateZIndex();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns `true` if any tile in the grid layer has not finished loading.\n\t * @returns {boolean}\n\t */\n\tisLoading() {\n\t\treturn this._loading;\n\t}\n\n\t/**\n\t * Causes the layer to clear all the tiles and request them again.\n\t * @returns {this}\n\t */\n\tredraw() {\n\t\tif (this._map) {\n\t\t\tthis._removeAllTiles();\n\t\t\tconst tileZoom = this._clampZoom(this._map.getZoom());\n\t\t\tif (tileZoom !== this._tileZoom) {\n\t\t\t\tthis._tileZoom = tileZoom;\n\t\t\t\tthis._updateLevels();\n\t\t\t}\n\t\t\tthis._update();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the map events the layer listens to, see `Layer`.\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\tconst events = {\n\t\t\tviewprereset: this._invalidateAll,\n\t\t\tviewreset: this._resetView,\n\t\t\tzoom: this._resetView,\n\t\t\tmoveend: this._onMoveEnd\n\t\t};\n\n\t\tif (!this.options.updateWhenIdle) {\n\t\t\t// update tiles on move, but not more often than once per given interval\n\t\t\tif (!this._onMove) {\n\t\t\t\tthis._onMove = Util.throttle(this._onMoveEnd, this.options.updateInterval, this);\n\t\t\t}\n\n\t\t\tevents.move = this._onMove;\n\t\t}\n\n\t\tif (this._zoomAnimated) {\n\t\t\tevents.zoomanim = this._animateZoom;\n\t\t}\n\n\t\treturn events;\n\t}\n\n\t/**\n\t * Called only internally, must be overridden by classes extending `GridLayer`.\n\t * Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\n\t * is specified, it must be called when the tile has finished loading and drawing.\n\t * @group Extension methods\n\t * @overload\n\t * @param {Point} coords The `x`, `y` and `z` (zoom level) coordinates of the tile.\n\t * @param {TileDoneCallback} [done]\n\t * @returns {HTMLElement}\n\t */\n\t// without parameters: `createTile.length` tells whether a subclass creates tiles\n\t// asynchronously, see `_addTile()`\n\tcreateTile() {\n\t\treturn document.createElement('div');\n\t}\n\n\t/**\n\t * Normalizes the [tileSize option](#gridlayeroptions-tilesize) into a point. Used by\n\t * the `createTile()` method.\n\t * @returns {Point}\n\t */\n\tgetTileSize() {\n\t\tconst s = this.options.tileSize;\n\t\treturn s instanceof Point ? s : new Point(s, s);\n\t}\n\n\t_updateZIndex() {\n\t\tif (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {\n\t\t\tthis._container.style.zIndex = this.options.zIndex;\n\t\t}\n\t}\n\n\t_setAutoZIndex(compare) {\n\t\t// go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\n\n\t\tconst layers = this.getPane().children;\n\t\tlet edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\n\n\t\tfor (const layer of layers) {\n\t\t\tconst zIndex = layer.style.zIndex;\n\n\t\t\tif (layer !== this._container && zIndex) {\n\t\t\t\tedgeZIndex = compare(edgeZIndex, +zIndex);\n\t\t\t}\n\t\t}\n\n\t\tif (isFinite(edgeZIndex)) {\n\t\t\tthis.options.zIndex = edgeZIndex + compare(-1, 1);\n\t\t\tthis._updateZIndex();\n\t\t}\n\t}\n\n\t_updateOpacity() {\n\t\tif (!this._map) { return; }\n\n\t\tthis._container.style.opacity = this.options.opacity;\n\n\t\tconst now = Date.now();\n\t\tlet nextFrame = false,\n\t\twillPrune = false;\n\n\t\tfor (const tile of Object.values(this._tiles ?? {})) {\n\t\t\tif (!tile.current || !tile.loaded) { continue; }\n\n\t\t\tconst fade = tile.noFade ? 1 : Math.min(1, (now - tile.loaded) / 200);\n\n\t\t\ttile.el.style.opacity = fade;\n\t\t\tif (fade < 1) {\n\t\t\t\tnextFrame = true;\n\t\t\t} else {\n\t\t\t\tif (tile.active) {\n\t\t\t\t\twillPrune = true;\n\t\t\t\t} else {\n\t\t\t\t\tthis._onOpaqueTile(tile);\n\t\t\t\t}\n\t\t\t\ttile.active = true;\n\t\t\t}\n\t\t}\n\n\t\tif (willPrune && !this._noPrune) { this._pruneTiles(); }\n\n\t\tif (nextFrame) {\n\t\t\tcancelAnimationFrame(this._fadeFrame);\n\t\t\tthis._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));\n\t\t}\n\t}\n\n\t_onOpaqueTile() {}\n\n\t_initContainer() {\n\t\tif (this._container) { return; }\n\n\t\tthis._container = DomUtil.create('div', `maplair-layer ${this.options.className ?? ''}`);\n\t\tthis._container.classList.toggle('maplair-pixelated', !!this.options.pixelated);\n\t\tthis._updateZIndex();\n\n\t\tif (this.options.opacity < 1) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\t\tthis.getPane().appendChild(this._container);\n\t}\n\n\t// Keeps the loaded tiles of the current level visible below the tiles loaded\n\t// next (e.g. after changing the URL), until these have loaded, to avoid flickering.\n\t_keepCurrentTiles() {\n\t\tconst zoom = this._tileZoom,\n\t\tlevel = this._levels?.[zoom];\n\t\t// keep the first level if the next one has not loaded yet\n\t\tif (!this._map || !level || this._keptLevel) { return; }\n\n\t\tconst tiles = [];\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (tile.coords.z === zoom && tile.loaded) {\n\t\t\t\ttiles.push(tile);\n\t\t\t\tdelete this._tiles[key];\n\t\t\t}\n\t\t}\n\t\tdelete this._levels[zoom];\n\t\tlevel.el.style.zIndex = -1;\n\t\tthis._keptLevel = {level, tiles};\n\t\t// new level for the next tiles\n\t\tthis._updateLevels();\n\n\t\tthis.on('load', this._onLoadKeptLevel, this);\n\t\tthis._map.on('zoomstart viewprereset', this._removeKeptLevel, this);\n\t}\n\n\t_onLoadKeptLevel() {\n\t\tif (this._map._fadeAnimated) {\n\t\t\t// after the new tiles faded in\n\t\t\tclearTimeout(this._keptLevelTimeout);\n\t\t\tthis._keptLevelTimeout = setTimeout(this._removeKeptLevel.bind(this), 250);\n\t\t} else {\n\t\t\tthis._removeKeptLevel();\n\t\t}\n\t}\n\n\t_removeKeptLevel() {\n\t\tif (!this._keptLevel) { return; }\n\t\tconst {level, tiles} = this._keptLevel;\n\t\tthis._keptLevel = null;\n\t\tclearTimeout(this._keptLevelTimeout);\n\t\tthis.off('load', this._onLoadKeptLevel, this);\n\t\tthis._map.off('zoomstart viewprereset', this._removeKeptLevel, this);\n\n\t\tlevel.el.remove();\n\t\tfor (const tile of tiles) {\n\t\t\tthis.fire('tileunload', {\n\t\t\t\ttile: tile.el,\n\t\t\t\tcoords: tile.coords\n\t\t\t});\n\t\t}\n\t}\n\n\t_updateLevels() {\n\n\t\tconst zoom = this._tileZoom,\n\t\tmaxZoom = this.options.maxZoom;\n\n\t\tif (zoom === undefined) { return undefined; }\n\n\t\tfor (let z of Object.keys(this._levels)) {\n\t\t\tz = Number(z);\n\t\t\tif (this._levels[z].el.children.length || z === zoom) {\n\t\t\t\tthis._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);\n\t\t\t\tthis._onUpdateLevel(z);\n\t\t\t} else {\n\t\t\t\tthis._levels[z].el.remove();\n\t\t\t\tthis._removeTilesAtZoom(z);\n\t\t\t\tthis._onRemoveLevel(z);\n\t\t\t\tdelete this._levels[z];\n\t\t\t}\n\t\t}\n\n\t\tlet level = this._levels[zoom];\n\t\tconst map = this._map;\n\n\t\tif (!level) {\n\t\t\tlevel = this._levels[zoom] = {};\n\n\t\t\tlevel.el = DomUtil.create('div', 'maplair-tile-container maplair-zoom-animated', this._container);\n\t\t\tlevel.el.style.zIndex = maxZoom;\n\n\t\t\tlevel.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();\n\t\t\tlevel.zoom = zoom;\n\n\t\t\tthis._setZoomTransform(level, map.getCenter(), map.getZoom());\n\n\t\t\t// force reading offsetWidth so the browser considers the newly added element for transition\n\t\t\tUtil.falseFn(level.el.offsetWidth);\n\n\t\t\tthis._onCreateLevel(level);\n\t\t}\n\n\t\tthis._level = level;\n\n\t\treturn level;\n\t}\n\n\t_onUpdateLevel() {}\n\n\t_onRemoveLevel() {}\n\n\t_onCreateLevel() {}\n\n\t_pruneTiles() {\n\t\tif (!this._map) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst zoom = this._map.getZoom();\n\t\tif (zoom > this.options.maxZoom ||\n\t\t\tzoom < this.options.minZoom) {\n\t\t\tthis._removeAllTiles();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\ttile.retain = tile.current;\n\t\t}\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\tif (tile.current && !tile.active) {\n\t\t\t\tconst coords = tile.coords;\n\t\t\t\tif (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\n\t\t\t\t\tthis._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (!tile.retain) {\n\t\t\t\tthis._removeTile(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t_removeTilesAtZoom(zoom) {\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (tile.coords.z === zoom) {\n\t\t\t\tthis._removeTile(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t_removeAllTiles() {\n\t\tfor (const key of Object.keys(this._tiles)) {\n\t\t\tthis._removeTile(key);\n\t\t}\n\t}\n\n\t_invalidateAll() {\n\t\tfor (const z of Object.keys(this._levels)) {\n\t\t\tthis._levels[z].el.remove();\n\t\t\tthis._onRemoveLevel(Number(z));\n\t\t\tdelete this._levels[z];\n\t\t}\n\t\tthis._removeAllTiles();\n\n\t\tthis._tileZoom = undefined;\n\t}\n\n\t_retainParent(x, y, z, minZoom) {\n\t\tconst x2 = Math.floor(x / 2),\n\t\ty2 = Math.floor(y / 2),\n\t\tz2 = z - 1,\n\t\tcoords2 = new Point(+x2, +y2);\n\t\tcoords2.z = +z2;\n\n\t\tconst key = this._tileCoordsToKey(coords2),\n\t\ttile = this._tiles[key];\n\n\t\tif (tile?.active) {\n\t\t\ttile.retain = true;\n\t\t\treturn true;\n\n\t\t} else if (tile?.loaded) {\n\t\t\ttile.retain = true;\n\t\t}\n\n\t\tif (z2 > minZoom) {\n\t\t\treturn this._retainParent(x2, y2, z2, minZoom);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_retainChildren(x, y, z, maxZoom) {\n\n\t\tfor (let i = 2 * x; i < 2 * x + 2; i++) {\n\t\t\tfor (let j = 2 * y; j < 2 * y + 2; j++) {\n\n\t\t\t\tconst coords = new Point(i, j);\n\t\t\t\tcoords.z = z + 1;\n\n\t\t\t\tconst key = this._tileCoordsToKey(coords),\n\t\t\t\ttile = this._tiles[key];\n\n\t\t\t\tif (tile?.active) {\n\t\t\t\t\ttile.retain = true;\n\t\t\t\t\tcontinue;\n\n\t\t\t\t} else if (tile?.loaded) {\n\t\t\t\t\ttile.retain = true;\n\t\t\t\t}\n\n\t\t\t\tif (z + 1 < maxZoom) {\n\t\t\t\t\tthis._retainChildren(i, j, z + 1, maxZoom);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_resetView(e) {\n\t\tconst animating = e && (e.pinch || e.flyTo || e.continuous);\n\t\tthis._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);\n\t}\n\n\t_animateZoom(e) {\n\t\tthis._setView(e.center, e.zoom, true, e.noUpdate);\n\t}\n\n\t_clampZoom(zoom) {\n\t\tconst options = this.options;\n\n\t\tif (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {\n\t\t\treturn options.minNativeZoom;\n\t\t}\n\n\t\tif (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {\n\t\t\treturn options.maxNativeZoom;\n\t\t}\n\n\t\treturn zoom;\n\t}\n\n\t_setView(center, zoom, noPrune, noUpdate) {\n\t\tlet tileZoom = Math.round(zoom);\n\t\tif ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) ||\n\t\t (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) {\n\t\t\ttileZoom = undefined;\n\t\t} else {\n\t\t\ttileZoom = this._clampZoom(tileZoom);\n\t\t}\n\n\t\tconst tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom);\n\n\t\tif (!noUpdate || tileZoomChanged) {\n\n\t\t\tthis._tileZoom = tileZoom;\n\n\t\t\tif (this._abortLoading) {\n\t\t\t\tthis._abortLoading();\n\t\t\t}\n\n\t\t\tthis._updateLevels();\n\t\t\tthis._resetGrid();\n\n\t\t\tif (tileZoom !== undefined) {\n\t\t\t\tthis._update(center);\n\t\t\t}\n\n\t\t\tif (!noPrune) {\n\t\t\t\tthis._pruneTiles();\n\t\t\t}\n\n\t\t\t// Flag to prevent _updateOpacity from pruning tiles during\n\t\t\t// a zoom anim or a pinch gesture\n\t\t\tthis._noPrune = !!noPrune;\n\t\t}\n\n\t\tthis._setZoomTransforms(center, zoom);\n\t}\n\n\t_setZoomTransforms(center, zoom) {\n\t\tfor (const level of Object.values(this._levels)) {\n\t\t\tthis._setZoomTransform(level, center, zoom);\n\t\t}\n\t}\n\n\t_setZoomTransform(level, center, zoom) {\n\t\tconst scale = this._map.getZoomScale(zoom, level.zoom),\n\t\ttranslate = level.origin.multiplyBy(scale)\n\t\t\t.subtract(this._map._getNewPixelOrigin(center, zoom)).round();\n\n\t\tDomUtil.setTransform(level.el, translate, scale);\n\t}\n\n\t_resetGrid() {\n\t\tconst map = this._map,\n\t\tcrs = map.options.crs,\n\t\ttileSize = this._tileSize = this.getTileSize(),\n\t\ttileZoom = this._tileZoom;\n\n\t\tconst bounds = this._map.getPixelWorldBounds(this._tileZoom);\n\t\tif (bounds) {\n\t\t\tthis._globalTileRange = this._pxBoundsToTileRange(bounds);\n\t\t}\n\n\t\tthis._wrapX = crs.wrapLng && !this.options.noWrap && [\n\t\t\tMath.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x),\n\t\t\tMath.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)\n\t\t];\n\t\tthis._wrapY = crs.wrapLat && !this.options.noWrap && [\n\t\t\tMath.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x),\n\t\t\tMath.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)\n\t\t];\n\t}\n\n\t_onMoveEnd() {\n\t\tif (!this._map || this._map._animatingZoom) { return; }\n\n\t\tthis._update();\n\t}\n\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.getSize().divideBy(scale * 2);\n\n\t\treturn new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));\n\t}\n\n\t// Private method to load tiles in the grid's active zoom level according to map bounds\n\t_update(center) {\n\t\tconst map = this._map;\n\t\tif (!map) { return; }\n\t\tconst zoom = this._clampZoom(map.getZoom());\n\n\t\tif (center === undefined) { center = map.getCenter(); }\n\t\tif (this._tileZoom === undefined) { return; }\t// if out of minzoom/maxzoom\n\n\t\tconst pixelBounds = this._getTiledPixelBounds(center),\n\t\ttileRange = this._pxBoundsToTileRange(pixelBounds),\n\t\ttileCenter = tileRange.getCenter(),\n\t\tqueue = [],\n\t\tmargin = this.options.keepBuffer,\n\t\tnoPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),\n\t\t\ttileRange.getTopRight().add([margin, -margin]));\n\n\t\t// Sanity check: panic if the tile range contains Infinity somewhere.\n\t\tif (!(isFinite(tileRange.min.x) &&\n\t\t isFinite(tileRange.min.y) &&\n\t\t isFinite(tileRange.max.x) &&\n\t\t isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\tconst c = tile.coords;\n\t\t\tif (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {\n\t\t\t\ttile.current = false;\n\t\t\t}\n\t\t}\n\n\t\t// _update just loads more tiles. If the tile zoom level differs too much\n\t\t// from the map's, let _setView reset levels and prune old tiles.\n\t\tif (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }\n\n\t\t// create a queue of coordinates to load tiles from\n\t\tfor (let j = tileRange.min.y; j <= tileRange.max.y; j++) {\n\t\t\tfor (let i = tileRange.min.x; i <= tileRange.max.x; i++) {\n\t\t\t\tconst coords = new Point(i, j);\n\t\t\t\tcoords.z = this._tileZoom;\n\n\t\t\t\tif (!this._isValidTile(coords)) { continue; }\n\n\t\t\t\tconst tile = this._tiles[this._tileCoordsToKey(coords)];\n\t\t\t\tif (tile) {\n\t\t\t\t\ttile.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push(coords);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// sort tile queue to load tiles in order of their distance to center\n\t\tqueue.sort((a, b) => a.distanceTo(tileCenter) - b.distanceTo(tileCenter));\n\n\t\tif (queue.length !== 0) {\n\t\t\t// if it's the first batch of tiles to load\n\t\t\tif (!this._loading) {\n\t\t\t\tthis._loading = true;\n\t\t\t\tthis.fire('loading');\n\t\t\t\tthis._map._onLayerLoading();\n\t\t\t}\n\n\t\t\t// create DOM fragment to append tiles in one batch\n\t\t\tconst fragment = document.createDocumentFragment();\n\n\t\t\tfor (const q of queue) {\n\t\t\t\tthis._addTile(q, fragment);\n\t\t\t}\n\n\t\t\tthis._level.el.appendChild(fragment);\n\t\t}\n\t}\n\n\t_isValidTile(coords) {\n\t\tconst crs = this._map.options.crs;\n\n\t\tif (!crs.infinite) {\n\t\t\t// don't load tile if it's out of bounds and not wrapped\n\t\t\tconst bounds = this._globalTileRange;\n\t\t\tif ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n\t\t\t (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }\n\t\t}\n\n\t\tif (!this.options.bounds) { return true; }\n\n\t\t// don't load tile if it doesn't intersect the bounds in options\n\t\tconst tileBounds = this._tileCoordsToBounds(coords);\n\t\treturn new LatLngBounds(this.options.bounds).overlaps(tileBounds);\n\t}\n\n\t_keyToBounds(key) {\n\t\treturn this._tileCoordsToBounds(this._keyToTileCoords(key));\n\t}\n\n\t_tileCoordsToNwSe(coords) {\n\t\tconst map = this._map,\n\t\ttileSize = this.getTileSize(),\n\t\tnwPoint = coords.scaleBy(tileSize),\n\t\tsePoint = nwPoint.add(tileSize),\n\t\tnw = map.unproject(nwPoint, coords.z),\n\t\tse = map.unproject(sePoint, coords.z);\n\t\treturn [nw, se];\n\t}\n\n\t// converts tile coordinates to its geographical bounds\n\t_tileCoordsToBounds(coords) {\n\t\tconst bp = this._tileCoordsToNwSe(coords);\n\t\tlet bounds = new LatLngBounds(bp[0], bp[1]);\n\n\t\tif (!this.options.noWrap) {\n\t\t\tbounds = this._map.wrapLatLngBounds(bounds);\n\t\t}\n\t\treturn bounds;\n\t}\n\t// converts tile coordinates to key for the tile cache\n\t_tileCoordsToKey(coords) {\n\t\treturn `${coords.x}:${coords.y}:${coords.z}`;\n\t}\n\n\t// converts tile cache key to coordinates\n\t_keyToTileCoords(key) {\n\t\tconst k = key.split(':'),\n\t\tcoords = new Point(+k[0], +k[1]);\n\t\tcoords.z = +k[2];\n\t\treturn coords;\n\t}\n\n\t_removeTile(key) {\n\t\tconst tile = this._tiles[key];\n\t\tif (!tile) { return; }\n\n\t\ttile.el.remove();\n\n\t\tdelete this._tiles[key];\n\n\t\tthis.fire('tileunload', {\n\t\t\ttile: tile.el,\n\t\t\tcoords: this._keyToTileCoords(key)\n\t\t});\n\t}\n\n\t_initTile(tile) {\n\t\ttile.classList.add('maplair-tile');\n\n\t\tconst tileSize = this.getTileSize();\n\t\ttile.style.width = `${tileSize.x}px`;\n\t\ttile.style.height = `${tileSize.y}px`;\n\n\t\ttile.onselectstart = Util.falseFn;\n\t\ttile.onpointermove = Util.falseFn;\n\n\t\tif (this.options.placeholder) {\n\t\t\ttile.style.background = this.options.placeholder;\n\t\t}\n\t}\n\n\t_addTile(coords, container) {\n\t\tconst tilePos = this._getTilePos(coords),\n\t\tkey = this._tileCoordsToKey(coords);\n\n\t\tconst tile = this.createTile(this._wrapCoords(coords), this._tileReady.bind(this, coords));\n\n\t\tthis._initTile(tile);\n\n\t\t// if createTile is defined with a second argument (\"done\" callback),\n\t\t// we know that tile is async and will be ready later; otherwise\n\t\tif (this.createTile.length < 2) {\n\t\t\t// mark tile as ready, but delay one frame for opacity animation to happen\n\t\t\trequestAnimationFrame(this._tileReady.bind(this, coords, null, tile));\n\t\t}\n\n\t\tDomUtil.setPosition(tile, tilePos);\n\n\t\t// save tile in cache\n\t\tthis._tiles[key] = {\n\t\t\tel: tile,\n\t\t\tcoords,\n\t\t\tcurrent: true\n\t\t};\n\n\t\tcontainer.appendChild(tile);\n\t\tthis.fire('tileloadstart', {\n\t\t\ttile,\n\t\t\tcoords\n\t\t});\n\t}\n\n\t_tileReady(coords, err, tile) {\n\t\tif (err) {\n\t\t\tthis.fire('tileerror', {\n\t\t\t\terror: err,\n\t\t\t\ttile,\n\t\t\t\tcoords\n\t\t\t});\n\t\t}\n\n\t\tconst key = this._tileCoordsToKey(coords);\n\n\t\ttile = this._tiles[key];\n\t\tif (!tile) { return; }\n\n\t\ttile.loaded = Date.now();\n\t\tif (this.options.placeholder) {\n\t\t\t// fading in would show the map below instead of the placeholder at first\n\t\t\ttile.noFade = true;\n\t\t\ttile.el.style.background = '';\n\t\t}\n\t\tif (this._map._fadeAnimated && !tile.noFade) {\n\t\t\ttile.el.style.opacity = 0;\n\t\t\tcancelAnimationFrame(this._fadeFrame);\n\t\t\tthis._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));\n\t\t} else {\n\t\t\ttile.active = true;\n\t\t\tthis._pruneTiles();\n\t\t}\n\n\t\tif (!err) {\n\t\t\ttile.el.classList.add('maplair-tile-loaded');\n\n\t\t\tthis.fire('tileload', {\n\t\t\t\ttile: tile.el,\n\t\t\t\tcoords\n\t\t\t});\n\t\t}\n\n\t\tif (this._noTilesToLoad()) {\n\t\t\tthis._loading = false;\n\t\t\tthis.fire('load');\n\t\t\tthis._map._scheduleIdleCheck();\n\n\t\t\tif (!this._map._fadeAnimated) {\n\t\t\t\trequestAnimationFrame(this._pruneTiles.bind(this));\n\t\t\t} else {\n\t\t\t\t// Wait a bit more than 0.2 secs (the duration of the tile fade-in)\n\t\t\t\t// to trigger a pruning.\n\t\t\t\tthis._pruneTimeout = setTimeout(this._pruneTiles.bind(this), 250);\n\t\t\t}\n\t\t}\n\t}\n\n\t_getTilePos(coords) {\n\t\treturn coords.scaleBy(this.getTileSize()).subtract(this._level.origin);\n\t}\n\n\t_wrapCoords(coords) {\n\t\tconst newCoords = new Point(\n\t\t\tthis._wrapX ? Util.wrapNum(coords.x, this._wrapX) : coords.x,\n\t\t\tthis._wrapY ? Util.wrapNum(coords.y, this._wrapY) : coords.y);\n\t\tnewCoords.z = coords.z;\n\t\treturn newCoords;\n\t}\n\n\t_pxBoundsToTileRange(bounds) {\n\t\tconst tileSize = this.getTileSize();\n\t\treturn new Bounds(\n\t\t\tbounds.min.unscaleBy(tileSize).floor(),\n\t\t\tbounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));\n\t}\n\n\t_noTilesToLoad() {\n\t\treturn Object.values(this._tiles).every(t => t.loaded);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJA,IAAa,YAAb,MAAa,kBAAkB,MAAM;CAEpC;EACC,KAAK,kBAAkB;GACtB,UAAU;GACV,SAAS;GACT,aAAa;GACb,gBAAgB,CAACA,gBAAQ;GACzB,mBAAmB;GACnB,gBAAgBA,gBAAQ,gBAAgB,MAAO;GAC/C,QAAQ;GACR,QAAQ;GACR,SAAS;GACT,SAAS,KAAA;GACT,eAAe,KAAA;GACf,eAAe,KAAA;GACf,QAAQ;GACR,MAAM;GACN,WAAW;GACX,WAAW;GACX,YAAY;EACb,CAAC;CACF;;;;;CAMA,YAAY,SAAS;EACpB,MAAM;EACN,WAAgB,MAAM,OAAO;EAE7B,KAAK,cAAc,SAAS;CAC7B;;;;;;;CAQA,QAAQ;EACP,KAAK,eAAe;EAEpB,KAAK,UAAU,CAAC;EAChB,KAAK,SAAS,CAAC;EAEf,KAAK,WAAW;CACjB;;;;;CAMA,UAAU,KAAK;EACd,IAAI,cAAc,IAAI;CACvB;;;;;CAMA,SAAS,KAAK;EACb,KAAK,iBAAiB;EACtB,KAAK,gBAAgB;EACrB,KAAK,WAAW,OAAO;EACvB,IAAI,iBAAiB,IAAI;EACzB,KAAK,aAAa;EAClB,KAAK,YAAY,KAAA;EACjB,aAAa,KAAK,aAAa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AO,OAAO,KAAK,MAAM,CAAC,CAAC,OAAM,MAAK,EAAE,MAAM;CACtD;AACD"}
1
+ {"version":3,"file":"GridLayer.js","names":["Browser","Util.throttle","DomUtil.create","Util.falseFn","Util.wrapNum"],"sources":["../../../../src/layer/tile/GridLayer.js"],"sourcesContent":["import {Layer} from '../Layer.js';\nimport Browser from '../../core/Browser.js';\nimport * as Util from '../../core/Util.js';\nimport * as DomUtil from '../../dom/DomUtil.js';\nimport {Point} from '../../geometry/Point.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\n/** @import {LatLngBoundsExpression} from '../../geo/LatLngBounds.js' */\n/** @import {MaplairMap} from '../../map/Map.js' */\n/** @import {MaplairEvent, TileEvent, TileErrorEvent} from '../../core/Events.js' */\n/** @import {LayerOptions} from '../Layer.js' */\n\n/**\n * Options of `GridLayer`.\n * @typedef {object} GridLayerOptions\n * @property {number|Point} [tileSize=256] Width and height of tiles in the grid. Use a\n * number if width and height are equal, or `Point(width, height)` otherwise.\n * @property {number} [opacity=1] Opacity of the tiles. Can be used in the `createTile()`\n * function.\n * @property {string|null} [placeholder=null] A CSS\n * [`background`](https://developer.mozilla.org/docs/Web/CSS/background) shown in place\n * of tiles while they are loading, e.g. `'#ddd'` or\n * `'url(loading.svg) center no-repeat #eee'`. Tiles with a placeholder appear without\n * fading in.\n * @property {boolean} [updateWhenIdle] Load new tiles only when panning ends. Defaults\n * to `false` (tiles are loaded _during_ panning) unless the browser is configured for\n * reduced motion.\n * @property {boolean} [updateWhenZooming=true] By default, a smooth zoom animation\n * (during a [pinch zoom](#map-pinchzoom) or a [`flyTo()`](#map-flyto)) will update grid\n * layers every integer zoom level. Setting this option to `false` will update the grid\n * layer only when the smooth animation ends.\n * @property {number} [updateInterval] Tiles will not update more than once every\n * `updateInterval` milliseconds when panning. Defaults to `200`, increased to five\n * seconds if the browser is configured for reduced motion.\n * @property {number} [zIndex=1] The explicit zIndex of the tile layer.\n * @property {LatLngBoundsExpression|null} [bounds=null] If set, tiles will only be\n * loaded inside the set `LatLngBounds`.\n * @property {number} [minZoom=0] The minimum zoom level down to which this layer will\n * be displayed (inclusive).\n * @property {number} [maxZoom] The maximum zoom level up to which this layer will be\n * displayed (inclusive).\n * @property {number} [maxNativeZoom] Maximum zoom number the tile source has available.\n * If it is specified, the tiles on all zoom levels higher than `maxNativeZoom` will be\n * loaded from `maxNativeZoom` level and auto-scaled.\n * @property {number} [minNativeZoom] Minimum zoom number the tile source has available.\n * If it is specified, the tiles on all zoom levels lower than `minNativeZoom` will be\n * loaded from `minNativeZoom` level and auto-scaled.\n * @property {boolean} [noWrap=false] Whether the layer is wrapped around the\n * antimeridian. If `true`, the GridLayer will only be displayed once at low zoom\n * levels. Has no effect when the [map CRS](#maplairmapoptions-crs) doesn't wrap around.\n * Can be used in combination with [`bounds`](#gridlayeroptions-bounds) to prevent\n * requesting tiles outside the CRS limits.\n * @property {string} [pane='tilePane'] `Map pane` where the grid layer will be added.\n * @property {string} [className=''] A custom class name to assign to the tile layer.\n * Empty by default.\n * @property {boolean} [pixelated=false] Whether to scale the tiles with\n * nearest-neighbour interpolation (`image-rendering: pixelated`) instead of smoothing\n * them, so that their pixels stay crisp, e.g. while zooming or beyond `maxNativeZoom`.\n * Useful for raster data, pixel art or scientific imagery.\n * @property {number} [keepBuffer=2] When panning the map, keep this many rows and\n * columns of tiles before unloading them.\n * @extends LayerOptions\n */\n\n/**\n * The callback of asynchronous `createTile()`, to be called with an error (or `null`)\n * and the tile when the tile has finished loading and drawing.\n * @typedef {(error: any, tile: HTMLElement) => void} TileDoneCallback\n */\n\n/**\n * Generic class for handling a tiled grid of HTML elements. This is the base class for\n * all tile layers and replaces `TileLayer.Canvas`. GridLayer can be extended to create\n * a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will\n * handle creating and animating these DOM elements for you.\n *\n * Layers extending `GridLayer` shall reimplement the [`createTile()`](#gridlayer-createtile)\n * method.\n *\n * @example\n * ### Synchronous usage\n *\n * To create a custom layer, extend GridLayer and implement the `createTile()` method,\n * which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level)\n * coordinates to draw your tile.\n *\n * ```js\n * class CanvasLayer extends GridLayer {\n * createTile(coords) {\n * // create a <canvas> element for drawing\n * const tile = DomUtil.create('canvas', 'maplair-tile');\n *\n * // setup tile width and height according to the options\n * const size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // get a canvas context and draw something on it using coords.x, coords.y and coords.z\n * const ctx = tile.getContext('2d');\n *\n * // return the tile so it can be rendered on screen\n * return tile;\n * }\n * }\n * ```\n *\n * @example\n * ### Asynchronous usage\n *\n * Tile creation can also be asynchronous, this is useful when using a third-party\n * drawing library. Once the tile is finished drawing it can be passed to the `done()`\n * callback.\n *\n * ```js\n * class CanvasLayer extends GridLayer {\n * createTile(coords, done) {\n * const error;\n *\n * // create a <canvas> element for drawing\n * const tile = DomUtil.create('canvas', 'maplair-tile');\n *\n * // setup tile width and height according to the options\n * const size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // draw something asynchronously and pass the tile to the done() callback\n * setTimeout(function() {\n * done(error, tile);\n * }, 1000);\n *\n * return tile;\n * }\n * }\n * ```\n *\n * @fires loading {MaplairEvent} Fired when the grid layer starts loading tiles.\n * @fires tileunload {TileEvent} Fired when a tile is removed (e.g. when a tile goes off\n * the screen).\n * @fires tileloadstart {TileEvent} Fired when a tile is requested and starts loading.\n * @fires tileerror {TileErrorEvent} Fired when there is an error loading a tile.\n * @fires tileload {TileEvent} Fired when a tile loads.\n * @fires load {MaplairEvent} Fired when the grid layer loaded all visible tiles.\n */\nexport class GridLayer extends Layer {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\ttileSize: 256,\n\t\t\topacity: 1,\n\t\t\tplaceholder: null,\n\t\t\tupdateWhenIdle: !Browser.reducedMotion,\n\t\t\tupdateWhenZooming: true,\n\t\t\tupdateInterval: Browser.reducedMotion ? 5000 : 200,\n\t\t\tzIndex: 1,\n\t\t\tbounds: null,\n\t\t\tminZoom: 0,\n\t\t\tmaxZoom: undefined,\n\t\t\tmaxNativeZoom: undefined,\n\t\t\tminNativeZoom: undefined,\n\t\t\tnoWrap: false,\n\t\t\tpane: 'tilePane',\n\t\t\tclassName: '',\n\t\t\tpixelated: false,\n\t\t\tkeepBuffer: 2\n\t\t});\n\t}\n\n\t/**\n\t * Creates a new instance of GridLayer with the supplied options.\n\t * @param {GridLayerOptions} [options]\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\n\t\tthis.callInitHooks(GridLayer);\n\t}\n\n\t/**\n\t * Creates the container of the tiles and loads the tiles.\n\t * @overload\n\t * @param {MaplairMap} map\n\t * @returns {void}\n\t */\n\tonAdd() {\n\t\tthis._initContainer();\n\n\t\tthis._levels = {};\n\t\tthis._tiles = {};\n\n\t\tthis._resetView(); // implicit _update() call\n\t}\n\n\t/**\n\t * Registers the zoom limits of the layer on the map.\n\t * @param {MaplairMap} map\n\t */\n\tbeforeAdd(map) {\n\t\tmap._addZoomLimit(this);\n\t}\n\n\t/**\n\t * Removes the tiles from the map.\n\t * @param {MaplairMap} map\n\t */\n\tonRemove(map) {\n\t\tthis._removeKeptLevel();\n\t\tthis._removeAllTiles();\n\t\tthis._container.remove();\n\t\tmap._removeZoomLimit(this);\n\t\tthis._container = null;\n\t\tthis._tileZoom = undefined;\n\t\tclearTimeout(this._pruneTimeout);\n\t}\n\n\t/**\n\t * Brings the tile layer to the top of all tile layers.\n\t * @returns {this}\n\t */\n\tbringToFront() {\n\t\tif (this._map) {\n\t\t\tDomUtil.toFront(this._container);\n\t\t\tthis._setAutoZIndex(Math.max);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Brings the tile layer to the bottom of all tile layers.\n\t * @returns {this}\n\t */\n\tbringToBack() {\n\t\tif (this._map) {\n\t\t\tDomUtil.toBack(this._container);\n\t\t\tthis._setAutoZIndex(Math.min);\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the HTML element that contains the tiles for this layer.\n\t * @returns {HTMLElement}\n\t */\n\tgetContainer() {\n\t\treturn this._container;\n\t}\n\n\t/**\n\t * Changes the [opacity](#gridlayeroptions-opacity) of the grid layer.\n\t * @param {number} opacity\n\t * @returns {this}\n\t */\n\tsetOpacity(opacity) {\n\t\tthis.options.opacity = opacity;\n\t\tthis._updateOpacity();\n\t\treturn this;\n\t}\n\n\t/**\n\t * Changes the [zIndex](#gridlayeroptions-zindex) of the grid layer.\n\t * @param {number} zIndex\n\t * @returns {this}\n\t */\n\tsetZIndex(zIndex) {\n\t\tthis.options.zIndex = zIndex;\n\t\tthis._updateZIndex();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns `true` if any tile in the grid layer has not finished loading.\n\t * @returns {boolean}\n\t */\n\tisLoading() {\n\t\treturn this._loading;\n\t}\n\n\t/**\n\t * Causes the layer to clear all the tiles and request them again.\n\t * @returns {this}\n\t */\n\tredraw() {\n\t\tif (this._map) {\n\t\t\tthis._removeAllTiles();\n\t\t\tconst tileZoom = this._clampZoom(this._map.getZoom());\n\t\t\tif (tileZoom !== this._tileZoom) {\n\t\t\t\tthis._tileZoom = tileZoom;\n\t\t\t\tthis._updateLevels();\n\t\t\t}\n\t\t\tthis._update();\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns the map events the layer listens to, see `Layer`.\n\t * @returns {Record<string, Function>}\n\t */\n\tgetEvents() {\n\t\tconst events = {\n\t\t\tviewprereset: this._invalidateAll,\n\t\t\tviewreset: this._resetView,\n\t\t\tzoom: this._resetView,\n\t\t\tmoveend: this._onMoveEnd\n\t\t};\n\n\t\tif (!this.options.updateWhenIdle) {\n\t\t\t// update tiles on move, but not more often than once per given interval\n\t\t\tif (!this._onMove) {\n\t\t\t\tthis._onMove = Util.throttle(this._onMoveEnd, this.options.updateInterval, this);\n\t\t\t}\n\n\t\t\tevents.move = this._onMove;\n\t\t}\n\n\t\tif (this._zoomAnimated) {\n\t\t\tevents.zoomanim = this._animateZoom;\n\t\t}\n\n\t\treturn events;\n\t}\n\n\t/**\n\t * Called only internally, must be overridden by classes extending `GridLayer`.\n\t * Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\n\t * is specified, it must be called when the tile has finished loading and drawing.\n\t * @group Extension methods\n\t * @overload\n\t * @param {Point} coords The `x`, `y` and `z` (zoom level) coordinates of the tile.\n\t * @param {TileDoneCallback} [done]\n\t * @returns {HTMLElement}\n\t */\n\t// without parameters: `createTile.length` tells whether a subclass creates tiles\n\t// asynchronously, see `_addTile()`\n\tcreateTile() {\n\t\treturn document.createElement('div');\n\t}\n\n\t/**\n\t * Normalizes the [tileSize option](#gridlayeroptions-tilesize) into a point. Used by\n\t * the `createTile()` method.\n\t * @returns {Point}\n\t */\n\tgetTileSize() {\n\t\tconst s = this.options.tileSize;\n\t\treturn s instanceof Point ? s : new Point(s, s);\n\t}\n\n\t_updateZIndex() {\n\t\tif (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {\n\t\t\tthis._container.style.zIndex = this.options.zIndex;\n\t\t}\n\t}\n\n\t_setAutoZIndex(compare) {\n\t\t// go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\n\n\t\tconst layers = this.getPane().children;\n\t\tlet edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\n\n\t\tfor (const layer of layers) {\n\t\t\tconst zIndex = layer.style.zIndex;\n\n\t\t\tif (layer !== this._container && zIndex) {\n\t\t\t\tedgeZIndex = compare(edgeZIndex, +zIndex);\n\t\t\t}\n\t\t}\n\n\t\tif (isFinite(edgeZIndex)) {\n\t\t\tthis.options.zIndex = edgeZIndex + compare(-1, 1);\n\t\t\tthis._updateZIndex();\n\t\t}\n\t}\n\n\t_updateOpacity() {\n\t\tif (!this._map) { return; }\n\n\t\tthis._container.style.opacity = this.options.opacity;\n\n\t\tconst now = Date.now();\n\t\tlet nextFrame = false,\n\t\twillPrune = false;\n\n\t\tfor (const tile of Object.values(this._tiles ?? {})) {\n\t\t\tif (!tile.current || !tile.loaded) { continue; }\n\n\t\t\tconst fade = tile.noFade ? 1 : Math.min(1, (now - tile.loaded) / 200);\n\n\t\t\ttile.el.style.opacity = fade;\n\t\t\tif (fade < 1) {\n\t\t\t\tnextFrame = true;\n\t\t\t} else {\n\t\t\t\tif (tile.active) {\n\t\t\t\t\twillPrune = true;\n\t\t\t\t} else {\n\t\t\t\t\tthis._onOpaqueTile(tile);\n\t\t\t\t}\n\t\t\t\ttile.active = true;\n\t\t\t}\n\t\t}\n\n\t\tif (willPrune && !this._noPrune) { this._pruneTiles(); }\n\n\t\tif (nextFrame) {\n\t\t\tcancelAnimationFrame(this._fadeFrame);\n\t\t\tthis._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));\n\t\t}\n\t}\n\n\t_onOpaqueTile() {}\n\n\t_initContainer() {\n\t\tif (this._container) { return; }\n\n\t\tthis._container = DomUtil.create('div', `maplair-layer ${this.options.className ?? ''}`);\n\t\tthis._container.classList.toggle('maplair-pixelated', !!this.options.pixelated);\n\t\tthis._updateZIndex();\n\n\t\tif (this.options.opacity < 1) {\n\t\t\tthis._updateOpacity();\n\t\t}\n\n\t\tthis.getPane().appendChild(this._container);\n\t}\n\n\t// Keeps the loaded tiles of the current level visible below the tiles loaded\n\t// next (e.g. after changing the URL), until these have loaded, to avoid flickering.\n\t_keepCurrentTiles() {\n\t\tconst zoom = this._tileZoom,\n\t\tlevel = this._levels?.[zoom];\n\t\t// keep the first level if the next one has not loaded yet\n\t\tif (!this._map || !level || this._keptLevel) { return; }\n\n\t\tconst tiles = [];\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (tile.coords.z === zoom && tile.loaded) {\n\t\t\t\ttiles.push(tile);\n\t\t\t\tdelete this._tiles[key];\n\t\t\t}\n\t\t}\n\t\tdelete this._levels[zoom];\n\t\tlevel.el.style.zIndex = -1;\n\t\tthis._keptLevel = {level, tiles};\n\t\t// new level for the next tiles\n\t\tthis._updateLevels();\n\n\t\tthis.on('load', this._onLoadKeptLevel, this);\n\t\tthis._map.on('zoomstart viewprereset', this._removeKeptLevel, this);\n\t}\n\n\t_onLoadKeptLevel() {\n\t\tif (this._map._fadeAnimated) {\n\t\t\t// after the new tiles faded in\n\t\t\tclearTimeout(this._keptLevelTimeout);\n\t\t\tthis._keptLevelTimeout = setTimeout(this._removeKeptLevel.bind(this), 250);\n\t\t} else {\n\t\t\tthis._removeKeptLevel();\n\t\t}\n\t}\n\n\t_removeKeptLevel() {\n\t\tif (!this._keptLevel) { return; }\n\t\tconst {level, tiles} = this._keptLevel;\n\t\tthis._keptLevel = null;\n\t\tclearTimeout(this._keptLevelTimeout);\n\t\tthis.off('load', this._onLoadKeptLevel, this);\n\t\tthis._map.off('zoomstart viewprereset', this._removeKeptLevel, this);\n\n\t\tlevel.el.remove();\n\t\tfor (const tile of tiles) {\n\t\t\tthis.fire('tileunload', {\n\t\t\t\ttile: tile.el,\n\t\t\t\tcoords: tile.coords\n\t\t\t});\n\t\t}\n\t}\n\n\t_updateLevels() {\n\n\t\tconst zoom = this._tileZoom,\n\t\tmaxZoom = this.options.maxZoom;\n\n\t\tif (zoom === undefined) { return undefined; }\n\n\t\tfor (let z of Object.keys(this._levels)) {\n\t\t\tz = Number(z);\n\t\t\tif (this._levels[z].el.children.length || z === zoom) {\n\t\t\t\tthis._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);\n\t\t\t\tthis._onUpdateLevel(z);\n\t\t\t} else {\n\t\t\t\tthis._levels[z].el.remove();\n\t\t\t\tthis._removeTilesAtZoom(z);\n\t\t\t\tthis._onRemoveLevel(z);\n\t\t\t\tdelete this._levels[z];\n\t\t\t}\n\t\t}\n\n\t\tlet level = this._levels[zoom];\n\t\tconst map = this._map;\n\n\t\tif (!level) {\n\t\t\tlevel = this._levels[zoom] = {};\n\n\t\t\tlevel.el = DomUtil.create('div', 'maplair-tile-container maplair-zoom-animated', this._container);\n\t\t\tlevel.el.style.zIndex = maxZoom;\n\n\t\t\tlevel.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();\n\t\t\tlevel.zoom = zoom;\n\n\t\t\tthis._setZoomTransform(level, map.getCenter(), map.getZoom());\n\n\t\t\t// force reading offsetWidth so the browser considers the newly added element for transition\n\t\t\tUtil.falseFn(level.el.offsetWidth);\n\n\t\t\tthis._onCreateLevel(level);\n\t\t}\n\n\t\tthis._level = level;\n\n\t\treturn level;\n\t}\n\n\t_onUpdateLevel() {}\n\n\t_onRemoveLevel() {}\n\n\t_onCreateLevel() {}\n\n\t_pruneTiles() {\n\t\tif (!this._map) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst zoom = this._map.getZoom();\n\t\tif (zoom > this.options.maxZoom ||\n\t\t\tzoom < this.options.minZoom) {\n\t\t\tthis._removeAllTiles();\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\ttile.retain = tile.current;\n\t\t}\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\tif (tile.current && !tile.active) {\n\t\t\t\tconst coords = tile.coords;\n\t\t\t\tif (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\n\t\t\t\t\tthis._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (!tile.retain) {\n\t\t\t\tthis._removeTile(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t_removeTilesAtZoom(zoom) {\n\t\tfor (const [key, tile] of Object.entries(this._tiles)) {\n\t\t\tif (tile.coords.z === zoom) {\n\t\t\t\tthis._removeTile(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t_removeAllTiles() {\n\t\tfor (const key of Object.keys(this._tiles)) {\n\t\t\tthis._removeTile(key);\n\t\t}\n\t}\n\n\t_invalidateAll() {\n\t\tfor (const z of Object.keys(this._levels)) {\n\t\t\tthis._levels[z].el.remove();\n\t\t\tthis._onRemoveLevel(Number(z));\n\t\t\tdelete this._levels[z];\n\t\t}\n\t\tthis._removeAllTiles();\n\n\t\tthis._tileZoom = undefined;\n\t}\n\n\t_retainParent(x, y, z, minZoom) {\n\t\tconst x2 = Math.floor(x / 2),\n\t\ty2 = Math.floor(y / 2),\n\t\tz2 = z - 1,\n\t\tcoords2 = new Point(+x2, +y2);\n\t\tcoords2.z = +z2;\n\n\t\tconst key = this._tileCoordsToKey(coords2),\n\t\ttile = this._tiles[key];\n\n\t\tif (tile?.active) {\n\t\t\ttile.retain = true;\n\t\t\treturn true;\n\n\t\t} else if (tile?.loaded) {\n\t\t\ttile.retain = true;\n\t\t}\n\n\t\tif (z2 > minZoom) {\n\t\t\treturn this._retainParent(x2, y2, z2, minZoom);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_retainChildren(x, y, z, maxZoom) {\n\n\t\tfor (let i = 2 * x; i < 2 * x + 2; i++) {\n\t\t\tfor (let j = 2 * y; j < 2 * y + 2; j++) {\n\n\t\t\t\tconst coords = new Point(i, j);\n\t\t\t\tcoords.z = z + 1;\n\n\t\t\t\tconst key = this._tileCoordsToKey(coords),\n\t\t\t\ttile = this._tiles[key];\n\n\t\t\t\tif (tile?.active) {\n\t\t\t\t\ttile.retain = true;\n\t\t\t\t\tcontinue;\n\n\t\t\t\t} else if (tile?.loaded) {\n\t\t\t\t\ttile.retain = true;\n\t\t\t\t}\n\n\t\t\t\tif (z + 1 < maxZoom) {\n\t\t\t\t\tthis._retainChildren(i, j, z + 1, maxZoom);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_resetView(e) {\n\t\tconst animating = e && (e.pinch || e.flyTo || e.continuous);\n\t\tthis._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);\n\t}\n\n\t_animateZoom(e) {\n\t\tthis._setView(e.center, e.zoom, true, e.noUpdate);\n\t}\n\n\t_clampZoom(zoom) {\n\t\tconst options = this.options;\n\n\t\tif (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {\n\t\t\treturn options.minNativeZoom;\n\t\t}\n\n\t\tif (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {\n\t\t\treturn options.maxNativeZoom;\n\t\t}\n\n\t\treturn zoom;\n\t}\n\n\t_setView(center, zoom, noPrune, noUpdate) {\n\t\tlet tileZoom = Math.round(zoom);\n\t\tif ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) ||\n\t\t (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) {\n\t\t\ttileZoom = undefined;\n\t\t} else {\n\t\t\ttileZoom = this._clampZoom(tileZoom);\n\t\t}\n\n\t\tconst tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom);\n\n\t\tif (!noUpdate || tileZoomChanged) {\n\n\t\t\tthis._tileZoom = tileZoom;\n\n\t\t\tif (this._abortLoading) {\n\t\t\t\tthis._abortLoading();\n\t\t\t}\n\n\t\t\tthis._updateLevels();\n\t\t\tthis._resetGrid();\n\n\t\t\tif (tileZoom !== undefined) {\n\t\t\t\tthis._update(center);\n\t\t\t}\n\n\t\t\tif (!noPrune) {\n\t\t\t\tthis._pruneTiles();\n\t\t\t}\n\n\t\t\t// Flag to prevent _updateOpacity from pruning tiles during\n\t\t\t// a zoom anim or a pinch gesture\n\t\t\tthis._noPrune = !!noPrune;\n\t\t}\n\n\t\tthis._setZoomTransforms(center, zoom);\n\t}\n\n\t_setZoomTransforms(center, zoom) {\n\t\tfor (const level of Object.values(this._levels)) {\n\t\t\tthis._setZoomTransform(level, center, zoom);\n\t\t}\n\t}\n\n\t_setZoomTransform(level, center, zoom) {\n\t\tconst scale = this._map.getZoomScale(zoom, level.zoom),\n\t\ttranslate = level.origin.multiplyBy(scale)\n\t\t\t.subtract(this._map._getNewPixelOrigin(center, zoom)).round();\n\n\t\tDomUtil.setTransform(level.el, translate, scale);\n\t}\n\n\t_resetGrid() {\n\t\tconst map = this._map,\n\t\tcrs = map.options.crs,\n\t\ttileSize = this._tileSize = this.getTileSize(),\n\t\ttileZoom = this._tileZoom;\n\n\t\tconst bounds = this._map.getPixelWorldBounds(this._tileZoom);\n\t\tif (bounds) {\n\t\t\tthis._globalTileRange = this._pxBoundsToTileRange(bounds);\n\t\t}\n\n\t\tthis._wrapX = crs.wrapLng && !this.options.noWrap && [\n\t\t\tMath.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x),\n\t\t\tMath.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)\n\t\t];\n\t\tthis._wrapY = crs.wrapLat && !this.options.noWrap && [\n\t\t\tMath.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x),\n\t\t\tMath.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)\n\t\t];\n\t}\n\n\t_onMoveEnd() {\n\t\tif (!this._map || this._map._animatingZoom) { return; }\n\n\t\tthis._update();\n\t}\n\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.getSize().divideBy(scale * 2);\n\n\t\treturn new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));\n\t}\n\n\t// Private method to load tiles in the grid's active zoom level according to map bounds\n\t_update(center) {\n\t\tconst map = this._map;\n\t\tif (!map) { return; }\n\t\tconst zoom = this._clampZoom(map.getZoom());\n\n\t\tif (center === undefined) { center = map.getCenter(); }\n\t\tif (this._tileZoom === undefined) { return; }\t// if out of minzoom/maxzoom\n\n\t\tconst pixelBounds = this._getTiledPixelBounds(center),\n\t\ttileRange = this._pxBoundsToTileRange(pixelBounds),\n\t\ttileCenter = tileRange.getCenter(),\n\t\tqueue = [],\n\t\tmargin = this.options.keepBuffer,\n\t\tnoPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),\n\t\t\ttileRange.getTopRight().add([margin, -margin]));\n\n\t\t// Sanity check: panic if the tile range contains Infinity somewhere.\n\t\tif (!(isFinite(tileRange.min.x) &&\n\t\t isFinite(tileRange.min.y) &&\n\t\t isFinite(tileRange.max.x) &&\n\t\t isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\tconst c = tile.coords;\n\t\t\tif (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {\n\t\t\t\ttile.current = false;\n\t\t\t}\n\t\t}\n\n\t\t// _update just loads more tiles. If the tile zoom level differs too much\n\t\t// from the map's, let _setView reset levels and prune old tiles.\n\t\tif (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }\n\n\t\t// create a queue of coordinates to load tiles from\n\t\tfor (let j = tileRange.min.y; j <= tileRange.max.y; j++) {\n\t\t\tfor (let i = tileRange.min.x; i <= tileRange.max.x; i++) {\n\t\t\t\tconst coords = new Point(i, j);\n\t\t\t\tcoords.z = this._tileZoom;\n\n\t\t\t\tif (!this._isValidTile(coords)) { continue; }\n\n\t\t\t\tconst tile = this._tiles[this._tileCoordsToKey(coords)];\n\t\t\t\tif (tile) {\n\t\t\t\t\ttile.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push(coords);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// sort tile queue to load tiles in order of their distance to center\n\t\tqueue.sort((a, b) => a.distanceTo(tileCenter) - b.distanceTo(tileCenter));\n\n\t\tif (queue.length !== 0) {\n\t\t\t// if it's the first batch of tiles to load\n\t\t\tif (!this._loading) {\n\t\t\t\tthis._loading = true;\n\t\t\t\tthis.fire('loading');\n\t\t\t\tthis._map._onLayerLoading();\n\t\t\t}\n\n\t\t\t// create DOM fragment to append tiles in one batch\n\t\t\tconst fragment = document.createDocumentFragment();\n\n\t\t\tfor (const q of queue) {\n\t\t\t\tthis._addTile(q, fragment);\n\t\t\t}\n\n\t\t\tthis._level.el.appendChild(fragment);\n\t\t}\n\t}\n\n\t_isValidTile(coords) {\n\t\tconst crs = this._map.options.crs;\n\n\t\tif (!crs.infinite) {\n\t\t\t// don't load tile if it's out of bounds and not wrapped\n\t\t\tconst bounds = this._globalTileRange;\n\t\t\tif ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||\n\t\t\t (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }\n\t\t}\n\n\t\tif (!this.options.bounds) { return true; }\n\n\t\t// don't load tile if it doesn't intersect the bounds in options\n\t\tconst tileBounds = this._tileCoordsToBounds(coords);\n\t\treturn LatLngBounds.from(this.options.bounds).overlaps(tileBounds);\n\t}\n\n\t_keyToBounds(key) {\n\t\treturn this._tileCoordsToBounds(this._keyToTileCoords(key));\n\t}\n\n\t_tileCoordsToNwSe(coords) {\n\t\tconst map = this._map,\n\t\ttileSize = this.getTileSize(),\n\t\tnwPoint = coords.scaleBy(tileSize),\n\t\tsePoint = nwPoint.add(tileSize),\n\t\tnw = map.unproject(nwPoint, coords.z),\n\t\tse = map.unproject(sePoint, coords.z);\n\t\treturn [nw, se];\n\t}\n\n\t// converts tile coordinates to its geographical bounds\n\t_tileCoordsToBounds(coords) {\n\t\tconst bp = this._tileCoordsToNwSe(coords);\n\t\tlet bounds = new LatLngBounds(bp[0], bp[1]);\n\n\t\tif (!this.options.noWrap) {\n\t\t\tbounds = this._map.wrapLatLngBounds(bounds);\n\t\t}\n\t\treturn bounds;\n\t}\n\t// converts tile coordinates to key for the tile cache\n\t_tileCoordsToKey(coords) {\n\t\treturn `${coords.x}:${coords.y}:${coords.z}`;\n\t}\n\n\t// converts tile cache key to coordinates\n\t_keyToTileCoords(key) {\n\t\tconst k = key.split(':'),\n\t\tcoords = new Point(+k[0], +k[1]);\n\t\tcoords.z = +k[2];\n\t\treturn coords;\n\t}\n\n\t_removeTile(key) {\n\t\tconst tile = this._tiles[key];\n\t\tif (!tile) { return; }\n\n\t\ttile.el.remove();\n\n\t\tdelete this._tiles[key];\n\n\t\tthis.fire('tileunload', {\n\t\t\ttile: tile.el,\n\t\t\tcoords: this._keyToTileCoords(key)\n\t\t});\n\t}\n\n\t_initTile(tile) {\n\t\ttile.classList.add('maplair-tile');\n\n\t\tconst tileSize = this.getTileSize();\n\t\ttile.style.width = `${tileSize.x}px`;\n\t\ttile.style.height = `${tileSize.y}px`;\n\n\t\ttile.onselectstart = Util.falseFn;\n\t\ttile.onpointermove = Util.falseFn;\n\n\t\tif (this.options.placeholder) {\n\t\t\ttile.style.background = this.options.placeholder;\n\t\t}\n\t}\n\n\t_addTile(coords, container) {\n\t\tconst tilePos = this._getTilePos(coords),\n\t\tkey = this._tileCoordsToKey(coords);\n\n\t\tconst tile = this.createTile(this._wrapCoords(coords), this._tileReady.bind(this, coords));\n\n\t\tthis._initTile(tile);\n\n\t\t// if createTile is defined with a second argument (\"done\" callback),\n\t\t// we know that tile is async and will be ready later; otherwise\n\t\tif (this.createTile.length < 2) {\n\t\t\t// mark tile as ready, but delay one frame for opacity animation to happen\n\t\t\trequestAnimationFrame(this._tileReady.bind(this, coords, null, tile));\n\t\t}\n\n\t\tDomUtil.setPosition(tile, tilePos);\n\n\t\t// save tile in cache\n\t\tthis._tiles[key] = {\n\t\t\tel: tile,\n\t\t\tcoords,\n\t\t\tcurrent: true\n\t\t};\n\n\t\tcontainer.appendChild(tile);\n\t\tthis.fire('tileloadstart', {\n\t\t\ttile,\n\t\t\tcoords\n\t\t});\n\t}\n\n\t_tileReady(coords, err, tile) {\n\t\tif (err) {\n\t\t\tthis.fire('tileerror', {\n\t\t\t\terror: err,\n\t\t\t\ttile,\n\t\t\t\tcoords\n\t\t\t});\n\t\t}\n\n\t\tconst key = this._tileCoordsToKey(coords);\n\n\t\ttile = this._tiles[key];\n\t\tif (!tile) { return; }\n\n\t\ttile.loaded = Date.now();\n\t\tif (this.options.placeholder) {\n\t\t\t// fading in would show the map below instead of the placeholder at first\n\t\t\ttile.noFade = true;\n\t\t\ttile.el.style.background = '';\n\t\t}\n\t\tif (this._map._fadeAnimated && !tile.noFade) {\n\t\t\ttile.el.style.opacity = 0;\n\t\t\tcancelAnimationFrame(this._fadeFrame);\n\t\t\tthis._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));\n\t\t} else {\n\t\t\ttile.active = true;\n\t\t\tthis._pruneTiles();\n\t\t}\n\n\t\tif (!err) {\n\t\t\ttile.el.classList.add('maplair-tile-loaded');\n\n\t\t\tthis.fire('tileload', {\n\t\t\t\ttile: tile.el,\n\t\t\t\tcoords\n\t\t\t});\n\t\t}\n\n\t\tif (this._noTilesToLoad()) {\n\t\t\tthis._loading = false;\n\t\t\tthis.fire('load');\n\t\t\tthis._map._scheduleIdleCheck();\n\n\t\t\tif (!this._map._fadeAnimated) {\n\t\t\t\trequestAnimationFrame(this._pruneTiles.bind(this));\n\t\t\t} else {\n\t\t\t\t// Wait a bit more than 0.2 secs (the duration of the tile fade-in)\n\t\t\t\t// to trigger a pruning.\n\t\t\t\tthis._pruneTimeout = setTimeout(this._pruneTiles.bind(this), 250);\n\t\t\t}\n\t\t}\n\t}\n\n\t_getTilePos(coords) {\n\t\treturn coords.scaleBy(this.getTileSize()).subtract(this._level.origin);\n\t}\n\n\t_wrapCoords(coords) {\n\t\tconst newCoords = new Point(\n\t\t\tthis._wrapX ? Util.wrapNum(coords.x, this._wrapX) : coords.x,\n\t\t\tthis._wrapY ? Util.wrapNum(coords.y, this._wrapY) : coords.y);\n\t\tnewCoords.z = coords.z;\n\t\treturn newCoords;\n\t}\n\n\t_pxBoundsToTileRange(bounds) {\n\t\tconst tileSize = this.getTileSize();\n\t\treturn new Bounds(\n\t\t\tbounds.min.unscaleBy(tileSize).floor(),\n\t\t\tbounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));\n\t}\n\n\t_noTilesToLoad() {\n\t\treturn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AO;GACN,KAAK,SAAS;GACd,KAAK,YAAY;EAClB;EAEA,IAAI,CAAC,KAAK;GACT,KAAK,GAAG,UAAU,IAAI,qBAAqB;GAE3C,KAAK,KAAK,YAAY;IACrB,MAAM,KAAK;IACX;GACD,CAAC;EACF;EAEA,IAAI,KAAK,eAAe,GAAG;GAC1B,KAAK,WAAW;GAChB,KAAK,KAAK,MAAM;GAChB,KAAK,KAAK,mBAAmB;GAE7B,IAAI,CAAC,KAAK,KAAK,eACd,sBAAsB,KAAK,YAAY,KAAK,IAAI,CAAC;QAIjD,KAAK,gBAAgB,WAAW,KAAK,YAAY,KAAK,IAAI,GAAG,GAAG;EAElE;CACD;CAEA,YAAY,QAAQ;EACnB,OAAO,OAAO,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,KAAK,OAAO,MAAM;CACtE;CAEA,YAAY,QAAQ;EACnB,MAAM,YAAY,IAAI,MACrB,KAAK,SAASC,QAAa,OAAO,GAAG,KAAK,MAAM,IAAI,OAAO,GAC3D,KAAK,SAASA,QAAa,OAAO,GAAG,KAAK,MAAM,IAAI,OAAO,CAAC;EAC7D,UAAU,IAAI,OAAO;EACrB,OAAO;CACR;CAEA,qBAAqB,QAAQ;EAC5B,MAAM,WAAW,KAAK,YAAY;EAClC,OAAO,IAAI,OACV,OAAO,IAAI,UAAU,QAAQ,CAAC,CAAC,MAAM,GACrC,OAAO,IAAI,UAAU,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;CACxD;CAEA,iBAAiB;EAChB,OAAO,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,OAAM,MAAK,EAAE,MAAM;CACtD;AACD"}
@@ -102,7 +102,7 @@ var Polyline = class Polyline extends Path {
102
102
  * @returns {(Point & {distance: number})|null}
103
103
  */
104
104
  closestLayerPoint(p) {
105
- p = new Point(p);
105
+ p = Point.from(p);
106
106
  let minDistance = Infinity, minPoint = null, p1, p2;
107
107
  const closest = _sqClosestPointOnSegment;
108
108
  for (const points of this._parts) for (let i = 1, len = points.length; i < len; i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"Polyline.js","names":["LineUtil._sqClosestPointOnSegment","LineUtil.polylineCenter","LineUtil.isFlat","LineUtil.clipSegment","LineUtil.simplify","LineUtil.pointToSegmentDistance"],"sources":["../../../../src/layer/vector/Polyline.js"],"sourcesContent":["import {Path} from './Path.js';\nimport * as Util from '../../core/Util.js';\nimport * as LineUtil from '../../geometry/LineUtil.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {Point} from '../../geometry/Point.js';\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {PointExpression} from '../../geometry/Point.js' */\n/** @import {PathOptions} from './Path.js' */\n\n/**\n * Options of `Polyline`.\n * @typedef {object} PolylineOptions\n * @property {number} [smoothFactor=0.5] How much to simplify the polyline on each zoom\n * level (Douglas–Peucker epsilon, in pixels). Higher values mean faster rendering but\n * less accuracy; lower values mean more accuracy but slower rendering.\n * @property {boolean} [noClip=false] Disable polyline clipping.\n * @extends PathOptions\n */\n\n/**\n * A class for drawing polyline overlays on a map. Extends `Path`.\n *\n * @example\n * ```js\n * // create a red polyline from an array of LatLng points\n * const latlngs = [\n * \t[45.51, -122.68],\n * \t[37.77, -122.43],\n * \t[34.04, -118.2]\n * ];\n *\n * const polyline = new Polyline(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polyline\n * map.fitBounds(polyline.getBounds());\n * ```\n *\n * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:\n *\n * ```js\n * // create a red polyline from an array of arrays of LatLng points\n * const latlngs = [\n * \t[[45.51, -122.68],\n * \t [37.77, -122.43],\n * \t [34.04, -118.2]],\n * \t[[40.78, -73.91],\n * \t [41.83, -87.62],\n * \t [32.76, -96.72]]\n * ];\n * ```\n */\nexport class Polyline extends Path {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\tsmoothFactor: 0.5,\n\t\t\tnoClip: false\n\t\t});\n\t}\n\n\t/**\n\t * Instantiates a polyline object given an array of geographical points and\n\t * optionally an options object. You can create a `Polyline` object with\n\t * multiple separate lines (`MultiPolyline`) by passing an array of arrays\n\t * of geographic points.\n\t * @param {LatLngExpression[]|LatLngExpression[][]|LatLngExpression[][][]} latlngs\n\t * @param {PolylineOptions} [options]\n\t */\n\tconstructor(latlngs, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._setLatLngs(latlngs);\n\n\t\tthis.callInitHooks(Polyline);\n\t}\n\n\t/**\n\t * Returns an array of the points in the path, or nested arrays of points in case of\n\t * multi-polyline.\n\t * @returns {LatLng[]|LatLng[][]|LatLng[][][]}\n\t */\n\tgetLatLngs() {\n\t\treturn this._latlngs;\n\t}\n\n\t/**\n\t * Replaces all the points in the polyline with the given array of geographical points.\n\t * @param {LatLngExpression[]|LatLngExpression[][]|LatLngExpression[][][]} latlngs\n\t * @returns {this}\n\t */\n\tsetLatLngs(latlngs) {\n\t\tthis._setLatLngs(latlngs);\n\t\treturn this.redraw();\n\t}\n\n\t/**\n\t * Returns `true` if the Polyline has no LatLngs.\n\t * @returns {boolean}\n\t */\n\tisEmpty() {\n\t\treturn !this._latlngs.length;\n\t}\n\n\t/**\n\t * Returns the point closest to `p` on the Polyline, with its `distance` to `p` in\n\t * pixels, or `null` if the polyline is not visible.\n\t * @param {PointExpression} p\n\t * @returns {(Point & {distance: number})|null}\n\t */\n\tclosestLayerPoint(p) {\n\t\tp = new Point(p);\n\t\tlet minDistance = Infinity,\n\t\tminPoint = null,\n\t\tp1, p2;\n\t\tconst closest = LineUtil._sqClosestPointOnSegment;\n\n\t\tfor (const points of this._parts) {\n\t\t\tfor (let i = 1, len = points.length; i < len; i++) {\n\t\t\t\tp1 = points[i - 1];\n\t\t\t\tp2 = points[i];\n\n\t\t\t\tconst sqDist = closest(p, p1, p2, true);\n\n\t\t\t\tif (sqDist < minDistance) {\n\t\t\t\t\tminDistance = sqDist;\n\t\t\t\t\tminPoint = closest(p, p1, p2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (minPoint) {\n\t\t\tminPoint.distance = Math.sqrt(minDistance);\n\t\t}\n\t\treturn minPoint;\n\t}\n\n\t/**\n\t * Returns the center ([centroid](https://en.wikipedia.org/wiki/Centroid)) of the polyline.\n\t * @returns {LatLng}\n\t */\n\tgetCenter() {\n\t\t// throws error when not yet added to map as this center calculation requires projected coordinates\n\t\tif (!this._map) {\n\t\t\tthrow new Error('Must add layer to map before using getCenter()');\n\t\t}\n\t\treturn LineUtil.polylineCenter(this._defaultShape(), this._map.options.crs);\n\t}\n\n\t/**\n\t * Returns the `LatLngBounds` of the path.\n\t * @returns {LatLngBounds}\n\t */\n\tgetBounds() {\n\t\treturn this._bounds;\n\t}\n\n\t/**\n\t * Adds a given point to the polyline. By default, adds to the first ring of\n\t * the polyline in case of a multi-polyline, but can be overridden by passing\n\t * a specific ring as a LatLng array (that you can earlier access with\n\t * [`getLatLngs`](#polyline-getlatlngs)).\n\t * @param {LatLngExpression} latlng\n\t * @param {LatLng[]} [latlngs]\n\t * @returns {this}\n\t */\n\taddLatLng(latlng, latlngs) {\n\t\tlatlngs ??= this._defaultShape();\n\t\tlatlng = new LatLng(latlng);\n\t\tlatlngs.push(latlng);\n\t\tthis._bounds.extend(latlng);\n\t\treturn this.redraw();\n\t}\n\n\t_setLatLngs(latlngs) {\n\t\tthis._bounds = new LatLngBounds();\n\t\tthis._latlngs = this._convertLatLngs(latlngs);\n\t}\n\n\t_defaultShape() {\n\t\treturn LineUtil.isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];\n\t}\n\n\t// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way\n\t_convertLatLngs(latlngs) {\n\t\tconst result = [],\n\t\tflat = LineUtil.isFlat(latlngs);\n\n\t\tfor (let i = 0, len = latlngs.length; i < len; i++) {\n\t\t\tif (flat) {\n\t\t\t\tresult[i] = new LatLng(latlngs[i]);\n\t\t\t\tthis._bounds.extend(result[i]);\n\t\t\t} else {\n\t\t\t\tresult[i] = this._convertLatLngs(latlngs[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t_project() {\n\t\tconst pxBounds = new Bounds();\n\t\tthis._rings = [];\n\t\tthis._projectLatlngs(this._latlngs, this._rings, pxBounds);\n\n\t\tif (this._bounds.isValid() && pxBounds.isValid()) {\n\t\t\tthis._rawPxBounds = pxBounds;\n\t\t\tthis._updateBounds();\n\t\t}\n\t}\n\n\t_updateBounds() {\n\t\tconst w = this._clickTolerance(),\n\t\tp = new Point(w, w);\n\n\t\tif (!this._rawPxBounds) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._pxBounds = new Bounds([\n\t\t\tthis._rawPxBounds.min.subtract(p),\n\t\t\tthis._rawPxBounds.max.add(p)\n\t\t]);\n\t}\n\n\t// recursively turns latlngs into a set of rings with projected coordinates\n\t_projectLatlngs(latlngs, result, projectedBounds) {\n\t\tconst flat = latlngs[0] instanceof LatLng;\n\n\t\tif (flat) {\n\t\t\tconst ring = latlngs.map(latlng => this._map.latLngToLayerPoint(latlng));\n\t\t\tring.forEach(r => projectedBounds.extend(r));\n\t\t\tresult.push(ring);\n\t\t} else {\n\t\t\tlatlngs.forEach(latlng => this._projectLatlngs(latlng, result, projectedBounds));\n\t\t}\n\t}\n\n\t// clip polyline by renderer bounds so that we have less to render for performance\n\t_clipPoints() {\n\t\tconst bounds = this._renderer._bounds;\n\n\t\tthis._parts = [];\n\t\tif (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.options.noClip) {\n\t\t\tthis._parts = this._rings;\n\t\t\treturn;\n\t\t}\n\n\t\tconst parts = this._parts;\n\t\tlet i, j, k, len, len2, segment, points;\n\n\t\tfor (i = 0, k = 0, len = this._rings.length; i < len; i++) {\n\t\t\tpoints = this._rings[i];\n\n\t\t\tfor (j = 0, len2 = points.length; j < len2 - 1; j++) {\n\t\t\t\tsegment = LineUtil.clipSegment(points[j], points[j + 1], bounds, j, true);\n\n\t\t\t\tif (!segment) { continue; }\n\n\t\t\t\tparts[k] ??= [];\n\t\t\t\tparts[k].push(segment[0]);\n\n\t\t\t\t// if segment goes out of screen, or it's the last one, it's the end of the line part\n\t\t\t\tif ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {\n\t\t\t\t\tparts[k].push(segment[1]);\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// simplify each clipped part of the polyline for performance\n\t_simplifyPoints() {\n\t\tconst parts = this._parts,\n\t\ttolerance = this.options.smoothFactor;\n\n\t\tfor (let i = 0, len = parts.length; i < len; i++) {\n\t\t\tparts[i] = LineUtil.simplify(parts[i], tolerance);\n\t\t}\n\t}\n\n\t_update() {\n\t\tif (!this._map) { return; }\n\n\t\tthis._clipPoints();\n\t\tthis._simplifyPoints();\n\t\tthis._updatePath();\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updatePoly(this);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p, closed) {\n\t\tlet i, j, k, len, len2, part;\n\t\tconst w = this._clickTolerance();\n\n\t\tif (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }\n\n\t\t// hit detection for polylines\n\t\tfor (i = 0, len = this._parts.length; i < len; i++) {\n\t\t\tpart = this._parts[i];\n\n\t\t\tfor (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n\t\t\t\tif (!closed && (j === 0)) { continue; }\n\n\t\t\t\tif (LineUtil.pointToSegmentDistance(p, part[k], part[j]) <= w) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,IAAa,WAA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,IAAI,GAAG,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,KAAK;GACnD,OAAO,KAAK,OAAO;GAEnB,KAAK,IAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,KAAK;IAChE,IAAI,CAAC,UAAW,MAAM,GAAM;IAE5B,IAAIC,uBAAgC,GAAG,KAAK,IAAI,KAAK,EAAE,KAAK,GAC3D,OAAO;GAET;EACD;EACA,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"Polyline.js","names":["LineUtil._sqClosestPointOnSegment","LineUtil.polylineCenter","LineUtil.isFlat","LineUtil.clipSegment","LineUtil.simplify","LineUtil.pointToSegmentDistance"],"sources":["../../../../src/layer/vector/Polyline.js"],"sourcesContent":["import {Path} from './Path.js';\nimport * as Util from '../../core/Util.js';\nimport * as LineUtil from '../../geometry/LineUtil.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {Point} from '../../geometry/Point.js';\n/** @import {LatLngExpression} from '../../geo/LatLng.js' */\n/** @import {PointExpression} from '../../geometry/Point.js' */\n/** @import {PathOptions} from './Path.js' */\n\n/**\n * Options of `Polyline`.\n * @typedef {object} PolylineOptions\n * @property {number} [smoothFactor=0.5] How much to simplify the polyline on each zoom\n * level (Douglas–Peucker epsilon, in pixels). Higher values mean faster rendering but\n * less accuracy; lower values mean more accuracy but slower rendering.\n * @property {boolean} [noClip=false] Disable polyline clipping.\n * @extends PathOptions\n */\n\n/**\n * A class for drawing polyline overlays on a map. Extends `Path`.\n *\n * @example\n * ```js\n * // create a red polyline from an array of LatLng points\n * const latlngs = [\n * \t[45.51, -122.68],\n * \t[37.77, -122.43],\n * \t[34.04, -118.2]\n * ];\n *\n * const polyline = new Polyline(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polyline\n * map.fitBounds(polyline.getBounds());\n * ```\n *\n * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:\n *\n * ```js\n * // create a red polyline from an array of arrays of LatLng points\n * const latlngs = [\n * \t[[45.51, -122.68],\n * \t [37.77, -122.43],\n * \t [34.04, -118.2]],\n * \t[[40.78, -73.91],\n * \t [41.83, -87.62],\n * \t [32.76, -96.72]]\n * ];\n * ```\n */\nexport class Polyline extends Path {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\tsmoothFactor: 0.5,\n\t\t\tnoClip: false\n\t\t});\n\t}\n\n\t/**\n\t * Instantiates a polyline object given an array of geographical points and\n\t * optionally an options object. You can create a `Polyline` object with\n\t * multiple separate lines (`MultiPolyline`) by passing an array of arrays\n\t * of geographic points.\n\t * @param {LatLngExpression[]|LatLngExpression[][]|LatLngExpression[][][]} latlngs\n\t * @param {PolylineOptions} [options]\n\t */\n\tconstructor(latlngs, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._setLatLngs(latlngs);\n\n\t\tthis.callInitHooks(Polyline);\n\t}\n\n\t/**\n\t * Returns an array of the points in the path, or nested arrays of points in case of\n\t * multi-polyline.\n\t * @returns {LatLng[]|LatLng[][]|LatLng[][][]}\n\t */\n\tgetLatLngs() {\n\t\treturn this._latlngs;\n\t}\n\n\t/**\n\t * Replaces all the points in the polyline with the given array of geographical points.\n\t * @param {LatLngExpression[]|LatLngExpression[][]|LatLngExpression[][][]} latlngs\n\t * @returns {this}\n\t */\n\tsetLatLngs(latlngs) {\n\t\tthis._setLatLngs(latlngs);\n\t\treturn this.redraw();\n\t}\n\n\t/**\n\t * Returns `true` if the Polyline has no LatLngs.\n\t * @returns {boolean}\n\t */\n\tisEmpty() {\n\t\treturn !this._latlngs.length;\n\t}\n\n\t/**\n\t * Returns the point closest to `p` on the Polyline, with its `distance` to `p` in\n\t * pixels, or `null` if the polyline is not visible.\n\t * @param {PointExpression} p\n\t * @returns {(Point & {distance: number})|null}\n\t */\n\tclosestLayerPoint(p) {\n\t\tp = Point.from(p);\n\t\tlet minDistance = Infinity,\n\t\tminPoint = null,\n\t\tp1, p2;\n\t\tconst closest = LineUtil._sqClosestPointOnSegment;\n\n\t\tfor (const points of this._parts) {\n\t\t\tfor (let i = 1, len = points.length; i < len; i++) {\n\t\t\t\tp1 = points[i - 1];\n\t\t\t\tp2 = points[i];\n\n\t\t\t\tconst sqDist = closest(p, p1, p2, true);\n\n\t\t\t\tif (sqDist < minDistance) {\n\t\t\t\t\tminDistance = sqDist;\n\t\t\t\t\tminPoint = closest(p, p1, p2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (minPoint) {\n\t\t\tminPoint.distance = Math.sqrt(minDistance);\n\t\t}\n\t\treturn minPoint;\n\t}\n\n\t/**\n\t * Returns the center ([centroid](https://en.wikipedia.org/wiki/Centroid)) of the polyline.\n\t * @returns {LatLng}\n\t */\n\tgetCenter() {\n\t\t// throws error when not yet added to map as this center calculation requires projected coordinates\n\t\tif (!this._map) {\n\t\t\tthrow new Error('Must add layer to map before using getCenter()');\n\t\t}\n\t\treturn LineUtil.polylineCenter(this._defaultShape(), this._map.options.crs);\n\t}\n\n\t/**\n\t * Returns the `LatLngBounds` of the path.\n\t * @returns {LatLngBounds}\n\t */\n\tgetBounds() {\n\t\treturn this._bounds;\n\t}\n\n\t/**\n\t * Adds a given point to the polyline. By default, adds to the first ring of\n\t * the polyline in case of a multi-polyline, but can be overridden by passing\n\t * a specific ring as a LatLng array (that you can earlier access with\n\t * [`getLatLngs`](#polyline-getlatlngs)).\n\t * @param {LatLngExpression} latlng\n\t * @param {LatLng[]} [latlngs]\n\t * @returns {this}\n\t */\n\taddLatLng(latlng, latlngs) {\n\t\tlatlngs ??= this._defaultShape();\n\t\tlatlng = new LatLng(latlng);\n\t\tlatlngs.push(latlng);\n\t\tthis._bounds.extend(latlng);\n\t\treturn this.redraw();\n\t}\n\n\t_setLatLngs(latlngs) {\n\t\tthis._bounds = new LatLngBounds();\n\t\tthis._latlngs = this._convertLatLngs(latlngs);\n\t}\n\n\t_defaultShape() {\n\t\treturn LineUtil.isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];\n\t}\n\n\t// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way\n\t_convertLatLngs(latlngs) {\n\t\tconst result = [],\n\t\tflat = LineUtil.isFlat(latlngs);\n\n\t\tfor (let i = 0, len = latlngs.length; i < len; i++) {\n\t\t\tif (flat) {\n\t\t\t\tresult[i] = new LatLng(latlngs[i]);\n\t\t\t\tthis._bounds.extend(result[i]);\n\t\t\t} else {\n\t\t\t\tresult[i] = this._convertLatLngs(latlngs[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t_project() {\n\t\tconst pxBounds = new Bounds();\n\t\tthis._rings = [];\n\t\tthis._projectLatlngs(this._latlngs, this._rings, pxBounds);\n\n\t\tif (this._bounds.isValid() && pxBounds.isValid()) {\n\t\t\tthis._rawPxBounds = pxBounds;\n\t\t\tthis._updateBounds();\n\t\t}\n\t}\n\n\t_updateBounds() {\n\t\tconst w = this._clickTolerance(),\n\t\tp = new Point(w, w);\n\n\t\tif (!this._rawPxBounds) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._pxBounds = new Bounds([\n\t\t\tthis._rawPxBounds.min.subtract(p),\n\t\t\tthis._rawPxBounds.max.add(p)\n\t\t]);\n\t}\n\n\t// recursively turns latlngs into a set of rings with projected coordinates\n\t_projectLatlngs(latlngs, result, projectedBounds) {\n\t\tconst flat = latlngs[0] instanceof LatLng;\n\n\t\tif (flat) {\n\t\t\tconst ring = latlngs.map(latlng => this._map.latLngToLayerPoint(latlng));\n\t\t\tring.forEach(r => projectedBounds.extend(r));\n\t\t\tresult.push(ring);\n\t\t} else {\n\t\t\tlatlngs.forEach(latlng => this._projectLatlngs(latlng, result, projectedBounds));\n\t\t}\n\t}\n\n\t// clip polyline by renderer bounds so that we have less to render for performance\n\t_clipPoints() {\n\t\tconst bounds = this._renderer._bounds;\n\n\t\tthis._parts = [];\n\t\tif (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.options.noClip) {\n\t\t\tthis._parts = this._rings;\n\t\t\treturn;\n\t\t}\n\n\t\tconst parts = this._parts;\n\t\tlet i, j, k, len, len2, segment, points;\n\n\t\tfor (i = 0, k = 0, len = this._rings.length; i < len; i++) {\n\t\t\tpoints = this._rings[i];\n\n\t\t\tfor (j = 0, len2 = points.length; j < len2 - 1; j++) {\n\t\t\t\tsegment = LineUtil.clipSegment(points[j], points[j + 1], bounds, j, true);\n\n\t\t\t\tif (!segment) { continue; }\n\n\t\t\t\tparts[k] ??= [];\n\t\t\t\tparts[k].push(segment[0]);\n\n\t\t\t\t// if segment goes out of screen, or it's the last one, it's the end of the line part\n\t\t\t\tif ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {\n\t\t\t\t\tparts[k].push(segment[1]);\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// simplify each clipped part of the polyline for performance\n\t_simplifyPoints() {\n\t\tconst parts = this._parts,\n\t\ttolerance = this.options.smoothFactor;\n\n\t\tfor (let i = 0, len = parts.length; i < len; i++) {\n\t\t\tparts[i] = LineUtil.simplify(parts[i], tolerance);\n\t\t}\n\t}\n\n\t_update() {\n\t\tif (!this._map) { return; }\n\n\t\tthis._clipPoints();\n\t\tthis._simplifyPoints();\n\t\tthis._updatePath();\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updatePoly(this);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p, closed) {\n\t\tlet i, j, k, len, len2, part;\n\t\tconst w = this._clickTolerance();\n\n\t\tif (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }\n\n\t\t// hit detection for polylines\n\t\tfor (i = 0, len = this._parts.length; i < len; i++) {\n\t\t\tpart = this._parts[i];\n\n\t\t\tfor (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n\t\t\t\tif (!closed && (j === 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AEA,cAAc;EACb,KAAK,UAAU,YAAY,IAAI;CAChC;CAGA,eAAe,GAAG,QAAQ;EACzB,IAAI,GAAG,GAAG,GAAG,KAAK,MAAM;EACxB,MAAM,IAAI,KAAK,gBAAgB;EAE/B,IAAI,CAAC,KAAK,aAAa,CAAC,KAAK,UAAU,SAAS,CAAC,GAAK,OAAO;EAG7D,KAAK,IAAI,GAAG,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,KAAK;GACnD,OAAO,KAAK,OAAO;GAEnB,KAAK,IAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,KAAK;IAChE,IAAI,CAAC,UAAW,MAAM,GAAM;IAE5B,IAAIC,uBAAgC,GAAG,KAAK,IAAI,KAAK,EAAE,KAAK,GAC3D,OAAO;GAET;EACD;EACA,OAAO;CACR;AACD"}
@@ -131,7 +131,7 @@ MaplairMap.include({
131
131
  * @returns {Point}
132
132
  */
133
133
  containerPointToLayerPoint(point) {
134
- point = new Point(point);
134
+ point = Point.from(point);
135
135
  if (this._bearing) {
136
136
  const center = this.getSize()._divideBy(2);
137
137
  point = this._rotateToPane(point.subtract(center))._add(center);
@@ -146,7 +146,7 @@ MaplairMap.include({
146
146
  * @returns {Point}
147
147
  */
148
148
  layerPointToContainerPoint(point) {
149
- point = new Point(point).add(this._getMapPanePos());
149
+ point = Point.from(point).add(this._getMapPanePos());
150
150
  if (this._bearing) {
151
151
  const center = this.getSize()._divideBy(2);
152
152
  point = this._rotateToContainer(point.subtract(center))._add(center);
@@ -176,7 +176,7 @@ MaplairMap.include({
176
176
  * @returns {this}
177
177
  */
178
178
  panBy(offset, options) {
179
- return panBy.call(this, this._rotateToPane(new Point(offset)), options);
179
+ return panBy.call(this, this._rotateToPane(Point.from(offset)), options);
180
180
  },
181
181
  _tryAnimatedPan(center, options) {
182
182
  const offset = this._rotateToContainer(this._getCenterOffset(center)._trunc());
@@ -275,7 +275,7 @@ DivOverlay.include({
275
275
  _updatePosition() {
276
276
  if (!this._map) return;
277
277
  const map = this._map, pos = map.latLngToLayerPoint(this._latlng), anchor = map._rotateToPane(new Point(this._getAnchor()));
278
- let offset = new Point(this.options.offset);
278
+ let offset = Point.from(this.options.offset);
279
279
  const transformed = this._zoomAnimated || this.options.overflow || map._bearing;
280
280
  if (!transformed) offset = offset.add(pos).add(anchor);
281
281
  const bottom = this._containerBottom = -offset.y, left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;
@@ -310,7 +310,7 @@ Popup.include({
310
310
  return;
311
311
  }
312
312
  const map = this._map, marginBottom = this._containerMarginBottom ?? (parseInt(getComputedStyle(this._container).marginBottom, 10) || 0), containerHeight = this._containerHeight + marginBottom, containerWidth = this._containerWidth, topLeft = new Point(this._containerLeft, -containerHeight - this._containerBottom);
313
- const containerPos = map.layerPointToContainerPoint(this._getContainerPosition())._add(topLeft), padding = new Point(this.options.autoPanPadding), paddingTL = new Point(this.options.autoPanPaddingTopLeft ?? padding), paddingBR = new Point(this.options.autoPanPaddingBottomRight ?? padding), size = map.getSize();
313
+ const containerPos = map.layerPointToContainerPoint(this._getContainerPosition())._add(topLeft), padding = Point.from(this.options.autoPanPadding), paddingTL = Point.from(this.options.autoPanPaddingTopLeft ?? padding), paddingBR = Point.from(this.options.autoPanPaddingBottomRight ?? padding), size = map.getSize();
314
314
  let dx = 0, dy = 0;
315
315
  if (containerPos.x + containerWidth + paddingBR.x > size.x) dx = containerPos.x + containerWidth - size.x + paddingBR.x;
316
316
  if (containerPos.x - dx - paddingTL.x < 0) dx = containerPos.x - paddingTL.x;
@@ -1 +1 @@
1
- {"version":3,"file":"Map.Rotation.js","names":["Browser","DomUtil.create","DomUtil.getPosition","DomUtil.getScale","PointerEvents.getPointers"],"sources":["../../../src/map/Map.Rotation.js"],"sourcesContent":["import {MaplairMap} from './Map.js';\nimport Browser from '../core/Browser.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 '../layer/marker/Marker.Rotation.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} = 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 || Browser.reducedMotion) {\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._container.insertBefore(rotatePane, this._mapPane);\n\t\t\trotatePane.appendChild(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 = new Point(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 = new Point(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(new Point(offset)), options);\n\t},\n\n\t_tryAnimatedPan(center, options) {\n\t\t// difference between the new and current centers in pixels\n\t\tconst offset = this._rotateToContainer(this._getCenterOffset(center)._trunc());\n\n\t\t// don't animate too far unless animate: true specified in options\n\t\tif (options?.animate !== true && !this.getSize().contains(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),\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 = new Point(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 = new Point(this.options.autoPanPadding),\n\t\tpaddingTL = new Point(this.options.autoPanPaddingTopLeft ?? padding),\n\t\tpaddingBR = new Point(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 * Methods of `Marker` for the map rotation: the marker is updated on rotation.\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/** @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\tdecelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease);\n\t\t\tlet offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();\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, round: false}, 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":";;;;;;;;;;;;;;;;;;;;;;AA6BA,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;A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AAI,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":["Browser","DomUtil.create","DomUtil.getPosition","DomUtil.getScale","PointerEvents.getPointers"],"sources":["../../../src/map/Map.Rotation.js"],"sourcesContent":["import {MaplairMap} from './Map.js';\nimport Browser from '../core/Browser.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 '../layer/marker/Marker.Rotation.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} = 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 || Browser.reducedMotion) {\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._container.insertBefore(rotatePane, this._mapPane);\n\t\t\trotatePane.appendChild(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\tconst offset = this._rotateToContainer(this._getCenterOffset(center)._trunc());\n\n\t\t// don't animate too far unless animate: true specified in options\n\t\tif (options?.animate !== true && !this.getSize().contains(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),\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 * Methods of `Marker` for the map rotation: the marker is updated on rotation.\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/** @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\tdecelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease);\n\t\t\tlet offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();\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, round: false}, 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":";;;;;;;;;;;;;;;;;;;;;;AA6BA,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,oBAAmB,OAAO,WACtC,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;;AA8RjC,WAAW,QAAQ;;;;;;;;;;;CAvPlB,WAAW,SAAS,SAAS;EAC5B,UAAU,iBAAiB,OAAO;EAClC,MAAM,OAAO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