summaryrefslogtreecommitdiffstats
path: root/native/src/widget/slider.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-05-05 00:05:47 +0200
committerLibravatar GitHub <noreply@github.com>2020-05-05 00:05:47 +0200
commit7dc02a5e16a3143b7c3ba9270207e3ebda71d567 (patch)
treedd727f138641fbda008af8e7827369cc99420749 /native/src/widget/slider.rs
parent27aad74a32fd8ac2b12f9d32df8a3b61a3175457 (diff)
parent93c6be5eef577f0778b5787dac37351c035ed471 (diff)
downloadiced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.tar.gz
iced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.tar.bz2
iced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.zip
Merge pull request #325 from hecrj/feature/canvas-interaction
Canvas interactivity and Game of Life example
Diffstat (limited to 'native/src/widget/slider.rs')
-rw-r--r--native/src/widget/slider.rs23
1 files changed, 10 insertions, 13 deletions
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs
index 1feb7825..8cdfc3de 100644
--- a/native/src/widget/slider.rs
+++ b/native/src/widget/slider.rs
@@ -5,8 +5,7 @@
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::{
- input::{mouse, ButtonState},
- layout, Clipboard, Element, Event, Hasher, Layout, Length, Point,
+ layout, mouse, Clipboard, Element, Event, Hasher, Layout, Length, Point,
Rectangle, Size, Widget,
};
@@ -164,25 +163,23 @@ where
};
match event {
- Event::Mouse(mouse::Event::Input {
- button: mouse::Button::Left,
- state,
- }) => match state {
- ButtonState::Pressed => {
+ Event::Mouse(mouse_event) => match mouse_event {
+ mouse::Event::ButtonPressed(mouse::Button::Left) => {
if layout.bounds().contains(cursor_position) {
change();
self.state.is_dragging = true;
}
}
- ButtonState::Released => {
+ mouse::Event::ButtonReleased(mouse::Button::Left) => {
self.state.is_dragging = false;
}
- },
- Event::Mouse(mouse::Event::CursorMoved { .. }) => {
- if self.state.is_dragging {
- change();
+ mouse::Event::CursorMoved { .. } => {
+ if self.state.is_dragging {
+ change();
+ }
}
- }
+ _ => {}
+ },
_ => {}
}
}