Add ability to drag pane to the pane grid edges & optional style for dragged pane

This commit is contained in:
Joao Freitas 2023-05-19 11:24:52 +01:00 committed by Héctor Ramón Jiménez
parent 7f805bc5dd
commit e5c9dd54b3
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 293 additions and 106 deletions

View file

@ -120,6 +120,16 @@ impl Node {
};
}
pub(crate) fn split_inverse(&mut self, id: Split, axis: Axis, pane: Pane) {
*self = Node::Split {
id,
axis,
ratio: 0.5,
a: Box::new(Node::Pane(pane)),
b: Box::new(self.clone()),
};
}
pub(crate) fn update(&mut self, f: &impl Fn(&mut Node)) {
if let Node::Split { a, b, .. } = self {
a.update(f);