aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/ParentBar.vue7
-rw-r--r--src/components/TileTree.vue16
-rw-r--r--src/lib.ts12
3 files changed, 25 insertions, 10 deletions
diff --git a/src/components/ParentBar.vue b/src/components/ParentBar.vue
index 8bd513a..26061b7 100644
--- a/src/components/ParentBar.vue
+++ b/src/components/ParentBar.vue
@@ -50,6 +50,11 @@ export default defineComponent({
};
},
},
+ methods: {
+ onClick(node: LayoutNode){
+ this.$emit('sepd-parent-clicked', node);
+ },
+ },
components: {
TileImg,
},
@@ -59,6 +64,6 @@ export default defineComponent({
<template>
<div :style="styles">
<tile-img v-for="node in nodes" :key="node.tolNode.name"
- :layoutNode="node" :tileSz="tileSz" :options="options"/>
+ :layoutNode="node" :tileSz="tileSz" :options="options" @click="onClick(node)"/>
</div>
</template>
diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue
index 8ba5048..ed7eb87 100644
--- a/src/components/TileTree.vue
+++ b/src/components/TileTree.vue
@@ -78,7 +78,7 @@ export default defineComponent({
wideArea(): boolean{
return this.width >= this.height;
},
- separatedParents(): LayoutNode[] | null {
+ sepdParents(): LayoutNode[] | null {
if (this.activeRoot == this.layoutTree){
return null;
}
@@ -92,7 +92,7 @@ export default defineComponent({
},
tileAreaPos(){
let pos = [this.tileAreaOffset, this.tileAreaOffset] as [number, number];
- if (this.separatedParents != null){
+ if (this.sepdParents != null){
if (this.wideArea){
pos[0] += this.parentBarSz;
} else {
@@ -106,7 +106,7 @@ export default defineComponent({
this.width - this.tileAreaOffset*2,
this.height - this.tileAreaOffset*2
] as [number, number];
- if (this.separatedParents != null){
+ if (this.sepdParents != null){
if (this.wideArea){
dims[0] -= this.parentBarSz;
} else {
@@ -184,6 +184,11 @@ export default defineComponent({
this.activeRoot = layoutNode;
tryLayout(layoutNode, this.tileAreaPos, this.tileAreaDims, this.layoutOptions, true);
},
+ onSepdParentClicked(layoutNode: LayoutNode){
+ LayoutNode.showDownward(layoutNode);
+ this.activeRoot = layoutNode;
+ tryLayout(layoutNode, this.tileAreaPos, this.tileAreaDims, this.layoutOptions, true);
+ },
// For preventing double-clicks from highlighting text
onMouseDown(evt: UIEvent){
if (evt.detail == 2){
@@ -211,8 +216,9 @@ export default defineComponent({
:headerSz="layoutOptions.headerSz" :tileSpacing="layoutOptions.tileSpacing" :options="componentOptions"
@leaf-clicked="onInnerLeafClicked" @header-clicked="onInnerHeaderClicked"
@leaf-dbl-clicked="onInnerLeafDblClicked" @header-dbl-clicked="onInnerHeaderDblClicked"/>
- <parent-bar v-if="separatedParents != null"
- :pos="[0,0]" :dims="parentBarDims" :nodes="separatedParents" :options="componentOptions"/>
+ <parent-bar v-if="sepdParents != null"
+ :pos="[0,0]" :dims="parentBarDims" :nodes="sepdParents" :options="componentOptions"
+ @sepd-parent-clicked="onSepdParentClicked"/>
</div>
</template>
diff --git a/src/lib.ts b/src/lib.ts
index b98576d..ed46ea5 100644
--- a/src/lib.ts
+++ b/src/lib.ts
@@ -106,7 +106,7 @@ export class LayoutNode {
node = node.parent;
}
}
- //
+ // Used to hide/show parent nodes upon expand-to-view
static hideUpward(node: LayoutNode){
if (node.parent != null){
node.parent.hidden = true;
@@ -116,9 +116,13 @@ export class LayoutNode {
}
static hideDownward(node: LayoutNode){
node.hidden = true;
- node.children.forEach(n => {
- LayoutNode.hideDownward(n)
- });
+ node.children.forEach(n => LayoutNode.hideDownward(n));
+ }
+ static showDownward(node: LayoutNode){
+ if (node.hidden){
+ node.hidden = false;
+ node.children.forEach(n => LayoutNode.showDownward(n));
+ }
}
}
// Contains settings that affect how layout is done