feat: add drag_destinations for container widgets

This commit is contained in:
Ashley Wulber 2024-04-01 16:12:45 -04:00 committed by Michael Murphy
parent b9cc88c492
commit 745cba1c2c
5 changed files with 72 additions and 1 deletions

View file

@ -263,6 +263,23 @@ impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer> for G
.map(|((c, c_layout), state)| c.as_widget().a11y_nodes(c_layout, state, p)),
)
}
fn drag_destinations(
&self,
state: &Tree,
layout: Layout<'_>,
dnd_rectangles: &mut iced_style::core::clipboard::DndDestinationRectangles,
) {
for ((e, layout), state) in self
.children
.iter()
.zip(layout.children())
.zip(state.children.iter())
{
e.as_widget()
.drag_destinations(state, layout, dnd_rectangles);
}
}
}
impl<'a, Message: 'static + Clone> From<Grid<'a, Message>> for Element<'a, Message> {