fix: do not add auto zoom and center in undo stack (#2602)

This commit is contained in:
Yohan Boniface 2025-04-04 18:23:31 +02:00 committed by GitHub
commit 2967c023f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1742,20 +1742,22 @@ export default class Umap {
}
setCenterAndZoom() {
this._setCenterAndZoom()
this._setCenterAndZoom(true)
Alert.success(translate('The zoom and center have been modified.'))
}
_setCenterAndZoom() {
_setCenterAndZoom(manual) {
const oldCenter = { ...this.properties.center }
const oldZoom = this.properties.zoom
this.properties.center = this._leafletMap.getCenter()
this.properties.zoom = this._leafletMap.getZoom()
this._defaultExtent = false
this.sync.startBatch()
this.sync.update('properties.center', this.properties.center, oldCenter)
this.sync.update('properties.zoom', this.properties.zoom, oldZoom)
this.sync.commitBatch()
if (manual) {
this.sync.startBatch()
this.sync.update('properties.center', this.properties.center, oldCenter)
this.sync.update('properties.zoom', this.properties.zoom, oldZoom)
this.sync.commitBatch()
}
}
getStaticPathFor(name) {