aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-06-19 18:16:51 +1000
committerTerry Truong <terry06890@gmail.com>2022-06-19 18:16:51 +1000
commitc9a98a15f67d11f06c28733383336a5319e403d5 (patch)
treeb76ee2256dafd0612a976bf4e8231a4c59c05898 /src
parent46357d6e93278ea37cb448ba341effc38aa36840 (diff)
Add layout-skip heuristic using collective-min-size check
Diffstat (limited to 'src')
-rw-r--r--src/layout.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/layout.ts b/src/layout.ts
index f371044..71fb476 100644
--- a/src/layout.ts
+++ b/src/layout.ts
@@ -389,7 +389,12 @@ let rectLayout: LayoutFn = function (node, pos, dims, showHeader, allowCollapse,
let headerSz = showHeader ? opts.headerSz : 0;
let newPos = [opts.tileSpacing, opts.tileSpacing + headerSz];
let newDims = [dims[0] - opts.tileSpacing, dims[1] - opts.tileSpacing - headerSz];
- if (newDims[0] * newDims[1] <= 0){
+ if (newDims[0] * newDims[1] < node.dCount * (opts.minTileSz + opts.tileSpacing)**2){
+ if (allowCollapse){
+ node.children = [];
+ LayoutNode.updateDCounts(node, 1 - node.dCount);
+ return oneSqrLayout(node, pos, dims, false, false, opts);
+ }
return false;
}
// Try finding arrangement with low empty space