chore: do not display zoom alert on save

This commit is contained in:
David Larlet 2024-06-12 12:54:58 -04:00
parent 6bbdec49bf
commit e1f91b393d
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
2 changed files with 8 additions and 8 deletions

View file

@ -84,7 +84,7 @@ U.UpdateExtentAction = U.BaseAction.extend({
}, },
addHooks: function () { addHooks: function () {
this.map.updateExtent() this.map.setCenterAndZoom()
}, },
}) })

View file

@ -828,16 +828,16 @@ U.Map = L.Map.extend({
return this.getDefaultOption(option) return this.getDefaultOption(option)
}, },
updateExtent: function () { setCenterAndZoom: function () {
this._setCenterAndZoom()
U.Alert.info(L._('The zoom and center have been modified.'))
},
_setCenterAndZoom: function () {
this.options.center = this.getCenter() this.options.center = this.getCenter()
this.options.zoom = this.getZoom() this.options.zoom = this.getZoom()
this.isDirty = true this.isDirty = true
this._default_extent = false this._default_extent = false
if (this.options.umap_id) {
// We do not want an extra message during the map creation
// to avoid the double notification/alert.
U.Alert.info(L._('The zoom and center have been modified.'))
}
}, },
updateTileLayers: function () { updateTileLayers: function () {
@ -1096,7 +1096,7 @@ U.Map = L.Map.extend({
save: function () { save: function () {
if (!this.isDirty) return if (!this.isDirty) return
if (this._default_extent) this.updateExtent() if (this._default_extent) this._setCenterAndZoom()
this.backup() this.backup()
this.once('saved', () => { this.once('saved', () => {
this.isDirty = false this.isDirty = false