Allow panning with touch inputs (#130)

* Allow panning with touch inputs

* Fix code formatting

Co-authored-by: Max Ammann <max@maxammann.org>
This commit is contained in:
Antoine Drabble 2022-06-20 15:50:58 +02:00 committed by GitHub
parent f0f244ee65
commit 2b13668727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -91,7 +91,9 @@ impl InputController {
}
WindowEvent::Touch(touch) => match touch.phase {
TouchPhase::Started => {
self.pan_handler.process_touch_start();
let position: (f64, f64) = touch.location.to_owned().into();
self.pan_handler
.process_touch_start(&Vector2::from(position));
self.query_handler.process_touch_start();
true
}

View File

@ -67,8 +67,9 @@ impl PanHandler {
}
}
pub fn process_touch_start(&mut self) -> bool {
pub fn process_touch_start(&mut self, window_position: &Vector2<f64>) -> bool {
self.is_panning = true;
self.start_window_position = Some(*window_position);
true
}