diff options
author | 2023-01-17 17:20:53 -0800 | |
---|---|---|
committer | 2023-01-17 17:20:53 -0800 | |
commit | be860508a9deed1f4583e045790eb9ddd74d07d5 (patch) | |
tree | ecf67503db95d5812b6e423b6b993a470d410209 /native/src | |
parent | d470467718ecad0f37599a811bef846846dbb2b9 (diff) | |
download | iced-be860508a9deed1f4583e045790eb9ddd74d07d5.tar.gz iced-be860508a9deed1f4583e045790eb9ddd74d07d5.tar.bz2 iced-be860508a9deed1f4583e045790eb9ddd74d07d5.zip |
Rename method to is_over
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/overlay.rs | 8 | ||||
-rw-r--r-- | native/src/overlay/element.rs | 18 | ||||
-rw-r--r-- | native/src/overlay/group.rs | 10 | ||||
-rw-r--r-- | native/src/user_interface.rs | 8 |
4 files changed, 12 insertions, 32 deletions
diff --git a/native/src/overlay.rs b/native/src/overlay.rs index 16d8bb31..1c3d0fb9 100644 --- a/native/src/overlay.rs +++ b/native/src/overlay.rs @@ -90,12 +90,8 @@ where mouse::Interaction::Idle } - /// Whether the [`Overlay`] contains the cursor - fn contains_cursor( - &self, - layout: Layout<'_>, - cursor_position: Point, - ) -> bool { + /// Returns true if the cursor is over the [`Overlay`] + fn is_over(&self, layout: Layout<'_>, cursor_position: Point) -> bool { layout.bounds().contains(cursor_position) } } 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)) } } diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 8659caa3..0def730c 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -264,7 +264,7 @@ where let base_cursor = if manual_overlay .as_ref() .unwrap() - .contains_cursor(Layout::new(&layout), cursor_position) + .is_over(Layout::new(&layout), cursor_position) { // TODO: Type-safe cursor availability Point::new(-1.0, -1.0) @@ -508,10 +508,8 @@ where ); }); - if overlay.contains_cursor( - Layout::new(layout), - cursor_position, - ) { + if overlay.is_over(Layout::new(layout), cursor_position) + { overlay_interaction } else { base_interaction |