From 0ad314aef43b1b10cacc577ebacd1f697016d00a Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 26 May 2022 13:31:33 +1000
Subject: Fix bug with searching-for-tile in ancestry-bar

---
 src/App.vue | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/App.vue')

diff --git a/src/App.vue b/src/App.vue
index f545e8f..4cc7aa0 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -410,16 +410,16 @@ export default defineComponent({
 			let layoutNode = this.layoutMap.get(ancestorName)!;
 			// If hidden, expand self/ancestor in ancestry-bar
 			if (layoutNode.hidden){
-				let visibleNode = layoutNode;
-				while (!this.detachedAncestors!.includes(visibleNode)){
-					visibleNode = visibleNode.parent!;
+				let nodeInAncestryBar = layoutNode;
+				while (!this.detachedAncestors!.includes(nodeInAncestryBar)){
+					nodeInAncestryBar = nodeInAncestryBar.parent!;
 				}
-				if (!this.uiOpts.jumpToSearchedNode){
-					this.onDetachedAncestorClick(visibleNode!);
+				if (!this.uiOpts.jumpToSearchedNode || nodeInAncestryBar.name == name){
+					this.onDetachedAncestorClick(nodeInAncestryBar!);
 					setTimeout(() => this.expandToNode(name), this.uiOpts.tileChgDuration);
 					return;
 				} else {
-					LayoutNode.showDownward(visibleNode);
+					LayoutNode.showDownward(nodeInAncestryBar);
 				}
 			}
 			// Attempt tile-expand
-- 
cgit v1.2.3

