This commit is contained in:
Olivier 'reivilibre' 2021-06-26 23:57:24 +01:00
parent 05abfc00cc
commit 9cdd7c5527

View File

@ -237,10 +237,11 @@ where
} }
} }
Event::Touch(x) => { Event::Touch(x) => {
eprintln!("B {:?} Bds {:?}", x, layout.bounds()); eprintln!("B {:?} Bds {:?} P {:?}", x, layout.bounds(), self.fingers_mid_press);
match x { match x {
touch::Event::FingerPressed { id, position } => { touch::Event::FingerPressed { id, position } => {
if layout.bounds().contains(position) { if layout.bounds().contains(position) {
eprintln!("ins");
let _ = self.fingers_mid_press.insert(id); let _ = self.fingers_mid_press.insert(id);
return event::Status::Captured; return event::Status::Captured;
@ -248,6 +249,7 @@ where
} }
touch::Event::FingerMoved { id, position } => { touch::Event::FingerMoved { id, position } => {
if !layout.bounds().contains(position) { if !layout.bounds().contains(position) {
eprintln!("exited");
let _ = self.fingers_mid_press.remove(&id); let _ = self.fingers_mid_press.remove(&id);
} else { } else {
return event::Status::Captured; return event::Status::Captured;
@ -257,6 +259,7 @@ where
if self.fingers_mid_press.remove(&id) if self.fingers_mid_press.remove(&id)
&& layout.bounds().contains(position) && layout.bounds().contains(position)
{ {
eprintln!("lifted");
// this should be treated as a click // this should be treated as a click
if let Some(on_press) = self.on_press.clone() { if let Some(on_press) = self.on_press.clone() {
messages.push(on_press); messages.push(on_press);