maplair 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/esm/Maplair.js +14 -14
  3. package/dist/esm/control/AttributionControl.js +24 -14
  4. package/dist/esm/control/AttributionControl.js.map +1 -1
  5. package/dist/esm/control/ButtonControl.js +9 -11
  6. package/dist/esm/control/ButtonControl.js.map +1 -1
  7. package/dist/esm/control/ContextMenu.js +1 -3
  8. package/dist/esm/control/ContextMenu.js.map +1 -1
  9. package/dist/esm/control/Control.js +9 -16
  10. package/dist/esm/control/Control.js.map +1 -1
  11. package/dist/esm/control/FullscreenControl.js +5 -7
  12. package/dist/esm/control/FullscreenControl.js.map +1 -1
  13. package/dist/esm/control/LayersControl.js +144 -35
  14. package/dist/esm/control/LayersControl.js.map +1 -1
  15. package/dist/esm/control/LegendControl.js +7 -9
  16. package/dist/esm/control/LegendControl.js.map +1 -1
  17. package/dist/esm/control/MiniMapControl.js +14 -16
  18. package/dist/esm/control/MiniMapControl.js.map +1 -1
  19. package/dist/esm/control/RotateControl.js +1 -3
  20. package/dist/esm/control/RotateControl.js.map +1 -1
  21. package/dist/esm/control/ScaleControl.js +7 -9
  22. package/dist/esm/control/ScaleControl.js.map +1 -1
  23. package/dist/esm/control/SearchControl.js +99 -17
  24. package/dist/esm/control/SearchControl.js.map +1 -1
  25. package/dist/esm/control/SideBySideControl.js +1 -3
  26. package/dist/esm/control/SideBySideControl.js.map +1 -1
  27. package/dist/esm/control/TextControl.js +5 -7
  28. package/dist/esm/control/TextControl.js.map +1 -1
  29. package/dist/esm/control/TimeControl.js +408 -0
  30. package/dist/esm/control/TimeControl.js.map +1 -0
  31. package/dist/esm/control/ZoomControl.js +5 -7
  32. package/dist/esm/control/ZoomControl.js.map +1 -1
  33. package/dist/esm/core/Class.js +28 -37
  34. package/dist/esm/core/Class.js.map +1 -1
  35. package/dist/esm/core/Events.js +21 -8
  36. package/dist/esm/core/Events.js.map +1 -1
  37. package/dist/esm/core/Handler.js +13 -11
  38. package/dist/esm/core/Handler.js.map +1 -1
  39. package/dist/esm/core/Util.js +13 -1
  40. package/dist/esm/core/Util.js.map +1 -1
  41. package/dist/esm/dom/DomEvent.DoubleTap.js +25 -22
  42. package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -1
  43. package/dist/esm/dom/DomEvent.PointerEvents.js +2 -16
  44. package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -1
  45. package/dist/esm/dom/DomEvent.js +8 -42
  46. package/dist/esm/dom/DomEvent.js.map +1 -1
  47. package/dist/esm/dom/DomUtil.js +14 -68
  48. package/dist/esm/dom/DomUtil.js.map +1 -1
  49. package/dist/esm/dom/Draggable.js +17 -18
  50. package/dist/esm/dom/Draggable.js.map +1 -1
  51. package/dist/esm/dom/PosAnimation.js +3 -25
  52. package/dist/esm/dom/PosAnimation.js.map +1 -1
  53. package/dist/esm/geo/LatLng.js +15 -5
  54. package/dist/esm/geo/LatLng.js.map +1 -1
  55. package/dist/esm/geo/crs/EPSG3395.js +1 -1
  56. package/dist/esm/geo/crs/EPSG3395.js.map +1 -1
  57. package/dist/esm/geo/crs/EPSG3857.js +1 -1
  58. package/dist/esm/geo/crs/EPSG3857.js.map +1 -1
  59. package/dist/esm/geo/crs/EPSG4326.js +1 -1
  60. package/dist/esm/geo/crs/EPSG4326.js.map +1 -1
  61. package/dist/esm/geo/crs/EarthCRS.js +2 -2
  62. package/dist/esm/geo/crs/EarthCRS.js.map +1 -1
  63. package/dist/esm/geo/crs/SimpleCRS.js +1 -1
  64. package/dist/esm/geo/crs/SimpleCRS.js.map +1 -1
  65. package/dist/esm/geo/projection/Projection.LonLat.js +1 -1
  66. package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -1
  67. package/dist/esm/geo/projection/Projection.Mercator.js +1 -1
  68. package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -1
  69. package/dist/esm/geo/projection/Projection.SphericalMercator.js +1 -1
  70. package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -1
  71. package/dist/esm/geometry/LineUtil.js +36 -30
  72. package/dist/esm/geometry/LineUtil.js.map +1 -1
  73. package/dist/esm/geometry/PolyUtil.js +8 -27
  74. package/dist/esm/geometry/PolyUtil.js.map +1 -1
  75. package/dist/esm/layer/BlanketOverlay.js +6 -8
  76. package/dist/esm/layer/BlanketOverlay.js.map +1 -1
  77. package/dist/esm/layer/DivOverlay.js +15 -20
  78. package/dist/esm/layer/DivOverlay.js.map +1 -1
  79. package/dist/esm/layer/GeoJSON.js +9 -145
  80. package/dist/esm/layer/GeoJSON.js.map +1 -1
  81. package/dist/esm/layer/GeoJSONUtil.js +75 -0
  82. package/dist/esm/layer/GeoJSONUtil.js.map +1 -0
  83. package/dist/esm/layer/HeatLayer.js +15 -17
  84. package/dist/esm/layer/HeatLayer.js.map +1 -1
  85. package/dist/esm/layer/ImageOverlay.js +20 -26
  86. package/dist/esm/layer/ImageOverlay.js.map +1 -1
  87. package/dist/esm/layer/Layer.js +8 -10
  88. package/dist/esm/layer/Layer.js.map +1 -1
  89. package/dist/esm/layer/LayerGroup.js +51 -0
  90. package/dist/esm/layer/LayerGroup.js.map +1 -1
  91. package/dist/esm/layer/Popup.js +26 -42
  92. package/dist/esm/layer/Popup.js.map +1 -1
  93. package/dist/esm/layer/SVGOverlay.js +2 -5
  94. package/dist/esm/layer/SVGOverlay.js.map +1 -1
  95. package/dist/esm/layer/Tooltip.js +15 -17
  96. package/dist/esm/layer/Tooltip.js.map +1 -1
  97. package/dist/esm/layer/VideoOverlay.js +12 -15
  98. package/dist/esm/layer/VideoOverlay.js.map +1 -1
  99. package/dist/esm/layer/marker/DefaultIcon.js +15 -48
  100. package/dist/esm/layer/marker/DefaultIcon.js.map +1 -1
  101. package/dist/esm/layer/marker/DivIcon.js +7 -9
  102. package/dist/esm/layer/marker/DivIcon.js.map +1 -1
  103. package/dist/esm/layer/marker/Icon.js +7 -10
  104. package/dist/esm/layer/marker/Icon.js.map +1 -1
  105. package/dist/esm/layer/marker/Marker.Drag.js +1 -1
  106. package/dist/esm/layer/marker/Marker.Drag.js.map +1 -1
  107. package/dist/esm/layer/marker/Marker.Move.js +1 -2
  108. package/dist/esm/layer/marker/Marker.Move.js.map +1 -1
  109. package/dist/esm/layer/marker/Marker.js +61 -33
  110. package/dist/esm/layer/marker/Marker.js.map +1 -1
  111. package/dist/esm/layer/marker/MarkerClusterGroup.js +302 -0
  112. package/dist/esm/layer/marker/MarkerClusterGroup.js.map +1 -0
  113. package/dist/esm/layer/marker/SvgIcon.js +6 -8
  114. package/dist/esm/layer/marker/SvgIcon.js.map +1 -1
  115. package/dist/esm/layer/tile/GridLayer.js +85 -97
  116. package/dist/esm/layer/tile/GridLayer.js.map +1 -1
  117. package/dist/esm/layer/tile/TileLayer.js +28 -36
  118. package/dist/esm/layer/tile/TileLayer.js.map +1 -1
  119. package/dist/esm/layer/tile/WMSTileLayer.js +28 -23
  120. package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -1
  121. package/dist/esm/layer/vector/Canvas.js +1 -3
  122. package/dist/esm/layer/vector/Canvas.js.map +1 -1
  123. package/dist/esm/layer/vector/Circle.js +2 -2
  124. package/dist/esm/layer/vector/Circle.js.map +1 -1
  125. package/dist/esm/layer/vector/CircleMarker.js +17 -7
  126. package/dist/esm/layer/vector/CircleMarker.js.map +1 -1
  127. package/dist/esm/layer/vector/Path.DashAnimation.js +2 -3
  128. package/dist/esm/layer/vector/Path.DashAnimation.js.map +1 -1
  129. package/dist/esm/layer/vector/Path.js +27 -20
  130. package/dist/esm/layer/vector/Path.js.map +1 -1
  131. package/dist/esm/layer/vector/Polygon.js +20 -4
  132. package/dist/esm/layer/vector/Polygon.js.map +1 -1
  133. package/dist/esm/layer/vector/Polyline.Decorations.js +2 -2
  134. package/dist/esm/layer/vector/Polyline.js +23 -7
  135. package/dist/esm/layer/vector/Polyline.js.map +1 -1
  136. package/dist/esm/layer/vector/Renderer.getRenderer.js +14 -13
  137. package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -1
  138. package/dist/esm/layer/vector/SVG.js +5 -5
  139. package/dist/esm/layer/vector/SVG.js.map +1 -1
  140. package/dist/esm/map/Map.Rotation.js +10 -6
  141. package/dist/esm/map/Map.Rotation.js.map +1 -1
  142. package/dist/esm/map/Map.js +116 -110
  143. package/dist/esm/map/Map.js.map +1 -1
  144. package/dist/esm/map/handler/BoxZoomHandler.js +5 -7
  145. package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -1
  146. package/dist/esm/map/handler/DisplaceHandler.js +6 -8
  147. package/dist/esm/map/handler/DisplaceHandler.js.map +1 -1
  148. package/dist/esm/map/handler/DragHandler.js +19 -19
  149. package/dist/esm/map/handler/DragHandler.js.map +1 -1
  150. package/dist/esm/map/handler/KeyboardHandler.js +35 -35
  151. package/dist/esm/map/handler/KeyboardHandler.js.map +1 -1
  152. package/dist/esm/map/handler/PinchZoomHandler.js +12 -3
  153. package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -1
  154. package/dist/esm/map/handler/ScrollWheelZoomHandler.js +3 -4
  155. package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -1
  156. package/dist/esm/map/handler/TapHoldHandler.js +12 -5
  157. package/dist/esm/map/handler/TapHoldHandler.js.map +1 -1
  158. package/dist/esm/package.js +1 -1
  159. package/dist/maplair-global-src.js +8009 -7369
  160. package/dist/maplair-global-src.js.map +1 -1
  161. package/dist/maplair-global.js +2 -2
  162. package/dist/maplair-global.js.map +1 -1
  163. package/dist/maplair-src.js +10040 -9381
  164. package/dist/maplair-src.js.map +1 -1
  165. package/dist/maplair.css +148 -98
  166. package/dist/maplair.js +2 -2
  167. package/dist/maplair.js.map +1 -1
  168. package/i18n/cs.json +6 -0
  169. package/i18n/de.json +6 -0
  170. package/i18n/en.json +6 -0
  171. package/i18n/es.json +6 -0
  172. package/i18n/fr.json +6 -0
  173. package/i18n/hu.json +6 -0
  174. package/i18n/it.json +6 -0
  175. package/i18n/rm.json +6 -0
  176. package/i18n/sk.json +6 -0
  177. package/i18n/sl.json +6 -0
  178. package/package.json +9 -11
  179. package/src/control/AttributionControl.js +25 -18
  180. package/src/control/ButtonControl.js +9 -11
  181. package/src/control/ContextMenu.js +3 -5
  182. package/src/control/Control.js +9 -19
  183. package/src/control/FullscreenControl.js +5 -7
  184. package/src/control/LayersControl.js +159 -36
  185. package/src/control/LegendControl.js +7 -9
  186. package/src/control/MiniMapControl.js +9 -11
  187. package/src/control/RotateControl.js +3 -5
  188. package/src/control/ScaleControl.js +7 -9
  189. package/src/control/SearchControl.js +102 -19
  190. package/src/control/SideBySideControl.js +3 -5
  191. package/src/control/TextControl.js +5 -7
  192. package/src/control/TimeControl.js +471 -0
  193. package/src/control/ZoomControl.js +5 -7
  194. package/src/control/index.js +1 -0
  195. package/src/core/Class.js +35 -34
  196. package/src/core/Events.js +22 -3
  197. package/src/core/Handler.js +14 -12
  198. package/src/core/Util.js +19 -1
  199. package/src/core/index.js +0 -1
  200. package/src/dom/DomEvent.DoubleTap.js +18 -10
  201. package/src/dom/DomEvent.PointerEvents.js +3 -26
  202. package/src/dom/DomEvent.js +8 -66
  203. package/src/dom/DomUtil.js +22 -78
  204. package/src/dom/Draggable.js +27 -22
  205. package/src/dom/PosAnimation.js +3 -25
  206. package/src/dom/index.js +0 -1
  207. package/src/geo/LatLng.js +20 -3
  208. package/src/geo/crs/EPSG3395.js +1 -1
  209. package/src/geo/crs/EPSG3857.js +1 -1
  210. package/src/geo/crs/EPSG4326.js +1 -1
  211. package/src/geo/crs/EarthCRS.js +2 -8
  212. package/src/geo/crs/SimpleCRS.js +1 -1
  213. package/src/geo/projection/Projection.LonLat.js +1 -1
  214. package/src/geo/projection/Projection.Mercator.js +1 -1
  215. package/src/geo/projection/Projection.SphericalMercator.js +1 -1
  216. package/src/geometry/LineUtil.js +47 -48
  217. package/src/geometry/PolyUtil.js +14 -43
  218. package/src/layer/BlanketOverlay.js +6 -10
  219. package/src/layer/DivOverlay.js +15 -26
  220. package/src/layer/GeoJSON.js +7 -205
  221. package/src/layer/GeoJSONUtil.js +85 -0
  222. package/src/layer/HeatLayer.js +9 -11
  223. package/src/layer/ImageOverlay.js +19 -30
  224. package/src/layer/Layer.js +8 -10
  225. package/src/layer/LayerGroup.js +71 -0
  226. package/src/layer/Popup.js +28 -43
  227. package/src/layer/SVGOverlay.js +1 -5
  228. package/src/layer/Tooltip.js +15 -19
  229. package/src/layer/VideoOverlay.js +12 -15
  230. package/src/layer/marker/DefaultIcon.js +15 -61
  231. package/src/layer/marker/DivIcon.js +9 -11
  232. package/src/layer/marker/Icon.js +7 -10
  233. package/src/layer/marker/Marker.Drag.js +1 -1
  234. package/src/layer/marker/Marker.Move.js +1 -2
  235. package/src/layer/marker/Marker.js +81 -39
  236. package/src/layer/marker/MarkerClusterGroup.js +370 -0
  237. package/src/layer/marker/SvgIcon.js +7 -9
  238. package/src/layer/marker/index.js +1 -0
  239. package/src/layer/tile/GridLayer.js +103 -133
  240. package/src/layer/tile/TileLayer.js +35 -43
  241. package/src/layer/tile/WMSTileLayer.js +26 -24
  242. package/src/layer/vector/Canvas.js +3 -5
  243. package/src/layer/vector/Circle.js +5 -2
  244. package/src/layer/vector/CircleMarker.js +17 -6
  245. package/src/layer/vector/Path.DashAnimation.js +1 -2
  246. package/src/layer/vector/Path.js +30 -21
  247. package/src/layer/vector/Polygon.js +28 -5
  248. package/src/layer/vector/Polyline.js +25 -6
  249. package/src/layer/vector/Renderer.getRenderer.js +17 -17
  250. package/src/layer/vector/SVG.js +5 -5
  251. package/src/map/Map.Rotation.js +12 -4
  252. package/src/map/Map.js +142 -133
  253. package/src/map/handler/BoxZoomHandler.js +9 -8
  254. package/src/map/handler/DisplaceHandler.js +6 -8
  255. package/src/map/handler/DragHandler.js +25 -28
  256. package/src/map/handler/KeyboardHandler.js +42 -48
  257. package/src/map/handler/PinchZoomHandler.js +16 -5
  258. package/src/map/handler/ScrollWheelZoomHandler.js +6 -4
  259. package/src/map/handler/TapHoldHandler.js +15 -4
  260. package/src/map/index.js +1 -1
  261. package/src/maplair.css +148 -98
  262. package/dist/esm/core/Browser.js +0 -100
  263. package/dist/esm/core/Browser.js.map +0 -1
  264. package/dist/images/layers.svg +0 -1
  265. package/dist/images/marker-icon.svg +0 -1
  266. package/dist/images/marker-shadow.svg +0 -1
  267. package/src/core/Browser.js +0 -110
  268. package/src/images/layers.svg +0 -1
  269. package/src/images/marker-icon.svg +0 -1
  270. package/src/images/marker-shadow.svg +0 -1
