diff options
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, |
