fix(sync): fix tilelayer change not synced (#2569)

This commit is contained in:
Yohan Boniface 2025-03-12 17:39:19 +01:00 committed by GitHub
commit c417e94698
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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