Turn Touch into a touch::Event enum
This commit is contained in:
parent
09110a93b0
commit
3bdf931925
9 changed files with 89 additions and 118 deletions
|
|
@ -4,7 +4,7 @@
|
|||
use crate::event::{self, Event};
|
||||
use crate::layout;
|
||||
use crate::mouse;
|
||||
use crate::touch::{self, Touch};
|
||||
use crate::touch;
|
||||
use crate::{
|
||||
Clipboard, Element, Hasher, Layout, Length, Point, Rectangle, Widget,
|
||||
};
|
||||
|
|
@ -166,10 +166,7 @@ where
|
|||
) -> event::Status {
|
||||
match event {
|
||||
Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left))
|
||||
| Event::Touch(Touch {
|
||||
phase: touch::Phase::Started,
|
||||
..
|
||||
}) => {
|
||||
| Event::Touch(touch::Event::FingerPressed { .. }) => {
|
||||
if self.on_press.is_some() {
|
||||
let bounds = layout.bounds();
|
||||
|
||||
|
|
@ -181,10 +178,7 @@ where
|
|||
}
|
||||
}
|
||||
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||
| Event::Touch(Touch {
|
||||
phase: touch::Phase::Ended,
|
||||
..
|
||||
}) => {
|
||||
| Event::Touch(touch::Event::FingerLifted { .. }) => {
|
||||
if let Some(on_press) = self.on_press.clone() {
|
||||
let bounds = layout.bounds();
|
||||
|
||||
|
|
@ -199,10 +193,7 @@ where
|
|||
}
|
||||
}
|
||||
}
|
||||
Event::Touch(Touch {
|
||||
phase: touch::Phase::Canceled,
|
||||
..
|
||||
}) => {
|
||||
Event::Touch(touch::Event::FingerLost { .. }) => {
|
||||
self.state.is_pressed = false;
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue