Return new Split in pane_grid::State::split

This commit is contained in:
Héctor Ramón Jiménez 2020-05-09 09:40:31 +02:00
parent c620e4dc4c
commit 32b9c1fdbd

View File

@ -191,7 +191,12 @@ impl<T> State<T> {
/// ///
/// [`Pane`]: struct.Pane.html /// [`Pane`]: struct.Pane.html
/// [`Axis`]: enum.Axis.html /// [`Axis`]: enum.Axis.html
pub fn split(&mut self, axis: Axis, pane: &Pane, state: T) -> Option<Pane> { pub fn split(
&mut self,
axis: Axis,
pane: &Pane,
state: T,
) -> Option<(Pane, Split)> {
let node = self.internal.layout.find(pane)?; let node = self.internal.layout.find(pane)?;
let new_pane = { let new_pane = {
@ -211,7 +216,7 @@ impl<T> State<T> {
let _ = self.panes.insert(new_pane, state); let _ = self.panes.insert(new_pane, state);
self.focus(&new_pane); self.focus(&new_pane);
Some(new_pane) Some((new_pane, new_split))
} }
/// Swaps the position of the provided panes in the [`State`]. /// Swaps the position of the provided panes in the [`State`].