summaryrefslogtreecommitdiffstats
path: root/native/src/overlay
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/overlay')
-rw-r--r--native/src/overlay/element.rs18
-rw-r--r--native/src/overlay/group.rs10
2 files changed, 7 insertions, 21 deletions
diff --git a/native/src/overlay/element.rs b/native/src/overlay/element.rs
index 125258c5..edeb7dbf 100644
--- a/native/src/overlay/element.rs
+++ b/native/src/overlay/element.rs
@@ -116,13 +116,9 @@ 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)
+ /// Returns true if the cursor is over the [`Element`]
+ pub fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool {
+ self.overlay.is_over(layout, cursor_position)
}
}
@@ -262,11 +258,7 @@ where
.draw(renderer, theme, style, layout, cursor_position)
}
- fn contains_cursor(
- &self,
- layout: Layout<'_>,
- cursor_position: Point,
- ) -> bool {
- self.content.contains_cursor(layout, cursor_position)
+ fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool {
+ self.content.is_over(layout, cursor_position)
}
}
diff --git a/native/src/overlay/group.rs b/native/src/overlay/group.rs
index 96d10c19..fa3c7396 100644
--- a/native/src/overlay/group.rs
+++ b/native/src/overlay/group.rs
@@ -152,17 +152,11 @@ where
});
}
- fn contains_cursor(
- &self,
- layout: Layout<'_>,
- cursor_position: Point,
- ) -> bool {
+ fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool {
self.children
.iter()
.zip(layout.children())
- .any(|(child, layout)| {
- child.contains_cursor(layout, cursor_position)
- })
+ .any(|(child, layout)| child.is_over(layout, cursor_position))
}
}