From f86b30f37c07552c7d48bad03eb343dfc06c698a Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 28 May 2022 01:33:57 +1000 Subject: Avoid redundant relayout when initialising --- src/App.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index 0801124..3a5a733 100644 --- a/src/App.vue +++ b/src/App.vue @@ -639,7 +639,7 @@ export default defineComponent({ this.activeRoot = this.layoutTree; this.layoutMap = initLayoutMap(this.layoutTree); this.updateAreaDims().then(() => { - this.relayoutWithCollapse(); + this.relayoutWithCollapse(false); this.justInitialised = true; setTimeout(() => {this.justInitialised = false;}, this.uiOpts.tileChgDuration); }); @@ -695,13 +695,15 @@ export default defineComponent({ node.hasFocus = true; } }, - relayoutWithCollapse(){ + relayoutWithCollapse(secondPass = true){ + this.overflownRoot = false; tryLayout(this.activeRoot, [0,0], this.tileAreaDims, this.lytOpts, {allowCollapse: true, layoutMap: this.layoutMap}); - // Relayout again to allocate remaining tiles 'evenly' - tryLayout(this.activeRoot, [0,0], this.tileAreaDims, this.lytOpts, - {allowCollapse: false, layoutMap: this.layoutMap}); - this.overflownRoot = false; + if (secondPass){ + // Relayout again to allocate remaining tiles 'evenly' + tryLayout(this.activeRoot, [0,0], this.tileAreaDims, this.lytOpts, + {allowCollapse: false, layoutMap: this.layoutMap}); + } }, updateAreaDims(){ let mainAreaEl = this.$refs.mainArea as HTMLElement; @@ -755,7 +757,7 @@ export default defineComponent({ @detached-ancestor-click="onDetachedAncestorClick" @info-icon-click="onInfoIconClick"/>
-- cgit v1.2.3