summaryrefslogtreecommitdiffstats
path: root/widget/src/radio.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-06-08 20:11:59 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-06-08 20:11:59 +0200
commit34451bff185d8875f55747ee97ed746828e30f40 (patch)
tree4cec93d3893aa6b744468af67e672383c6770afd /widget/src/radio.rs
parentc15f1b5f6575792cc89bb5fba2e613428397e46a (diff)
downloadiced-34451bff185d8875f55747ee97ed746828e30f40.tar.gz
iced-34451bff185d8875f55747ee97ed746828e30f40.tar.bz2
iced-34451bff185d8875f55747ee97ed746828e30f40.zip
Implement basic cursor availability
Diffstat (limited to 'widget/src/radio.rs')
-rw-r--r--widget/src/radio.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index 9dad1e22..9c954275 100644
--- a/widget/src/radio.rs
+++ b/widget/src/radio.rs
@@ -8,8 +8,8 @@ use crate::core::text;
use crate::core::touch;
use crate::core::widget::Tree;
use crate::core::{
- Alignment, Clipboard, Color, Element, Layout, Length, Pixels, Point,
- Rectangle, Shell, Widget,
+ Alignment, Clipboard, Color, Element, Layout, Length, Pixels, Rectangle,
+ Shell, Widget,
};
use crate::{Row, Text};
@@ -229,7 +229,7 @@ where
_state: &mut Tree,
event: Event,
layout: Layout<'_>,
- cursor_position: Point,
+ cursor: mouse::Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
@@ -237,7 +237,7 @@ where
match event {
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
| Event::Touch(touch::Event::FingerPressed { .. }) => {
- if layout.bounds().contains(cursor_position) {
+ if cursor.is_over(&layout.bounds()) {
shell.publish(self.on_click.clone());
return event::Status::Captured;
@@ -253,11 +253,11 @@ where
&self,
_state: &Tree,
layout: Layout<'_>,
- cursor_position: Point,
+ cursor: mouse::Cursor,
_viewport: &Rectangle,
_renderer: &Renderer,
) -> mouse::Interaction {
- if layout.bounds().contains(cursor_position) {
+ if cursor.is_over(&layout.bounds()) {
mouse::Interaction::Pointer
} else {
mouse::Interaction::default()
@@ -271,11 +271,10 @@ where
theme: &Renderer::Theme,
style: &renderer::Style,
layout: Layout<'_>,
- cursor_position: Point,
+ cursor: mouse::Cursor,
_viewport: &Rectangle,
) {
- let bounds = layout.bounds();
- let is_mouse_over = bounds.contains(cursor_position);
+ let is_mouse_over = cursor.is_over(&layout.bounds());
let mut children = layout.children();