react-mosaic icon indicating copy to clipboard operation
react-mosaic copied to clipboard

Dragging splitter between 3+ elements

Open greggman opened this issue 6 years ago • 3 comments

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

react-mosaic-3-panes

If they move the sizer between A and B it should only make A and B bigger or smaller and not affect C.

vscode-3-panes

The more nested the worse this gets making it very hard to adjust pane sizes.

would that be an easy change?

greggman avatar Jul 29 '17 09:07 greggman

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.

nomcopter avatar Aug 04 '17 21:08 nomcopter

Any chance this could be improved? I was considering using react-mosaic before learning this.

Thanks!

tnrich avatar Nov 03 '17 01:11 tnrich

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.

nomcopter avatar Nov 04 '17 01:11 nomcopter