summaryrefslogtreecommitdiffstats
path: root/native/src/overlay/element.rs
diff options
context:
space:
mode:
authorLibravatar Cory Forsstrom <cforsstrom18@gmail.com>2023-01-17 11:12:10 -0800
committerLibravatar Cory Forsstrom <cforsstrom18@gmail.com>2023-01-17 11:12:10 -0800
commit3ab679725526bd095cc1a160705312b16c408b92 (patch)
tree15822dd3684c6f5d1892eb5b15385157dbf72f08 /native/src/overlay/element.rs
parentb2a3a85acb2a0722e90c46b70d574f1d676da9d1 (diff)
downloadiced-3ab679725526bd095cc1a160705312b16c408b92.tar.gz
iced-3ab679725526bd095cc1a160705312b16c408b92.tar.bz2
iced-3ab679725526bd095cc1a160705312b16c408b92.zip
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.
Diffstat (limited to 'native/src/overlay/element.rs')
-rw-r--r--native/src/overlay/element.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/native/src/overlay/element.rs b/native/src/overlay/element.rs
index 41a8a597..125258c5 100644
--- a/native/src/overlay/element.rs
+++ b/native/src/overlay/element.rs
@@ -115,6 +115,15 @@ where
) {
self.overlay.operate(layout, renderer, operation);
}
+
+ /// Whether the [`Overlay`] contains the cursor
+ pub fn contains_cursor(
+ &self,
+ layout: Layout<'_>,
+ cursor_position: Point,
+ ) -> bool {
+ self.overlay.contains_cursor(layout, cursor_position)
+ }
}
struct Map<'a, A, B, Renderer> {
@@ -252,4 +261,12 @@ where
self.content
.draw(renderer, theme, style, layout, cursor_position)
}
+
+ fn contains_cursor(
+ &self,
+ layout: Layout<'_>,
+ cursor_position: Point,
+ ) -> bool {
+ self.content.contains_cursor(layout, cursor_position)
+ }
}