diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Tile.vue | 12 | ||||
| -rw-r--r-- | src/components/TileTree.vue | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/components/Tile.vue b/src/components/Tile.vue index 054bfed..09d6128 100644 --- a/src/components/Tile.vue +++ b/src/components/Tile.vue @@ -46,7 +46,8 @@ export default defineComponent({ <template> <div :style="{position: 'absolute', - left: layoutNode.x+'px', top: layoutNode.y+'px', width: layoutNode.w+'px', height: layoutNode.h+'px', + left: layoutNode.pos[0]+'px', top: layoutNode.pos[1]+'px', + width: layoutNode.dims[0]+'px', height: layoutNode.dims[1]+'px', zIndex: zIdx, overflow: overFlow, transitionDuration: transitionDuration+'ms'}" class="transition-[left,top,width,height] ease-out border border-stone-900 bg-white"> <div v-if="layoutNode.children.length == 0" @@ -56,17 +57,18 @@ export default defineComponent({ /> <div v-else> <div - v-if="(layoutNode.headerSz && !layoutNode.sepSweptArea) || + v-if="(layoutNode.headerSz && !layoutNode.sepSweptArea) || (layoutNode.sepSweptArea && layoutNode.sepSweptArea.sweptLeft)" :style="{height: layoutNode.headerSz+'px'}" class="text-center hover:cursor-pointer bg-stone-300" @click="onHeaderClick"> {{layoutNode.tolNode.name}} </div> <div v-if="layoutNode.sepSweptArea" - :style="{position: 'absolute', left: layoutNode.sepSweptArea.x+'px', top: layoutNode.sepSweptArea.y+'px', - width: (layoutNode.sepSweptArea.w + + :style="{position: 'absolute', + left: layoutNode.sepSweptArea.pos[0]+'px', top: layoutNode.sepSweptArea.pos[1]+'px', + width: (layoutNode.sepSweptArea.dims[0] + (layoutNode.sepSweptArea.sweptLeft ? layoutNode.sepSweptArea.tileSpacing+1 : 0))+'px', - height: (layoutNode.sepSweptArea.h + + height: (layoutNode.sepSweptArea.dims[1] + (layoutNode.sepSweptArea.sweptLeft ? 0 : layoutNode.sepSweptArea.tileSpacing+1))+'px', borderRightColor: (layoutNode.sepSweptArea.sweptLeft ? 'white' : 'currentColor'), borderBottomColor: (layoutNode.sepSweptArea.sweptLeft ? 'currentColor' : 'white'), diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index e9c8c93..ce3507d 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -73,7 +73,7 @@ export default defineComponent({ nodeList[0].children = children; }, tryLayout(){ - let newLayout = genLayout(this.layoutTree, 0, 0, this.width, this.height, true); + let newLayout = genLayout(this.layoutTree, [0,0], [this.width,this.height], true); if (newLayout == null){ console.log('Unable to layout tree'); return false; @@ -83,10 +83,8 @@ export default defineComponent({ } }, applyLayout(newLayout: LayoutNode, layoutTree: LayoutNode){ - layoutTree.x = newLayout.x; - layoutTree.y = newLayout.y; - layoutTree.w = newLayout.w; - layoutTree.h = newLayout.h; + layoutTree.pos = newLayout.pos; + layoutTree.dims = newLayout.dims; layoutTree.headerSz = newLayout.headerSz; newLayout.children.forEach((n,i) => this.applyLayout(n, layoutTree.children[i])); //handle case where leaf nodes placed in leftover space from parent-sweep @@ -95,8 +93,8 @@ export default defineComponent({ layoutTree.sepSweptArea = newLayout.sepSweptArea; //move leaf node children to parent area layoutTree.children.filter(n => n.children.length == 0).map(n => { - n.x += newLayout.sepSweptArea!.x; - n.y += newLayout.sepSweptArea!.y; + n.pos[0] += newLayout.sepSweptArea!.pos[0], + n.pos[1] += newLayout.sepSweptArea!.pos[1] }); } else { layoutTree.sepSweptArea = null; |