@@ -1,7 +1,6 @@
1
1
  import { falseFn, setOptions, throttle, wrapNum } from "../../core/Util.js";
2
2
  import { Point } from "../../geometry/Point.js";
3
- import Browser_default from "../../core/Browser.js";
4
- import { create, setPosition, setTransform, toBack, toFront } from "../../dom/DomUtil.js";
3
+ import { create, getPosition, setPosition, setTransform, toBack, toFront } from "../../dom/DomUtil.js";
5
4
  import { Layer } from "../Layer.js";
6
5
  import { Bounds } from "../../geometry/Bounds.js";
7
6
  import { LatLngBounds } from "../../geo/LatLngBounds.js";
@@ -22,16 +21,13 @@ import { LatLngBounds } from "../../geo/LatLngBounds.js";
22
21
  * of tiles while they are loading, e.g. `'#ddd'` or
23
22
  * `'url(loading.svg) center no-repeat #eee'`. Tiles with a placeholder appear without
24
23
  * fading in.
25
- * @property {boolean} [updateWhenIdle] Load new tiles only when panning ends. Defaults
26
- * to `false` (tiles are loaded _during_ panning) unless the browser is configured for
27
- * reduced motion.
24
+ * @property {boolean} [updateWhenIdle=false] Load new tiles only when panning ends.
28
25
  * @property {boolean} [updateWhenZooming=true] By default, a smooth zoom animation
