From c9a98a15f67d11f06c28733383336a5319e403d5 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sun, 19 Jun 2022 18:16:51 +1000 Subject: Add layout-skip heuristic using collective-min-size check --- src/layout.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3