cushy
cushy copied to clipboard
Draggable splitter widget.
trafficstars
I have a requirement where I want to be able to dynamically resize two columns or two rows using a vertical or horizontal (respectively) draggable handle.
In JavaFx this is a SplitPane, details here: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/SplitPane.html
Usage something like this:
"left".into_label()
.and("right".into_label()")
.split_vertically()
...
Example screenshot from JavaFX
Requirements:
- The width of the splitter needs to be able to be set.
- A splitter with a width of 0 is valid. Some users might not want visual cues other than the hover-over mouse cursor.
- The width of the hover-over area needs to be settable (>=1), i.e. the area that allows the splitter to show the 'resize' mouse pointer to allow dragging with the mouse.
Would be nice:
- Keyboard focusable, and controllable with left/right or up/down cursor keys.
Notes:
- there are various things that could happen when the container the split pane is in is resized. e.g. resize both sides proportionally or keep the splitter handle at it's fixed position so that either the left or right pane resizes. likely similar to how
GridDimensionworks.
I've been wanting this widget recently too. Thank you for writing this up!