diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-07-09 15:00:34 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-07-09 15:02:31 +1000 |
| commit | f1f16687492102ccf8de3eaeda682c154518c321 (patch) | |
| tree | 1526288e7681e9f65fd552394c0ab68076dbe5df | |
| parent | 2fd138563bb0c017a1072e79fe78e6479086e9d1 (diff) | |
Fix jump-to-overflowing after startup producing collapsed node
Turns out the closing of the tutorial-pane triggered a
relayoutWithCollapse() which collapsed the node.
| -rw-r--r-- | src/App.vue | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/App.vue b/src/App.vue index 784b15d..6dc5440 100644 --- a/src/App.vue +++ b/src/App.vue @@ -544,11 +544,15 @@ export default defineComponent({ // Expand-to-view on target-node's parent targetNode = this.layoutMap.get(name); if (targetNode!.parent != this.activeRoot){ - await this.onLeafClickHeld(targetNode!.parent!, true); + // Hide ancestors + LayoutNode.hideUpward(targetNode.parent, this.layoutMap); + this.activeRoot = targetNode.parent; + await this.onNonleafClick(this.activeRoot, true); + await this.onLeafClick(this.activeRoot, true); } else { - await this.onLeafClick(targetNode!.parent!, true); + await this.onLeafClick(this.activeRoot, true); } - setTimeout(() => this.setLastFocused(targetNode!), this.uiOpts.transitionDuration); + setTimeout(() => this.setLastFocused(this.layoutMap.get(name)), this.uiOpts.transitionDuration); this.modeRunning = null; return; } @@ -741,7 +745,7 @@ export default defineComponent({ this.tutWelcome = false; this.uiOpts.disabledActions.clear(); this.updateAreaDims(); - this.relayoutWithCollapse(); + this.relayoutWithCollapse(true, true); }, onTutStageChg(triggerAction: Action | null): void { this.tutWelcome = false; @@ -949,11 +953,17 @@ export default defineComponent({ return opts; }, // For relayout - relayoutWithCollapse(secondPass = true): boolean { + relayoutWithCollapse(secondPass = true, keepOverflow = false): boolean { + let success: boolean; if (this.overflownRoot){ + if (keepOverflow){ + success = tryLayout(this.activeRoot, this.tileAreaDims, + {...this.lytOpts, layoutType: 'sqr-overflow'}, {layoutMap: this.layoutMap}); + return success; + } this.overflownRoot = false; } - let success = tryLayout(this.activeRoot, this.tileAreaDims, this.lytOpts, + success = tryLayout(this.activeRoot, this.tileAreaDims, this.lytOpts, {allowCollapse: true, layoutMap: this.layoutMap}); if (secondPass){ // Relayout again, which can help allocate remaining tiles 'evenly' |
