Fix zoom level 0 being ignored in url and map default zoom

This commit is contained in:
James Lyne 2021-12-23 16:43:14 +00:00
parent 89617f61a4
commit 980141ccba

View File

@ -189,7 +189,13 @@ export default defineComponent({
location = store.state.parsedUrl.location;
if(!oldValue) {
this.scheduledZoom = store.state.parsedUrl?.zoom || newValue.defaultZoom || store.state.configuration.defaultZoom;
if(typeof store.state.parsedUrl?.zoom !== 'undefined') {
this.scheduledZoom = store.state.parsedUrl?.zoom;
} else if(typeof newValue.defaultZoom !== 'undefined') {
this.scheduledZoom = newValue.defaultZoom;
} else {
this.scheduledZoom = store.state.configuration.defaultZoom;
}
}
store.commit(MutationTypes.CLEAR_PARSED_URL, undefined);
@ -198,7 +204,13 @@ export default defineComponent({
location = newValue.center;
}
this.scheduledZoom = this.scheduledZoom || newValue.defaultZoom || store.state.configuration.defaultZoom;
if(typeof this.scheduledZoom === 'undefined') {
if(typeof newValue.defaultZoom !== 'undefined') {
this.scheduledZoom = newValue.defaultZoom;
} else {
this.scheduledZoom = store.state.configuration.defaultZoom;
}
}
//Set pan location for when the projection changes
this.scheduledPan = location;