All per-map default zoom

This commit is contained in:
James Lyne 2022-02-23 14:31:31 +00:00
parent 61194c9c99
commit c4f2d106bf
3 changed files with 15 additions and 7 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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<LiveAtlasMapDefinition>(),
});
});
@ -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({