From 0f86d9ba58e7c3395752eb21672c98df48b25f61 Mon Sep 17 00:00:00 2001 From: Zsolt Viczian Date: Sun, 14 Aug 2022 21:22:52 +0200 Subject: [PATCH] 0.1.7 --- manifest.json | 4 ++-- src/Scene.ts | 9 +++++++++ versions.json | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index c5819b9..b54d7d0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "excalibrain", "name": "ExcaliBrain", - "version": "0.1.6", - "minAppVersion": "0.15.5", + "version": "0.1.7", + "minAppVersion": "0.15.6", "description": "A clean, intuitive and editable graph view for Obsidian", "author": "Zsolt Viczian", "authorUrl": "https://zsolt.blog", diff --git a/src/Scene.ts b/src/Scene.ts index d3182d9..f2eecbf 100644 --- a/src/Scene.ts +++ b/src/Scene.ts @@ -39,6 +39,7 @@ export class Scene { public vaultFileChanged: boolean = false; public pinLeaf: boolean = false; public focusSearchAfterInitiation: boolean = true; + private zoomToFitOnNextBrainLeafActivate: boolean = false; //this addresses the issue caused in Obsidian 0.16.0 when the brain graph is rendered while the leaf is hidden because tab is not active constructor(plugin: ExcaliBrain, newLeaf: boolean, leaf?: WorkspaceLeaf) { this.ea = plugin.EA; @@ -304,6 +305,7 @@ export class Scene { }); } + private async render() { if(this.historyPanel) { this.historyPanel.rerender() @@ -319,6 +321,8 @@ export class Scene { const ea = this.ea; + this.zoomToFitOnNextBrainLeafActivate = !ea.targetView.containerEl.isShown(); + ea.clear(); ea.getExcalidrawAPI().updateScene({elements:[]}); ea.style.verticalAlign = "middle"; @@ -609,8 +613,13 @@ export class Scene { if (rootFile.path === self.ea.targetView.file.path) { //brainview drawing is the active leaf if(this.vaultFileChanged) { + this.zoomToFitOnNextBrainLeafActivate = false; await this.reRender(true); } + if(this.zoomToFitOnNextBrainLeafActivate) { + this.zoomToFitOnNextBrainLeafActivate = false; + self.ea.getExcalidrawAPI().zoomToFit(null, 5, 0.15); + } self.blockUpdateTimer = false; return; } diff --git a/versions.json b/versions.json index 31e9dc2..264be37 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "0.1.7": "0.15.6", "0.1.6": "0.15.5", "0.1.3": "0.15.3", "0.1.0": "0.15.2",