diff --git a/src/components/Map.vue b/src/components/Map.vue index 8b3efde..fbc206c 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -192,12 +192,15 @@ export default defineComponent({ } else if(store.state.parsedUrl?.location) { viewTarget.location = store.state.parsedUrl.location; + //Determine initial zoom if(!oldValue) { - if(typeof store.state.parsedUrl?.zoom !== 'undefined') { + if(typeof store.state.parsedUrl?.zoom !== 'undefined') { //Zoom from URL viewTarget.zoom = store.state.parsedUrl?.zoom; - } else if(typeof newValue.defaultZoom !== 'undefined') { + } else if(typeof store.state.currentMap?.defaultZoom !== 'undefined') { //Map default zoom + viewTarget.zoom = store.state.currentMap?.defaultZoom; + }else if(typeof newValue.defaultZoom !== 'undefined') { //World default zoom viewTarget.zoom = newValue.defaultZoom; - } else { + } else { //Global default zoom viewTarget.zoom = store.state.configuration.defaultZoom; } } @@ -209,9 +212,11 @@ export default defineComponent({ } if(viewTarget.zoom == null) { - if(typeof newValue.defaultZoom !== 'undefined') { + if(typeof store.state.currentMap?.defaultZoom !== 'undefined') { //Map default zoom + viewTarget.zoom = store.state.currentMap?.defaultZoom; + } else if(typeof newValue.defaultZoom !== 'undefined') { //World default zoom viewTarget.zoom = newValue.defaultZoom; - } else { + } else { //Global default zoom viewTarget.zoom = store.state.configuration.defaultZoom; } } diff --git a/src/model/LiveAtlasMapDefinition.ts b/src/model/LiveAtlasMapDefinition.ts index acbdb7c..6197e7e 100644 --- a/src/model/LiveAtlasMapDefinition.ts +++ b/src/model/LiveAtlasMapDefinition.ts @@ -34,6 +34,7 @@ export interface LiveAtlasMapDefinitionOptions { projection?: LiveAtlasProjection; nativeZoomLevels: number; extraZoomLevels: number; + defaultZoom?: number; tileUpdateInterval?: number; center?: Coordinate; } @@ -54,6 +55,7 @@ export default class LiveAtlasMapDefinition { readonly projection?: LiveAtlasProjection; readonly nativeZoomLevels: number; readonly extraZoomLevels: number; + readonly defaultZoom?: number; readonly scale: number; readonly tileUpdateInterval?: number; readonly center?: Coordinate; @@ -77,6 +79,7 @@ export default class LiveAtlasMapDefinition { this.nativeZoomLevels = options.nativeZoomLevels || 1; this.extraZoomLevels = options.extraZoomLevels || 0; + this.defaultZoom = options.defaultZoom || 0; this.scale = (1 / Math.pow(2, this.nativeZoomLevels)); this.tileUpdateInterval = options.tileUpdateInterval || undefined; this.center = options.center || undefined; diff --git a/src/providers/OverviewerMapProvider.ts b/src/providers/OverviewerMapProvider.ts index 4befe85..67651e6 100644 --- a/src/providers/OverviewerMapProvider.ts +++ b/src/providers/OverviewerMapProvider.ts @@ -61,7 +61,7 @@ export default class OverviewerMapProvider extends MapProvider { //Not used by overviewer expandUI: false, - defaultZoom: 1, + defaultZoom: 0, defaultMap: undefined, defaultWorld: undefined, followMap: undefined, @@ -95,7 +95,6 @@ export default class OverviewerMapProvider extends MapProvider { dimension: 'overworld' as LiveAtlasDimension, seaLevel: 64, center: {x: 0, y: 64, z: 0}, - defaultZoom: undefined, maps: new Set(), }); }); @@ -122,6 +121,7 @@ export default class OverviewerMapProvider extends MapProvider { imageFormat: tileset.imgextension, nativeZoomLevels, extraZoomLevels: 0, + defaultZoom: tileset.defaultZoom, tileSize, prefix: tileset.base, projection: new OverviewerProjection({