From 1c4531f70a4f112b7a38e4a11c64a67440e46cff Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 9 Nov 2020 08:09:05 +0100 Subject: [PATCH] Update map extent on first save if it still default one cf #841 --- umap/static/umap/js/umap.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 34fe2f95..d5f55c52 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -178,6 +178,7 @@ L.U.Map.include({ // Creation mode if (!this.options.umap_id) { this.isDirty = true; + this._default_extent = true; this.options.name = L._('Untitled map'); this.options.allowEdit = true; var datalayer = this.createDataLayer(); @@ -578,6 +579,7 @@ L.U.Map.include({ this.options.center = this.getCenter(); this.options.zoom = this.getZoom(); this.isDirty = true; + this._default_extent = false; this.ui.alert({content: L._('The zoom and center have been set.'), 'level': 'info'}); }, @@ -1089,6 +1091,7 @@ L.U.Map.include({ save: function () { if (!this.isDirty) return; + if (this._default_extent) this.updateExtent(); var geojson = { type: 'Feature', geometry: this.geometry(),