From 61b2a59e2a7fd1994969ea92c00930237b38682d Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 23 Feb 2022 13:57:41 +0000 Subject: [PATCH] All per-map center points --- src/components/Map.vue | 2 +- src/model/LiveAtlasMapDefinition.ts | 3 +++ src/providers/OverviewerMapProvider.ts | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index be7aa1f..8b3efde 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -205,7 +205,7 @@ export default defineComponent({ store.commit(MutationTypes.CLEAR_PARSED_URL, undefined); // Otherwise pan to world center } else { - viewTarget.location = newValue.center; + viewTarget.location = store.state.currentMap?.center || newValue.center; } if(viewTarget.zoom == null) { diff --git a/src/model/LiveAtlasMapDefinition.ts b/src/model/LiveAtlasMapDefinition.ts index d930b94..acbdb7c 100644 --- a/src/model/LiveAtlasMapDefinition.ts +++ b/src/model/LiveAtlasMapDefinition.ts @@ -35,6 +35,7 @@ export interface LiveAtlasMapDefinitionOptions { nativeZoomLevels: number; extraZoomLevels: number; tileUpdateInterval?: number; + center?: Coordinate; } export default class LiveAtlasMapDefinition { @@ -55,6 +56,7 @@ export default class LiveAtlasMapDefinition { readonly extraZoomLevels: number; readonly scale: number; readonly tileUpdateInterval?: number; + readonly center?: Coordinate; constructor(options: LiveAtlasMapDefinitionOptions) { this.world = options.world; @@ -77,6 +79,7 @@ export default class LiveAtlasMapDefinition { this.extraZoomLevels = options.extraZoomLevels || 0; this.scale = (1 / Math.pow(2, this.nativeZoomLevels)); this.tileUpdateInterval = options.tileUpdateInterval || undefined; + this.center = options.center || undefined; } locationToLatLng(location: Coordinate): LatLng { diff --git a/src/providers/OverviewerMapProvider.ts b/src/providers/OverviewerMapProvider.ts index 0e0b215..4befe85 100644 --- a/src/providers/OverviewerMapProvider.ts +++ b/src/providers/OverviewerMapProvider.ts @@ -132,6 +132,11 @@ export default class OverviewerMapProvider extends MapProvider { nativeZoomLevels, tileSize, }), + center: { + x: tileset?.center[0] || 0, + y: tileset?.center[1] || 0, + z: tileset?.center[2] || 0, + } })); this.mapMarkerSets.set(tileset.path, new Map());