mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: do not add auto zoom and center in undo stack (#2602)
This commit is contained in:
commit
2967c023f3
1 changed files with 8 additions and 6 deletions
|
@ -1742,21 +1742,23 @@ export default class Umap {
|
||||||
}
|
}
|
||||||
|
|
||||||
setCenterAndZoom() {
|
setCenterAndZoom() {
|
||||||
this._setCenterAndZoom()
|
this._setCenterAndZoom(true)
|
||||||
Alert.success(translate('The zoom and center have been modified.'))
|
Alert.success(translate('The zoom and center have been modified.'))
|
||||||
}
|
}
|
||||||
|
|
||||||
_setCenterAndZoom() {
|
_setCenterAndZoom(manual) {
|
||||||
const oldCenter = { ...this.properties.center }
|
const oldCenter = { ...this.properties.center }
|
||||||
const oldZoom = this.properties.zoom
|
const oldZoom = this.properties.zoom
|
||||||
this.properties.center = this._leafletMap.getCenter()
|
this.properties.center = this._leafletMap.getCenter()
|
||||||
this.properties.zoom = this._leafletMap.getZoom()
|
this.properties.zoom = this._leafletMap.getZoom()
|
||||||
this._defaultExtent = false
|
this._defaultExtent = false
|
||||||
|
if (manual) {
|
||||||
this.sync.startBatch()
|
this.sync.startBatch()
|
||||||
this.sync.update('properties.center', this.properties.center, oldCenter)
|
this.sync.update('properties.center', this.properties.center, oldCenter)
|
||||||
this.sync.update('properties.zoom', this.properties.zoom, oldZoom)
|
this.sync.update('properties.zoom', this.properties.zoom, oldZoom)
|
||||||
this.sync.commitBatch()
|
this.sync.commitBatch()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getStaticPathFor(name) {
|
getStaticPathFor(name) {
|
||||||
return SCHEMA.iconUrl.default.replace('marker.svg', name)
|
return SCHEMA.iconUrl.default.replace('marker.svg', name)
|
||||||
|
|
Loading…
Reference in a new issue