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) {
if(this.leaflet && newValue && oldValue) {
const panTarget = this.scheduledPan || oldValue.latLngToLocation(this.leaflet.getCenter(), 64);
if(this.leaflet && newValue) {
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) {
this.leaflet!.setZoom(this.scheduledZoom, {