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.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'native/src/overlay.rs') diff --git a/native/src/overlay.rs b/native/src/overlay.rs index e7394494..16d8bb31 100644 --- a/native/src/overlay.rs +++ b/native/src/overlay.rs @@ -89,6 +89,15 @@ where ) -> mouse::Interaction { mouse::Interaction::Idle } + + /// Whether the [`Overlay`] contains the cursor + fn contains_cursor( + &self, + layout: Layout<'_>, + cursor_position: Point, + ) -> bool { + layout.bounds().contains(cursor_position) + } } /// Returns a [`Group`] of overlay [`Element`] children. -- cgit