diff --git a/src/map-renderer.ts b/src/map-renderer.ts index d8dcb6d..110dc31 100644 --- a/src/map-renderer.ts +++ b/src/map-renderer.ts @@ -378,7 +378,7 @@ export function updateMapPoints(deck: Deck, points: MapPoint[], c const hasConfiguredCenter = options.center && (options.center[0] !== 0 || options.center[1] !== 0); - if (autoCenter && hasConfiguredCenter && options.zoom) { + if (hasConfiguredCenter && options.zoom) { if (!options.center) return; shouldTransition = true; targetViewState = { diff --git a/src/views/map-bases-view.ts b/src/views/map-bases-view.ts index e61a28c..5a30453 100644 --- a/src/views/map-bases-view.ts +++ b/src/views/map-bases-view.ts @@ -336,11 +336,11 @@ export class MapBasesView extends BasesView { const configChanged = this.hasConfigMeaningfullyChanged(); this.lastConfigState = { ...this.config.data }; - - const shouldAutoCenter = this.plugin.settings.autoCenter && (autofit === true || (autofit === undefined && (locationsChanged || configChanged))); - this.lastPoints = points; + const shouldAutoCenter = this.plugin.settings.autoCenter && !hasConfiguredCenter && (autofit === true || (autofit === undefined && (locationsChanged || configChanged))); + const shouldUseConfiguredCenter = hasConfiguredCenter && (autofit !== false); //TODO: slight hack + updateMapPoints(this.deck, points, { containerEl: this.mapEl, app: this.app, @@ -348,8 +348,8 @@ export class MapBasesView extends BasesView { tagSettings: this.plugin.tagSettings, options: { markerType: this.getMarkerType(), - center: hasConfiguredCenter ? center : undefined, - zoom: hasConfiguredCenter ? this.getDefaultZoom() : undefined, + center: shouldUseConfiguredCenter ? center : undefined, + zoom: shouldUseConfiguredCenter ? this.getDefaultZoom() : undefined, autoCenter: shouldAutoCenter } });