Implement Widget::overlay for PaneGrid

This commit is contained in:
Héctor Ramón Jiménez 2020-07-10 01:35:58 +02:00
parent 1070b61f34
commit f24e03eae8
2 changed files with 32 additions and 2 deletions

View file

@ -29,8 +29,8 @@ pub use state::{Focus, State};
pub use title_bar::TitleBar;
use crate::{
container, keyboard, layout, mouse, row, text, Clipboard, Element, Event,
Hasher, Layout, Length, Point, Rectangle, Size, Vector, Widget,
container, keyboard, layout, mouse, overlay, row, text, Clipboard, Element,
Event, Hasher, Layout, Length, Point, Rectangle, Size, Vector, Widget,
};
/// A collection of panes distributed using either vertical or horizontal splits
@ -636,6 +636,17 @@ where
element.hash_layout(state);
}
}
fn overlay(
&mut self,
layout: Layout<'_>,
) -> Option<overlay::Element<'_, Message, Renderer>> {
self.elements
.iter_mut()
.zip(layout.children())
.filter_map(|((_, pane), layout)| pane.overlay(layout))
.next()
}
}
/// The renderer of a [`PaneGrid`].