mirror of
https://github.com/ccmdi/obsidian-map-plus.git
synced 2026-07-22 06:43:14 +00:00
fix: handle autofit for configured center properly
This commit is contained in:
parent
3a3940ddd5
commit
b839de62d2
2 changed files with 6 additions and 6 deletions
|
|
@ -378,7 +378,7 @@ export function updateMapPoints(deck: Deck<MapViewType[]>, 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 = {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue