diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-10 23:45:46 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-10 23:45:46 +1100 |
| commit | e2df6e256dd017760747bd0c982e7b2a489b0794 (patch) | |
| tree | 0aaa2becdce1bb4c6e2b5b5d4698032dc71f258c /src | |
| parent | e635f8c72f5b2e7bd132993ce01fc9b1965e3207 (diff) | |
Fix a few layout bugs
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/TileTree.vue | 6 | ||||
| -rw-r--r-- | src/layout.js | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/components/TileTree.vue b/src/components/TileTree.vue index 1c7d593..debf77a 100644 --- a/src/components/TileTree.vue +++ b/src/components/TileTree.vue @@ -47,7 +47,7 @@ export default { if (!this.resizeThrottled){ this.width = document.documentElement.clientWidth; this.height = document.documentElement.clientHeight; - this.tryLayout(); //use best-effort collapsing-layout? + this.tryLayout(); //prevent re-triggering until after a delay this.resizeThrottled = true; setTimeout(() => {this.resizeThrottled = false;}, 100); @@ -71,9 +71,11 @@ export default { nodeList[0].children = []; }, onInnerHeaderClicked(nodeList){ //nodeList is array of tree-objects, from clicked-on-tile's tree-object upward + let children = nodeList[0].children; nodeList[0].children = []; layoutInfoHooks.updateLayoutInfoOnCollapse(nodeList); - this.tryLayout(); + if (!this.tryLayout()) + nodeList[0].children = children; }, tryLayout(){ let layout = LAYOUT_FUNC(this.tree, 0, 0, this.width, this.height, true); diff --git a/src/layout.js b/src/layout.js index fcdda56..d4a1e63 100644 --- a/src/layout.js +++ b/src/layout.js @@ -231,7 +231,7 @@ function sweepToSideLayout(node, x, y, w, h, hideHeader, parentArea = null){ return staticSqrLayout(node, x, y, w, h, hideHeader); } else if (leaves.length == 0){ tempTree = {tolNode: {name: 'SWEEP_REM_' + node.tolNode.name}, children: nonLeaves}; - return staticRectLayout(tempTree, x, y, w, h, hideHeader); + return staticRectLayout(tempTree, x, y, w, h, hideHeader, sweepToSideLayout); } else { let ratio = leaves.length / (leaves.length + nonLeaves.map(e => e.tileCount).reduce((x,y) => x+y)); let headerSz = (hideHeader ? 0 : HEADER_SZ); @@ -255,7 +255,7 @@ function sweepToSideLayout(node, x, y, w, h, hideHeader, parentArea = null){ //get leftover swept-layout-area to propagate let leftOverWidth = parentArea.w - sweptLayout.contentW; let leftOverHeight = parentArea.h - sweptLayout.contentH; - leftOverArea = (leftOverWidth < leftOverHeight) ? + leftOverArea = sweptLeft ? {...parentArea, parentY:parentArea.parentY+sweptLayout.contentH-TILE_SPACING-headerSz, h:leftOverHeight-TILE_SPACING} : {...parentArea, |
