diff options
| author | 2023-06-09 21:53:54 +0200 | |
|---|---|---|
| committer | 2023-06-09 21:53:54 +0200 | |
| commit | 60cd864d43be877a5eaee4f5ca32f41b9fb70b79 (patch) | |
| tree | 01a7758d3b8a4d2434bba113df85c6cb2c3e2ca2 /widget/src/radio.rs | |
| parent | c15f1b5f6575792cc89bb5fba2e613428397e46a (diff) | |
| parent | 27639c4ce6161fa07986c2f1d472a8a259ae2129 (diff) | |
| download | iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.gz iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.bz2 iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.zip | |
Merge pull request #1904 from iced-rs/cursor-availability
Cursor availability
Diffstat (limited to '')
| -rw-r--r-- | widget/src/radio.rs | 17 | 
1 files changed, 8 insertions, 9 deletions
| diff --git a/widget/src/radio.rs b/widget/src/radio.rs index 9dad1e22..5b883147 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(); | 
