react-mosaic
react-mosaic copied to clipboard
Dragging splitter between 3+ elements
Let's say I have 3 panes
+-----+-----+-----+
| A | B | C |
+-----+-----+-----+
And lets say it's split so the outer split is A vs BC and on the right is a nested split for B vs C
So if I drag the sizer between A and B the sizer for C moves. But that's not what I'd like to happen
If they move the sizer between A and B it should only make A and B bigger or smaller and not affect C.
The more nested the worse this gets making it very hard to adjust pane sizes.
would that be an easy change?
It's possible but not entirely straightforward. The react-mosaic pane structure is a binary tree, so those three windows internally are represented by [A|[B|C]]
. The resizing logic could be made to intelligently inspect the children of the panes it is resizing and do the proper math to make it have the behavior you desire. However, it gets more complex with more complex trees.
Any chance this could be improved? I was considering using react-mosaic before learning this.
Thanks!
I think it would be a good improvement but fairly involved. Might be best to do with an API break (making MosaicNode
a tree instead of strictly a binary tree). Definitely accepting PRs but I have no plans for implementing this soon.