From 980141ccbaa3e913fd3aba4eea25d3615b8bc1fc Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 23 Dec 2021 16:43:14 +0000 Subject: [PATCH] Fix zoom level 0 being ignored in url and map default zoom --- src/components/Map.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index 4cafb57..744a5e0 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -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;