Fix vector layers, fix #1652 again

This commit is contained in:
Pieter Vander Vennet 2024-03-21 22:04:55 +01:00
parent 8dd042c4f7
commit aaad4ac72c

View file

@ -127,13 +127,8 @@ class SingleBackgroundHandler {
.layers.find((l) => l.id.startsWith("mapcomplete_"))?.id .layers.find((l) => l.id.startsWith("mapcomplete_"))?.id
if (background.type === "vector") { if (background.type === "vector") {
if(background.style){ map.setStyle(background.style ?? background.url)
map.setStyle(background.style)
} else { } else {
map.setStyle(AvailableRasterLayers.maptilerDefaultLayer.properties.style)
}
} else {
map.addLayer( map.addLayer(
{ {
id: background.id, id: background.id,
@ -150,6 +145,7 @@ class SingleBackgroundHandler {
map.setPaintProperty(background.id, "raster-opacity", o) map.setPaintProperty(background.id, "raster-opacity", o)
}catch (e) { }catch (e) {
console.debug("Could not set raster-opacity of", background.id) console.debug("Could not set raster-opacity of", background.id)
return true // This layer probably doesn't exist anymore, so we unregister
} }
}) })
} }