From e2df6e256dd017760747bd0c982e7b2a489b0794 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 10 Mar 2022 23:45:46 +1100
Subject: Fix a few layout bugs

---
 src/components/TileTree.vue | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/components/TileTree.vue')

diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue
index 1c7d593..debf77a 100644
--- a/src/components/TileTree.vue
+++ b/src/components/TileTree.vue
@@ -47,7 +47,7 @@ export default {
 			if (!this.resizeThrottled){
 				this.width = document.documentElement.clientWidth;
 				this.height = document.documentElement.clientHeight;
-				this.tryLayout(); //use best-effort collapsing-layout?
+				this.tryLayout();
 				//prevent re-triggering until after a delay
 				this.resizeThrottled = true;
 				setTimeout(() => {this.resizeThrottled = false;}, 100);
@@ -71,9 +71,11 @@ export default {
 				nodeList[0].children = [];
 		},
 		onInnerHeaderClicked(nodeList){ //nodeList is array of tree-objects, from clicked-on-tile's tree-object upward
+			let children = nodeList[0].children;
 			nodeList[0].children = [];
 			layoutInfoHooks.updateLayoutInfoOnCollapse(nodeList);
-			this.tryLayout();
+			if (!this.tryLayout())
+				nodeList[0].children = children;
 		},
 		tryLayout(){
 			let layout = LAYOUT_FUNC(this.tree, 0, 0, this.width, this.height, true);
-- 
cgit v1.2.3

