summaryrefslogtreecommitdiffstats
path: root/native/src/widget/slider.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 04:53:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-30 04:53:15 +0200
commite55cd9652e7c7aea4dc2c6ccb83769246d1a808e (patch)
tree6383563bab65b5feed50873c447a40da929d90bf /native/src/widget/slider.rs
parente139aae1439d362ada017a05c9554eaae0883888 (diff)
downloadiced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.tar.gz
iced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.tar.bz2
iced-e55cd9652e7c7aea4dc2c6ccb83769246d1a808e.zip
Split `Input` mouse event by `ButtonState`
Diffstat (limited to '')
-rw-r--r--native/src/widget/slider.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs
index 1feb7825..a00d7c8d 100644
--- a/native/src/widget/slider.rs
+++ b/native/src/widget/slider.rs
@@ -5,9 +5,8 @@
//! [`Slider`]: struct.Slider.html
//! [`State`]: struct.State.html
use crate::{
- input::{mouse, ButtonState},
- layout, Clipboard, Element, Event, Hasher, Layout, Length, Point,
- Rectangle, Size, Widget,
+ input::mouse, layout, Clipboard, Element, Event, Hasher, Layout, Length,
+ Point, Rectangle, Size, Widget,
};
use std::{hash::Hash, ops::RangeInclusive};
@@ -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();
+ }
}
- }
+ _ => {}
+ },
_ => {}
}
}