Fix scheduledZoom/scheduledPan handling on map change

This commit is contained in:
James Lyne 2021-07-24 15:19:02 +01:00
parent 0c1ca36be1
commit e46a97df15

View File

@ -139,8 +139,14 @@ export default defineComponent({
} }
}, },
currentMap(newValue, oldValue) { currentMap(newValue, oldValue) {
if(this.leaflet && newValue && oldValue) { if(this.leaflet && newValue) {
const panTarget = this.scheduledPan || oldValue.latLngToLocation(this.leaflet.getCenter(), 64); let panTarget = this.scheduledPan;
if(!panTarget && oldValue) {
panTarget = oldValue.latLngToLocation(this.leaflet.getCenter(), 64);
} else if(!panTarget) {
panTarget = {x: 0, y: 0, z: 0};
}
if(this.scheduledZoom) { if(this.scheduledZoom) {
this.leaflet!.setZoom(this.scheduledZoom, { this.leaflet!.setZoom(this.scheduledZoom, {