From f5002ed828ffb250bec6d7f30212396590974378 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 29 Jul 2021 14:14:01 +0100 Subject: [PATCH] Fix URL zoom being ignored on initial load (Fixes #59) --- src/components/Map.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index ea53818..5978978 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -178,6 +178,11 @@ export default defineComponent({ // Otherwise pan to url location, if present } else if(store.state.parsedUrl?.location) { location = store.state.parsedUrl.location; + + if(!oldValue) { + this.scheduledZoom = store.state.parsedUrl?.zoom || store.state.configuration.defaultZoom; + } + store.commit(MutationTypes.CLEAR_PARSED_URL, undefined); // Otherwise pan to world center } else { @@ -185,7 +190,7 @@ export default defineComponent({ } if(!oldValue) { - this.scheduledZoom = store.state.parsedUrl?.zoom || store.state.configuration.defaultZoom; + this.scheduledZoom = this.scheduledZoom || store.state.configuration.defaultZoom; } //Set pan location for when the projection changes