diff options
| author | 2021-10-20 16:28:27 +0700 | |
|---|---|---|
| committer | 2021-10-20 16:28:27 +0700 | |
| commit | 954d6349a8cd5505d99403285ce9617c65a63a2b (patch) | |
| tree | fab0e5663ad5561b91d0389393d84a6a170f7c1c /native/src/widget | |
| parent | c800fd07c3460d90a120fe30fc0cd7503d829f68 (diff) | |
| download | iced-954d6349a8cd5505d99403285ce9617c65a63a2b.tar.gz iced-954d6349a8cd5505d99403285ce9617c65a63a2b.tar.bz2 iced-954d6349a8cd5505d99403285ce9617c65a63a2b.zip  | |
Implement `Widget::mouse_interaction` for `Slider`
Diffstat (limited to '')
| -rw-r--r-- | native/src/widget/slider.rs | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index 31a5965b..60124160 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -336,6 +336,24 @@ where          });      } +    fn mouse_interaction( +        &self, +        layout: Layout<'_>, +        _viewport: &Rectangle, +        cursor_position: Point, +    ) -> mouse::Interaction { +        let bounds = layout.bounds(); +        let is_mouse_over = bounds.contains(cursor_position); + +        if self.state.is_dragging { +            mouse::Interaction::Grabbing +        } else if is_mouse_over { +            mouse::Interaction::Grab +        } else { +            mouse::Interaction::default() +        } +    } +      fn hash_layout(&self, state: &mut Hasher) {          struct Marker;          std::any::TypeId::of::<Marker>().hash(state);  | 
