diff --git a/umap/static/umap/js/modules/rendering/map.js b/umap/static/umap/js/modules/rendering/map.js index 1a7c01a4..e3f940ee 100644 --- a/umap/static/umap/js/modules/rendering/map.js +++ b/umap/static/umap/js/modules/rendering/map.js @@ -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() diff --git a/umap/static/umap/js/modules/sync/updaters.js b/umap/static/umap/js/modules/sync/updaters.js index 9aab90f8..e6055091 100644 --- a/umap/static/umap/js/modules/sync/updaters.js +++ b/umap/static/umap/js/modules/sync/updaters.js @@ -47,6 +47,7 @@ export class MapUpdater extends BaseUpdater { this.updateObjectValue(this._umap, key, value) } + this._umap.onPropertiesUpdated([key]) this._umap.render([key]) } } diff --git a/umap/static/umap/js/modules/umap.js b/umap/static/umap/js/modules/umap.js index 1648f1fe..9d50a813 100644 --- a/umap/static/umap/js/modules/umap.js +++ b/umap/static/umap/js/modules/umap.js @@ -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 diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 3819715a..e97ae5f5 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -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