diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-27 21:02:51 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-27 21:02:51 +1100 |
| commit | 130ebc45aae74c595f7b21e476f4e0a675f3b43f (patch) | |
| tree | 1c6ea6c2c243145f49c2d49ad99cd874f3753e73 | |
| parent | 09a4d66a1cca1bd56fcdafe9d782d1fff98f41f8 (diff) | |
Make sweep use rect with leaves-to-end if children with children leavessweep-situational-rect
| -rw-r--r-- | src/lib.ts | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -581,6 +581,15 @@ let sweepLayout: LayoutFn = function (node, pos, dims, showHeader, allowCollapse } else if (leaves.length == 0){ return rectLayout(node, pos, dims, showHeader, allowCollapse, opts, {subLayoutFn: sweepLayout}); } + // Use rect layout with rectSepdLeaves if children have only leaf children + if (nonLeaves.every(n => n.children.every(n => n.children.length == 0))){ + let tempOpts = {...opts}; + tempOpts.rectSepLeaves = 'end'; + let success = rectLayout(node, pos, dims, showHeader, false, tempOpts); + if (success){ + return true; + } + } // Some variables let headerSz = showHeader ? opts.headerSz : 0; let leavesLyt: LayoutNode | null = null, nonLeavesLyt: LayoutNode | null = null, sweptLeft = false; |
