aboutsummaryrefslogtreecommitdiff
path: root/src/App.vue
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-05-22 21:53:23 +1000
committerTerry Truong <terry06890@gmail.com>2022-05-22 21:53:23 +1000
commit6edf3fe12a7c895eb55292281eac497377128fd2 (patch)
tree967853952880becb1e8f4761021e18d46948f274 /src/App.vue
parentc8ab4952f4cd59c654e1fb386603ceee3c090d65 (diff)
Make ancestor-hiding during searches extend halfway to active-root
Diffstat (limited to 'src/App.vue')
-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);
});