Origami icon indicating copy to clipboard operation
Origami copied to clipboard

Allow joining of separators.

Open markalfred opened this issue 11 years ago • 6 comments

I have a 2x2 grid...

...... ......
...... ......

and I add a new column on the right of my top row and on the right of my bottom row...

...... ... ...
...... ... ...

I can resize the first column on both rows simultaneously...

.. ....... ...
.. ....... ...

but the last columns are controlled separately...

.. .. ........
.. ....... ...

In some cases, this is what I want. But at times, I'd like to be able to create a column that spans both rows and is resized simultaneously. In the first case, my layout looks like...

{
  'cells': [[0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 3, 2], [2, 0, 4, 1], [3, 1, 4, 2]],
  'rows': [0.0, 0.5, 1.0],
  'cols': [0.0, 0.5, 0.75, 0.75, 1.0]
}

If I choose to do so, Origami could take this layout and combine any duplicate row/col measures into one. In this case...

{
  'cells': [[0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 3, 2], [2, 0, 4, 1], [3, 1, 4, 2]],
                                                             ^       ^     ^       ^     ^
  'rows': [0.0, 0.5, 1.0],
  'cols': [0.0, 0.5, 0.75, 0.75, 1.0]
                     ^^^^  ^^^^
}

The 0.75s in 'cols' are combined, and all references to them are adjusted accordingly (in 'cells', the "3"s will become "2"s, and the "4"s become "3"s). We get...

{
  'cells': [[0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2], [2, 0, 3, 1], [2, 1, 3, 2]],
  'rows': [0.0, 0.5, 1.0],
  'cols': [0.0, 0.5, 0.75, 1.0]
}

Using set_layout with this value will result in a 3x2 layout where all column separators span both rows.

markalfred avatar Oct 22 '14 20:10 markalfred

What would the user interface for this look like?

adzenith avatar Oct 27 '14 13:10 adzenith

The basic idea is like this...

http://youtu.be/T0QePhICeeY

I think an assumption could be made that any adjacent panes sharing the exact same x or y separator positions could be consolidated.

markalfred avatar Oct 30 '14 19:10 markalfred

Does that code exist? Want to send a pull request?

adzenith avatar Oct 30 '14 19:10 adzenith

It's a fake currently :blush: but I'd be happy to start work on the idea if anyone has use for / interest in it.

markalfred avatar Oct 30 '14 19:10 markalfred

Sure! I was also thinking that it could automatically consolidate when new panes are made - so if you created the upper-right pane and then the lower-right pane, they'd auto-consolidate. And this way if you dragged the divider for the upper-right one before creating the lower right, they wouldn't consolidate. What do you think?

adzenith avatar Oct 30 '14 19:10 adzenith

Very good call!

markalfred avatar Oct 30 '14 19:10 markalfred