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.
This commit is contained in:
Cory Forsstrom 2023-01-17 11:12:10 -08:00
parent b2a3a85acb
commit 3ab6797255
No known key found for this signature in database
GPG key ID: 1DFE170A4415C9F5
4 changed files with 48 additions and 2 deletions

View file

@ -261,7 +261,11 @@ where
}
}
let base_cursor = if layout.bounds().contains(cursor_position) {
let base_cursor = if manual_overlay
.as_ref()
.unwrap()
.contains_cursor(Layout::new(&layout), cursor_position)
{
// TODO: Type-safe cursor availability
Point::new(-1.0, -1.0)
} else {
@ -504,7 +508,10 @@ where
);
});
if overlay_bounds.contains(cursor_position) {
if overlay.contains_cursor(
Layout::new(layout),
cursor_position,
) {
overlay_interaction
} else {
base_interaction