diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-26 11:58:28 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-26 11:58:28 +1100 |
| commit | 91f78e4ec12eda07840b940692013a1aa025b7b8 (patch) | |
| tree | a90279104ef35289ff1ca2b1d19321f826bb2c82 | |
| parent | a97b00fef1b3126ab5b76e2d36512a35f2fbd035 (diff) | |
Make search account for hidden nodes
| -rw-r--r-- | src/components/TileTree.vue | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index 0285505..4ede92f 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -271,23 +271,34 @@ export default defineComponent({ }, expandToTolNode(tolNode: TolNode){ // Check if searched node is shown - if (this.layoutMap.get(tolNode.name) != null){ + let layoutNode = this.layoutMap.get(tolNode.name); + if (layoutNode != null && !layoutNode.hidden){ return; } - // Get ancestor to expand - let ancestor = tolNode.parent!; + // Get nearest in-layout-tree ancestor + let ancestor = tolNode; while (this.layoutMap.get(ancestor.name) == null){ ancestor = ancestor.parent!; } - // Attempt expansion - let layoutNode = this.layoutMap.get(ancestor.name)!; + layoutNode = this.layoutMap.get(ancestor.name)!; + // If hidden, expand ancestor in parent-bar + if (layoutNode.hidden){ + // Get ancestor in parent-bar + while (!this.sepdParents.includes(layoutNode)){ + ancestor = ancestor.parent; + layoutNode = this.layoutMap.get(ancestor.name); + } + this.onSepdParentClicked(layoutNode); + setTimeout(() => this.expandToTolNode(tolNode), 300); + return; + } + // Attempt tile-expand let success = this.onInnerLeafClicked({layoutNode}); if (success){ - console.log('Expanded ' + ancestor.name); setTimeout(() => this.expandToTolNode(tolNode), 300); return; } - // Expand-to-view an ancestor just below the activeRoot + // Attempt expand-to-view on ancestor just below activeRoot if (ancestor.name == this.activeRoot.tolNode.name){ console.log('Unable to complete search (not enough room to expand active root)'); // Happens if screen is very small or node has very many children @@ -301,7 +312,6 @@ export default defineComponent({ } layoutNode = this.layoutMap.get(ancestor.name)!; this.onInnerHeaderClickHeld(layoutNode); - console.log('Expanded-to-view ' + ancestor.name); setTimeout(() => this.expandToTolNode(tolNode), 300); }, }, |
