fixup: fix tilelayer switch not saved anymore

Since map split.
This commit is contained in:
Yohan Boniface 2024-12-16 17:00:43 +01:00
parent fe06a0ff8e
commit ce765efefc
2 changed files with 6 additions and 7 deletions

View file

@ -233,12 +233,8 @@ const ManageTilelayerMixin = {
},
updateTileLayers: function () {
const callback = (tilelayer) => {
this.options.tilelayer = tilelayer.toJSON()
this._umap.isDirty = true
}
if (this._controls.tilelayersChooser) {
this._controls.tilelayersChooser.openSwitcher({ callback, edit: true })
this._controls.tilelayersChooser.openSwitcher({ edit: true })
}
},
}

View file

@ -683,10 +683,13 @@ U.TileLayerChooser = L.Control.extend({
L.DomEvent.on(
el,
'click',
function () {
() => {
this.map.selectTileLayer(tilelayer)
this.map._controls.tilelayers.setLayers()
if (options?.callback) options.callback(tilelayer)
if (options?.edit) {
this.map._umap.properties.tilelayer = tilelayer.toJSON()
this.map._umap.isDirty = true
}
},
this
)