From cbd6c7f3b908312c2f294de631a38caa202ee74b Mon Sep 17 00:00:00 2001 From: James Lyne Date: Fri, 10 Dec 2021 15:54:55 +0000 Subject: [PATCH] Handle pl3xmap world default zoom --- src/components/Map.vue | 4 ++-- src/index.d.ts | 1 + src/providers/Pl3xmapMapProvider.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index fae097e..4cafb57 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -189,7 +189,7 @@ export default defineComponent({ location = store.state.parsedUrl.location; if(!oldValue) { - this.scheduledZoom = store.state.parsedUrl?.zoom || store.state.configuration.defaultZoom; + this.scheduledZoom = store.state.parsedUrl?.zoom || newValue.defaultZoom || store.state.configuration.defaultZoom; } store.commit(MutationTypes.CLEAR_PARSED_URL, undefined); @@ -198,7 +198,7 @@ export default defineComponent({ location = newValue.center; } - this.scheduledZoom = this.scheduledZoom || store.state.configuration.defaultZoom; + this.scheduledZoom = this.scheduledZoom || newValue.defaultZoom || store.state.configuration.defaultZoom; //Set pan location for when the projection changes this.scheduledPan = location; diff --git a/src/index.d.ts b/src/index.d.ts index 7e47afa..7377c60 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -182,6 +182,7 @@ interface LiveAtlasWorldDefinition { displayName: string; dimension: LiveAtlasDimension; center: Coordinate; + defaultZoom?: number; maps: Map; } diff --git a/src/providers/Pl3xmapMapProvider.ts b/src/providers/Pl3xmapMapProvider.ts index d71b829..e6bf5f3 100644 --- a/src/providers/Pl3xmapMapProvider.ts +++ b/src/providers/Pl3xmapMapProvider.ts @@ -150,6 +150,7 @@ export default class Pl3xmapMapProvider extends MapProvider { dimension, seaLevel: 0, center: {x: worldResponse.spawn.x, y: 0, z: worldResponse.spawn.z}, + defaultZoom: worldResponse.zoom.def || 1, maps, };