summaryrefslogtreecommitdiffstats
path: root/widget/src/checkbox.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-06-09 21:53:54 +0200
committerLibravatar GitHub <noreply@github.com>2023-06-09 21:53:54 +0200
commit60cd864d43be877a5eaee4f5ca32f41b9fb70b79 (patch)
tree01a7758d3b8a4d2434bba113df85c6cb2c3e2ca2 /widget/src/checkbox.rs
parentc15f1b5f6575792cc89bb5fba2e613428397e46a (diff)
parent27639c4ce6161fa07986c2f1d472a8a259ae2129 (diff)
downloadiced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.gz
iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.tar.bz2
iced-60cd864d43be877a5eaee4f5ca32f41b9fb70b79.zip
Merge pull request #1904 from iced-rs/cursor-availability
Cursor availability
Diffstat (limited to 'widget/src/checkbox.rs')
-rw-r--r--widget/src/checkbox.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs
index 4c8a989b..aa0bff42 100644
--- a/widget/src/checkbox.rs
+++ b/widget/src/checkbox.rs
@@ -8,8 +8,8 @@ use crate::core::text;
use crate::core::touch;
use crate::core::widget::Tree;
use crate::core::{
- Alignment, Clipboard, Element, Layout, Length, Pixels, Point, Rectangle,
- Shell, Widget,
+ Alignment, Clipboard, Element, Layout, Length, Pixels, Rectangle, Shell,
+ Widget,
};
use crate::{Row, Text};
@@ -204,7 +204,7 @@ where
_tree: &mut Tree,
event: Event,
layout: Layout<'_>,
- cursor_position: Point,
+ cursor: mouse::Cursor,
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
@@ -212,7 +212,7 @@ where
match event {
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
| Event::Touch(touch::Event::FingerPressed { .. }) => {
- let mouse_over = layout.bounds().contains(cursor_position);
+ let mouse_over = cursor.is_over(layout.bounds());
if mouse_over {
shell.publish((self.on_toggle)(!self.is_checked));
@@ -230,11 +230,11 @@ where
&self,
_tree: &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()
@@ -248,11 +248,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();