Cleanup url getter

This commit is contained in:
James Lyne 2022-01-14 19:53:37 +00:00
parent 46fc602a96
commit 8382142cb2
2 changed files with 2 additions and 7 deletions

View File

@ -68,16 +68,11 @@ export const getters: GetterTree<State, State> & Getters = {
}, },
url(state: State): string { url(state: State): string {
const x = state.currentLocation.x,
y = state.currentLocation.y,
z = state.currentLocation.z,
zoom = state.currentZoom;
if(!state.currentWorld || !state.currentMap) { if(!state.currentWorld || !state.currentMap) {
return ''; return '';
} }
return getUrlForLocation(state.currentMap, {x,y,z}, zoom); return getUrlForLocation(state.currentMap, state.currentLocation, state.currentZoom);
}, },
pageTitle(state: State): string { pageTitle(state: State): string {

View File

@ -193,7 +193,7 @@ const validateParsedUrl = (parsed: any) => {
export const getUrlForLocation = (map: LiveAtlasMapDefinition, location: Coordinate, zoom: number): string => { export const getUrlForLocation = (map: LiveAtlasMapDefinition, location: Coordinate, zoom: number): string => {
const x = Math.round(location.x), const x = Math.round(location.x),
y = Math.round(location.y || 0), y = Math.round(location.y),
z = Math.round(location.z), z = Math.round(location.z),
locationString = `${x},${y},${z}`; locationString = `${x},${y},${z}`;