fix: fix tilelayer change not synced

Co-authored-by: Alexis Métaireau <alexis@notmyidea.org>
This commit is contained in:
Yohan Boniface 2025-03-12 13:01:26 +01:00
parent d85fc648b1
commit e20648104b
4 changed files with 14 additions and 1 deletions

View file

@ -269,8 +269,12 @@ export const LeafletMap = BaseMap.extend({
this.renderUI()
},
renderUI: function () {
pullProperties() {
setOptions(this, this._umap.properties)
},
renderUI: function () {
this.pullProperties()
if (this.options.scrollWheelZoom) {
this.scrollWheelZoom.enable()
this.dragging.enable()

View file

@ -47,6 +47,7 @@ export class MapUpdater extends BaseUpdater {
this.updateObjectValue(this._umap, key, value)
}
this._umap.onPropertiesUpdated([key])
this._umap.render([key])
}
}

View file

@ -1329,6 +1329,10 @@ export default class Umap extends ServerStored {
}
}
onPropertiesUpdated(fields = []) {
this._leafletMap.pullProperties()
}
render(fields = []) {
// Propagate will remove the fields it has already
// processed

View file

@ -302,6 +302,10 @@ U.TileLayerChooser = L.Control.extend({
if (options?.edit) {
this.map._umap.properties.tilelayer = tilelayer.toJSON()
this.map._umap.isDirty = true
this.map._umap.sync.update(
'properties.tilelayer',
this.map._umap.properties.tilelayer
)
}
},
this