Make followZoom optional

This commit is contained in:
James Lyne 2021-07-28 23:52:51 +01:00
parent b3f186a197
commit 8151dfaab5
3 changed files with 4 additions and 4 deletions

View File

@ -322,7 +322,7 @@ export default defineComponent({
if(map !== store.state.currentMap && (targetWorld !== currentWorld || newFollow)) { if(map !== store.state.currentMap && (targetWorld !== currentWorld || newFollow)) {
this.scheduledPan = player.location; this.scheduledPan = player.location;
if(newFollow) { if(newFollow && store.state.configuration.followZoom) {
console.log(`Setting zoom for new follow ${store.state.configuration.followZoom}`); console.log(`Setting zoom for new follow ${store.state.configuration.followZoom}`);
this.scheduledZoom = store.state.configuration.followZoom; this.scheduledZoom = store.state.configuration.followZoom;
} }
@ -332,7 +332,7 @@ export default defineComponent({
} else { } else {
this.leaflet!.panTo(store.state.currentMap?.locationToLatLng(player.location)); this.leaflet!.panTo(store.state.currentMap?.locationToLatLng(player.location));
if(newFollow) { if(newFollow && store.state.configuration.followZoom) {
console.log(`Setting zoom for new follow ${store.state.configuration.followZoom}`); console.log(`Setting zoom for new follow ${store.state.configuration.followZoom}`);
this.leaflet!.setZoom(store.state.configuration.followZoom); this.leaflet!.setZoom(store.state.configuration.followZoom);
} }

2
src/index.d.ts vendored
View File

@ -241,7 +241,7 @@ interface LiveAtlasServerConfig {
defaultWorld?: string; defaultWorld?: string;
defaultZoom: number; defaultZoom: number;
followMap?: string; followMap?: string;
followZoom: number; followZoom?: number;
title: string; title: string;
grayHiddenPlayers: boolean; grayHiddenPlayers: boolean;
expandUI: boolean; expandUI: boolean;

View File

@ -60,7 +60,7 @@ export default class DynmapMapProvider extends MapProvider {
defaultWorld: response.defaultworld || undefined, defaultWorld: response.defaultworld || undefined,
defaultZoom: response.defaultzoom || 0, defaultZoom: response.defaultzoom || 0,
followMap: response.followmap || undefined, followMap: response.followmap || undefined,
followZoom: response.followzoom || 0, followZoom: response.followzoom,
title: response.title.replace(titleColoursRegex, '') || 'Dynmap', title: response.title.replace(titleColoursRegex, '') || 'Dynmap',
expandUI: response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason expandUI: response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason
}; };