From 3ab679725526bd095cc1a160705312b16c408b92 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Tue, 17 Jan 2023 11:12:10 -0800 Subject: New method to determine if overlay contains cursor This is needed for "container" overlay's such as `Group` which should only consider it's childrens layouts and not it's own when determining if the cursor is captured by the overlay. --- native/src/overlay/group.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'native/src/overlay/group.rs') diff --git a/native/src/overlay/group.rs b/native/src/overlay/group.rs index f894f911..96d10c19 100644 --- a/native/src/overlay/group.rs +++ b/native/src/overlay/group.rs @@ -151,6 +151,19 @@ where ) }); } + + fn contains_cursor( + &self, + layout: Layout<'_>, + cursor_position: Point, + ) -> bool { + self.children + .iter() + .zip(layout.children()) + .any(|(child, layout)| { + child.contains_cursor(layout, cursor_position) + }) + } } impl<'a, Message, Renderer> From> -- cgit