chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-03-06 16:21:55 +01:00
parent 8109c13b38
commit 297bb1c498
185 changed files with 2826 additions and 5874 deletions

File diff suppressed because it is too large Load diff

View file

@ -101,7 +101,11 @@ class SingleBackgroundHandler {
private async enable() {
let ttl = 15
await this.awaitStyleIsLoaded()
while (this._background.data.properties.id === this._targetLayer.properties.id && !this.tryEnable() && ttl > 0) {
while (
this._background.data.properties.id === this._targetLayer.properties.id &&
!this.tryEnable() &&
ttl > 0
) {
ttl--
await Utils.waitFor(250)
}
@ -147,7 +151,6 @@ class SingleBackgroundHandler {
console.log("UPDATING")
this._languageSupport.update()
})
} else {
map.addLayer(
{
@ -155,8 +158,8 @@ class SingleBackgroundHandler {
type: "raster",
source: background.id,
paint: {
"raster-opacity": 0
}
"raster-opacity": 0,
},
},
addLayerBeforeId
)
@ -213,7 +216,12 @@ export default class RasterLayerHandler {
background.addCallbackAndRunD((l) => {
const key = l.properties.id
if (!this._singleLayerHandlers[key]) {
this._singleLayerHandlers[key] = new SingleBackgroundHandler(map, l, background, this._languageSupport)
this._singleLayerHandlers[key] = new SingleBackgroundHandler(
map,
l,
background,
this._languageSupport
)
}
})
this._languageSupport = new ProtomapsLanguageSupport(map)
@ -225,7 +233,7 @@ export default class RasterLayerHandler {
if (layer.type === "vector") {
return {
type: "vector",
url: layer.url
url: layer.url,
}
}
return {
@ -237,7 +245,7 @@ export default class RasterLayerHandler {
minzoom: layer["min_zoom"] ?? 1,
maxzoom: layer["max_zoom"] ?? 25,
// Bit of a hack, but seems to work
scheme: layer.url.includes("{-y}") ? "tms" : "xyz"
scheme: layer.url.includes("{-y}") ? "tms" : "xyz",
}
}
@ -251,7 +259,7 @@ export default class RasterLayerHandler {
"{width}": "" + size,
"{height}": "" + size,
"{zoom}": "{z}",
"{-y}": "{y}"
"{-y}": "{y}",
}
for (const key in toReplace) {