29
26
  * (during a [pinch zoom](#map-pinchzoom) or a [`flyTo()`](#map-flyto)) will update grid
30
27
  * layers every integer zoom level. Setting this option to `false` will update the grid
31
28
  * layer only when the smooth animation ends.
32
- * @property {number} [updateInterval] Tiles will not update more than once every
33
- * `updateInterval` milliseconds when panning. Defaults to `200`, increased to five
34
- * seconds if the browser is configured for reduced motion.
29
+ * @property {number} [updateInterval=200] Tiles will not update more than once every
30
+ * `updateInterval` milliseconds when panning.
35
31
  * @property {number} [zIndex=1] The explicit zIndex of the tile layer.
36
32
  * @property {LatLngBoundsExpression|null} [bounds=null] If set, tiles will only be
37
33
  * loaded inside the set `LatLngBounds`.
@@ -141,27 +137,25 @@ import { LatLngBounds } from "../../geo/LatLngBounds.js";
141
137
  * @fires load {MaplairEvent} Fired when the grid layer loaded all visible tiles.
142
138
  */
143
139
  var GridLayer = class GridLayer extends Layer {
144
- static {
145
- this.setDefaultOptions({
146
- tileSize: 256,
147
- opacity: 1,
148
- placeholder: null,
149
- updateWhenIdle: !Browser_default.reducedMotion,
150
- updateWhenZooming: true,
151
- updateInterval: Browser_default.reducedMotion ? 5e3 : 200,
152
- zIndex: 1,
153
- bounds: null,
154
- minZoom: 0,
155
- maxZoom: void 0,
156
- maxNativeZoom: void 0,
157
- minNativeZoom: void 0,
158
- noWrap: false,
159
- pane: "tilePane",
160
- className: "",
161
- pixelated: false,
162
- keepBuffer: 2
163
- });
164
- }
140
+ static defaultOptions = {
141
+ tileSize: 256,
142
+ opacity: 1,
143
+ placeholder: null,
144
+ updateWhenIdle: false,
145
+ updateWhenZooming: true,
146
+ updateInterval: 200,
147
+ zIndex: 1,
148
+ bounds: null,
149
+ minZoom: 0,
150
+ maxZoom: void 0,
151
+ maxNativeZoom: void 0,
152
+ minNativeZoom: void 0,
153
+ noWrap: false,
154
+ pane: "tilePane",
155
+ className: "",
156
+ pixelated: false,
157
+ keepBuffer: 2
158
+ };
165
159
  /**
166
160
  * Creates a new instance of GridLayer with the supplied options.
167
161
  * @param {GridLayerOptions} [options]
@@ -202,6 +196,8 @@ var GridLayer = class GridLayer extends Layer {
202
196
  this._container = null;
203
197
  this._tileZoom = void 0;
204
198
  clearTimeout(this._pruneTimeout);
199
+ cancelAnimationFrame(this._fadePruneFrame);
200
+ this._fadePruneFrame = 0;
205
201
  }
206
202
  /**
207
203
  * Brings the tile layer to the top of all tile layers.
@@ -266,7 +262,7 @@ var GridLayer = class GridLayer extends Layer {
266
262
  redraw() {
267
263
  if (this._map) {
268
264
  this._removeAllTiles();
269
- const tileZoom = this._clampZoom(this._map.getZoom());
265
+ const tileZoom = this._clampZoom(Math.round(this._map.getZoom()));
270
266
  if (tileZoom !== this._tileZoom) {
271
267
  this._tileZoom = tileZoom;
272
268
  this._updateLevels();
@@ -284,13 +280,14 @@ var GridLayer = class GridLayer extends Layer {
284
280
  viewprereset: this._invalidateAll,
285
281
  viewreset: this._resetView,
286
282
  zoom: this._resetView,
287
- moveend: this._onMoveEnd
283
+ moveend: this._onMoveEnd,
284
+ worldcopyjump: this._onWorldCopyJump,
285
+ zoomanim: this._animateZoom
288
286
  };
289
287
  if (!this.options.updateWhenIdle) {
290
288
  if (!this._onMove) this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this);
291
289
  events.move = this._onMove;
292
290
  }
293
- if (this._zoomAnimated) events.zoomanim = this._animateZoom;
294
291
  return events;
295
292
  }
296
293
  /**
@@ -316,7 +313,7 @@ var GridLayer = class GridLayer extends Layer {
316
313
  return s instanceof Point ? s : new Point(s, s);
317
314
  }
318
315
  _updateZIndex() {
319
- if (this._container && this.options.zIndex !== void 0 && this.options.zIndex !== null) this._container.style.zIndex = this.options.zIndex;
316
+ if (this._container && this.options.zIndex !== void 0 && this.options.zIndex !== null) this._container.style.zIndex = `${this.options.zIndex}`;
320
317
  }
321
318
  _setAutoZIndex(compare) {
322
319
  const layers = this.getPane().children;
@@ -332,25 +329,7 @@ var GridLayer = class GridLayer extends Layer {
332
329
  }
333
330
  _updateOpacity() {
334
331
  if (!this._map) return;
335
- this._container.style.opacity = this.options.opacity;
336
- const now = Date.now();
337
- let nextFrame = false, willPrune = false;
338
- for (const tile of Object.values(this._tiles ?? {})) {
339
- if (!tile.current || !tile.loaded) continue;
340
- const fade = tile.noFade ? 1 : Math.min(1, (now - tile.loaded) / 200);
341
- tile.el.style.opacity = fade;
342
- if (fade < 1) nextFrame = true;
343
- else {
344
- if (tile.active) willPrune = true;
345
- else this._onOpaqueTile(tile);
346
- tile.active = true;
347
- }
348
- }
349
- if (willPrune && !this._noPrune) this._pruneTiles();
350
- if (nextFrame) {
351
- cancelAnimationFrame(this._fadeFrame);
352
- this._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));
353
- }
332
+ this._container.style.opacity = `${this.options.opacity}`;
354
333
  }
355
334
  _onOpaqueTile() {}
356
335
  _initContainer() {
@@ -404,7 +383,7 @@ var GridLayer = class GridLayer extends Layer {
404
383
  for (let z of Object.keys(this._levels)) {
405
384
  z = Number(z);
406
385
  if (this._levels[z].el.children.length || z === zoom) {
407
- this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
386
+ this._levels[z].el.style.zIndex = `${maxZoom - Math.abs(zoom - z)}`;
408
387
  this._onUpdateLevel(z);
409
388
  } else {
410
389
  this._levels[z].el.remove();
@@ -418,7 +397,7 @@ var GridLayer = class GridLayer extends Layer {
418
397
  if (!level) {
419
398
  level = this._levels[zoom] = {};
420
399
  level.el = create("div", "maplair-tile-container maplair-zoom-animated", this._container);
421
- level.el.style.zIndex = maxZoom;
400
+ level.el.style.zIndex = `${maxZoom}`;
422
401
  level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();
423
402
  level.zoom = zoom;
424
403
  this._setZoomTransform(level, map.getCenter(), map.getZoom());
@@ -451,7 +430,9 @@ var GridLayer = class GridLayer extends Layer {
451
430
  _removeAllTiles() {
452
431
  for (const key of Object.keys(this._tiles)) this._removeTile(key);
453
432
  }
454
- _invalidateAll() {
433
+ _invalidateAll(e) {
434
+ const map = this._map;
435
+ if (e?.zoom !== void 0 && e.zoom !== map.getZoom() && map.getBounds().contains(e.center)) return;
455
436
  for (const z of Object.keys(this._levels)) {
456
437
  this._levels[z].el.remove();
457
438
  this._onRemoveLevel(Number(z));
@@ -461,27 +442,24 @@ var GridLayer = class GridLayer extends Layer {
461
442
  this._tileZoom = void 0;
462
443
  }
463
444
  _retainParent(x, y, z, minZoom) {
464
- const x2 = Math.floor(x / 2), y2 = Math.floor(y / 2), z2 = z - 1, coords2 = new Point(+x2, +y2);
465
- coords2.z = +z2;
466
- const key = this._tileCoordsToKey(coords2), tile = this._tiles[key];
467
- if (tile?.active) {
468
- tile.retain = true;
469
- return true;
470
- } else if (tile?.loaded) tile.retain = true;
471
- if (z2 > minZoom) return this._retainParent(x2, y2, z2, minZoom);
445
+ for (z--; z >= minZoom; z--) {
446
+ x = Math.floor(x / 2);
447
+ y = Math.floor(y / 2);
448
+ if (this._retain(x, y, z)) return true;
449
+ }
472
450
  return false;
473
451
  }
474
452
  _retainChildren(x, y, z, maxZoom) {
475
- for (let i = 2 * x; i < 2 * x + 2; i++) for (let j = 2 * y; j < 2 * y + 2; j++) {
476
- const coords = new Point(i, j);
477
- coords.z = z + 1;
478
- const key = this._tileCoordsToKey(coords), tile = this._tiles[key];
479
- if (tile?.active) {
480
- tile.retain = true;
481
- continue;
482
- } else if (tile?.loaded) tile.retain = true;
483
- if (z + 1 < maxZoom) this._retainChildren(i, j, z + 1, maxZoom);
484
- }
453
+ for (let i = 2 * x; i < 2 * x + 2; i++) for (let j = 2 * y; j < 2 * y + 2; j++) if (!this._retain(i, j, z + 1) && z + 1 < maxZoom) this._retainChildren(i, j, z + 1, maxZoom);
454
+ }
455
+ _retain(x, y, z) {
456
+ const tile = this._tiles[this._tileCoordsToKey({
457
+ x,
458
+ y,
459
+ z
460
+ })];
461
+ if (tile?.loaded) tile.retain = true;
462
+ return tile?.active;
485
463
  }
486
464
  _resetView(e) {
487
465
  const animating = e && (e.pinch || e.flyTo || e.continuous);
@@ -523,13 +501,26 @@ var GridLayer = class GridLayer extends Layer {
523
501
  const map = this._map, crs = map.options.crs, tileSize = this._tileSize = this.getTileSize(), tileZoom = this._tileZoom;
524
502
  const bounds = this._map.getPixelWorldBounds(this._tileZoom);
525
503
  if (bounds) this._globalTileRange = this._pxBoundsToTileRange(bounds);
526
- this._wrapX = crs.wrapLng && !this.options.noWrap && [Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x), Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)];
527
- this._wrapY = crs.wrapLat && !this.options.noWrap && [Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x), Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)];
504
+ this._wrapX = crs.wrapLng && !this.options.noWrap && [Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x), Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.x)];
505
+ this._wrapY = crs.wrapLat && !this.options.noWrap && [Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.y), Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)];
528
506
  }
529
507
  _onMoveEnd() {
530
508
  if (!this._map || this._map._animatingZoom) return;
531
509
  this._update();
532
510
  }
511
+ _onWorldCopyJump({ worlds }) {
512
+ if (!this._wrapX) return;
513
+ const tileSize = this.getTileSize(), tiles = {};
514
+ for (const tile of Object.values(this._tiles)) {
515
+ const { coords, el } = tile, dx = worlds * this._map.getPixelWorldBounds(coords.z).getSize().x;
516
+ if (dx % tileSize.x === 0) {
517
+ coords.x -= dx / tileSize.x;
518
+ setPosition(el, getPosition(el).subtract([dx, 0]), true);
519
+ }
520
+ tiles[this._tileCoordsToKey(coords)] = tile;
521
+ }
522
+ this._tiles = tiles;
523
+ }
533
524
  _getTiledPixelBounds(center) {
534
525
  const map = this._map, mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(), scale = map.getZoomScale(mapZoom, this._tileZoom), pixelCenter = map.project(center, this._tileZoom).floor(), halfSize = map.getSize().divideBy(scale * 2);
535
526
  return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));
@@ -580,9 +571,6 @@ var GridLayer = class GridLayer extends Layer {
580
571
  const tileBounds = this._tileCoordsToBounds(coords);
581
572
  return LatLngBounds.from(this.options.bounds).overlaps(tileBounds);
582
573
  }
583
- _keyToBounds(key) {
584
- return this._tileCoordsToBounds(this._keyToTileCoords(key));
585
- }
586
574
  _tileCoordsToNwSe(coords) {
587
575
  const map = this._map, tileSize = this.getTileSize(), nwPoint = coords.scaleBy(tileSize), sePoint = nwPoint.add(tileSize);
588
576
  return [map.unproject(nwPoint, coords.z), map.unproject(sePoint, coords.z)];
@@ -596,11 +584,6 @@ var GridLayer = class GridLayer extends Layer {
596
584
  _tileCoordsToKey(coords) {
597
585
  return `${coords.x}:${coords.y}:${coords.z}`;
598
586
  }
599
- _keyToTileCoords(key) {
600
- const k = key.split(":"), coords = new Point(+k[0], +k[1]);
601
- coords.z = +k[2];
602
- return coords;
603
- }
604
587
  _removeTile(key) {
605
588
  const tile = this._tiles[key];
606
589
  if (!tile) return;
@@ -608,7 +591,7 @@ var GridLayer = class GridLayer extends Layer {
608
591
  delete this._tiles[key];
609
592
  this.fire("tileunload", {
610
593
  tile: tile.el,
611
- coords: this._keyToTileCoords(key)
594
+ coords: tile.coords
612
595
  });
613
596
  }
614
597
  _initTile(tile) {
@@ -616,8 +599,6 @@ var GridLayer = class GridLayer extends Layer {
616
599
  const tileSize = this.getTileSize();
617
600
  tile.style.width = `${tileSize.x}px`;
618
601
  tile.style.height = `${tileSize.y}px`;
619
- tile.onselectstart = falseFn;
620
- tile.onpointermove = falseFn;
621
602
  if (this.options.placeholder) tile.style.background = this.options.placeholder;
622
603
  }
623
604
  _addTile(coords, container) {
@@ -625,7 +606,7 @@ var GridLayer = class GridLayer extends Layer {
625
606
  const tile = this.createTile(this._wrapCoords(coords), this._tileReady.bind(this, coords));
626
607
  this._initTile(tile);
627
608
  if (this.createTile.length < 2) requestAnimationFrame(this._tileReady.bind(this, coords, null, tile));
628
- setPosition(tile, tilePos);
609
+ setPosition(tile, tilePos, true);
629
610
  this._tiles[key] = {
630
611
  el: tile,
631
612
  coords,
@@ -646,19 +627,15 @@ var GridLayer = class GridLayer extends Layer {
646
627
  const key = this._tileCoordsToKey(coords);
647
628
  tile = this._tiles[key];
648
629
  if (!tile) return;
649
- tile.loaded = Date.now();
650
- if (this.options.placeholder) {
651
- tile.noFade = true;
652
- tile.el.style.background = "";
653
- }
654
- if (this._map._fadeAnimated && !tile.noFade) {
655
- tile.el.style.opacity = 0;
656
- cancelAnimationFrame(this._fadeFrame);
657
- this._fadeFrame = requestAnimationFrame(this._updateOpacity.bind(this));
658
- } else {
630
+ if (this.options.placeholder) tile.el.style.background = "";
631
+ if (!this._map._fadeAnimated || this.options.placeholder) {
659
632
  tile.active = true;
660
633
  this._pruneTiles();
634
+ } else if (!tile.loaded) {
635
+ tile.el.classList.add("maplair-tile-fading");
636
+ tile.el.animate({ opacity: [0, 1] }, 200).onfinish = this._onTileFaded.bind(this, tile);
661
637
  }
638
+ tile.loaded = true;
662
639
  if (!err) {
663
640
  tile.el.classList.add("maplair-tile-loaded");
664
641
  this.fire("tileload", {
@@ -674,6 +651,17 @@ var GridLayer = class GridLayer extends Layer {
674
651
  else this._pruneTimeout = setTimeout(this._pruneTiles.bind(this), 250);
675
652
  }
676
653
  }
654
+ _onTileFaded(tile) {
655
+ tile.el.classList.remove("maplair-tile-fading");
656
+ if (this._tiles[this._tileCoordsToKey(tile.coords)] !== tile) return;
657
+ tile.active = true;
658
+ this._onOpaqueTile(tile);
659
+ if (this._noPrune || this._fadePruneFrame) return;
660
+ this._fadePruneFrame = requestAnimationFrame(() => {
661
+ this._fadePruneFrame = 0;
662
+ if (!this._noPrune) this._pruneTiles();
663
+ });
664
+ }
677
665
  _getTilePos(coords) {
678
666
  return coords.scaleBy(this.getTileSize()).subtract(this._level.origin);
679
667
  }
@@ -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 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 Object.values(this._tiles).every(t => t.loaded);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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"}
1
+ {"version":3,"file":"GridLayer.js","names":["Util.throttle","DomUtil.create","DomUtil.getPosition","Util.wrapNum"],"sources":["../../../../src/layer/tile/GridLayer.js"],"sourcesContent":["import {Layer} from '../Layer.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=false] Load new tiles only when panning ends.\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=200] Tiles will not update more than once every\n * `updateInterval` milliseconds when panning.\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 defaultOptions = {\n\t\ttileSize: 256,\n\t\topacity: 1,\n\t\tplaceholder: null,\n\t\tupdateWhenIdle: false,\n\t\tupdateWhenZooming: true,\n\t\tupdateInterval: 200,\n\t\tzIndex: 1,\n\t\tbounds: null,\n\t\tminZoom: 0,\n\t\tmaxZoom: undefined,\n\t\tmaxNativeZoom: undefined,\n\t\tminNativeZoom: undefined,\n\t\tnoWrap: false,\n\t\tpane: 'tilePane',\n\t\tclassName: '',\n\t\tpixelated: false,\n\t\tkeepBuffer: 2\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\tcancelAnimationFrame(this._fadePruneFrame);\n\t\tthis._fadePruneFrame = 0;\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(Math.round(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\tworldcopyjump: this._onWorldCopyJump,\n\t\t\tzoomanim: this._animateZoom\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\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\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(e) {\n\t\t// a zoom without animation keeps the old levels until new tiles load, like the end of an animated one,\n\t\t// unless the view jumps somewhere else\n\t\tconst map = this._map;\n\t\tif (e?.zoom !== undefined && e.zoom !== map.getZoom() && map.getBounds().contains(e.center)) { return; }\n\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\tfor (z--; z >= minZoom; z--) {\n\t\t\tx = Math.floor(x / 2);\n\t\t\ty = Math.floor(y / 2);\n\t\t\tif (this._retain(x, y, z)) { return true; }\n\t\t}\n\t\treturn false;\n\t}\n\n\t_retainChildren(x, y, z, maxZoom) {\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\t\t\t\tif (!this._retain(i, j, z + 1) && 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// retains the tile if it's loaded; returns true if it's active, so there's no need to look further\n\t_retain(x, y, z) {\n\t\tconst tile = this._tiles[this._tileCoordsToKey({x, y, z})];\n\t\tif (tile?.loaded) { tile.retain = true; }\n\t\treturn tile?.active;\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 finished tile fades 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.x)\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.y),\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_onWorldCopyJump({worlds}) {\n\t\t// noWrap tiles cannot be reused in another world copy.\n\t\tif (!this._wrapX) { return; }\n\n\t\tconst tileSize = this.getTileSize(),\n\t\ttiles = {};\n\n\t\tfor (const tile of Object.values(this._tiles)) {\n\t\t\tconst {coords, el} = tile,\n\t\t\tdx = worlds * this._map.getPixelWorldBounds(coords.z).getSize().x;\n\n\t\t\t// tiles can't be shifted by a fraction of a column, so leave those to be reloaded\n\t\t\tif (dx % tileSize.x === 0) {\n\t\t\t\tcoords.x -= dx / tileSize.x;\n\t\t\t\tDomUtil.setPosition(el, DomUtil.getPosition(el).subtract([dx, 0]), true);\n\t\t\t}\n\t\t\ttiles[this._tileCoordsToKey(coords)] = tile;\n\t\t}\n\n\t\tthis._tiles = tiles;\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_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_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: tile.coords\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\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\t// 2D, so tiles raster into the level's layer: as separate layers they get compositor edge antialiasing,\n\t\t// and the overlapping edge ramps show as light seams under plus-lighter blending\n\t\tDomUtil.setPosition(tile, tilePos, true);\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\tif (this.options.placeholder) {\n\t\t\ttile.el.style.background = '';\n\t\t}\n\t\t// fading in with a placeholder would show the map below instead of the placeholder at first\n\t\tif (!this._map._fadeAnimated || this.options.placeholder) {\n\t\t\ttile.active = true;\n\t\t\tthis._pruneTiles();\n\t\t} else if (!tile.loaded) { // with errorTileUrl, a tile is ready twice (on error and on fallback load)\n\t\t\t// while fading, the tile is a compositor layer of its own where plus-lighter would light up its\n\t\t\t// antialiased edges, so it's blended normally until the fade ends\n\t\t\ttile.el.classList.add('maplair-tile-fading');\n\t\t\ttile.el.animate({opacity: [0, 1]}, 200).onfinish = this._onTileFaded.bind(this, tile);\n\t\t}\n\t\ttile.loaded = true;\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_onTileFaded(tile) {\n\t\ttile.el.classList.remove('maplair-tile-fading');\n\t\t// the tile's key may have changed after a world copy jump, so look it up again\n\t\tif (this._tiles[this._tileCoordsToKey(tile.coords)] !== tile) { return; }\n\n\t\ttile.active = true;\n\t\tthis._onOpaqueTile(tile);\n\n\t\t// one prune for all the tiles that finish fading in the same frame\n\t\tif (this._noPrune || this._fadePruneFrame) { return; }\n\t\tthis._fadePruneFrame = requestAnimationFrame(() => {\n\t\t\tthis._fadePruneFrame = 0;\n\t\t\tif (!this._noPrune) { this._pruneTiles(); }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4IA,IAAa,YAAb,MAAa,kBAAkB,MAAM;CAEpC,OAAO,iBAAiB;EACvB,UAAU;EACV,SAAS;EACT,aAAa;EACb,gBAAgB;EAChB,mBAAmB;EACnB,gBAAgB;EAChB,QAAQ;EACR,QAAQ;EACR,SAAS;EACT,SAAS,KAAA;EACT,eAAe,KAAA;EACf,eAAe,KAAA;EACf,QAAQ;EACR,MAAM;EACN,WAAW;EACX,WAAW;EACX,YAAY;CACb;;;;;CAMA,YAAY,SAAS;EACpB,MAAM;EACN,WAAgB,M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