aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/App.vue11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/App.vue b/src/App.vue
index 1dd0b93..e1da1f2 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -384,19 +384,18 @@ export default defineComponent({
setTimeout(() => this.expandToNode(name), this.uiOpts.tileChgDuration);
return;
}
- // Attempt expand-to-view on an ancestor
+ // Attempt expand-to-view on an ancestor halfway to the active root
if (layoutNode == this.activeRoot){
console.log('Screen too small to expand active root');
this.modeRunning = false;
return;
}
- const MAX_ANCESTOR_DIST = 5;
- for (let i = 0; i < MAX_ANCESTOR_DIST; i++){
- if (layoutNode.parent! == this.activeRoot){
- break;
- }
+ let ancestorChain = [layoutNode];
+ while (layoutNode.parent! != this.activeRoot){
layoutNode = layoutNode.parent!;
+ ancestorChain.push(layoutNode);
}
+ layoutNode = ancestorChain[Math.floor((ancestorChain.length - 1) / 2)]
this.onNonleafClickHeld(layoutNode);
setTimeout(() => this.expandToNode(name), this.uiOpts.tileChgDuration);
});