Add overlay support in iced_pure and port PickList 🎉
This commit is contained in:
parent
35e9b75e41
commit
019af8ddbf
10 changed files with 731 additions and 254 deletions
21
pure/src/overlay.rs
Normal file
21
pure/src/overlay.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use crate::Tree;
|
||||
|
||||
use iced_native::Layout;
|
||||
|
||||
pub use iced_native::overlay::*;
|
||||
|
||||
pub fn from_children<'a, Message, Renderer>(
|
||||
children: &'a mut [crate::Element<'_, Message, Renderer>],
|
||||
tree: &'a mut Tree,
|
||||
layout: Layout<'_>,
|
||||
renderer: &Renderer,
|
||||
) -> Option<Element<'a, Message, Renderer>> {
|
||||
children
|
||||
.iter_mut()
|
||||
.zip(&mut tree.children)
|
||||
.zip(layout.children())
|
||||
.filter_map(|((child, state), layout)| {
|
||||
child.as_widget_mut().overlay(state, layout, renderer)
|
||||
})
|
||||
.next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue