mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
Android: Improved multi-touch (#1783)
* Improved multi-touch * Update feature matrix * Generate cancelled events for all pointers * Changed back features matrix layout * Reduced code duplication * Updated changelog * Revert changelog update
This commit is contained in:
@@ -193,14 +193,27 @@ impl<T: 'static> EventLoop<T> {
|
||||
}
|
||||
_ => None, // TODO mouse events
|
||||
};
|
||||
|
||||
if let Some(phase) = phase {
|
||||
for pointer in motion_event.pointers() {
|
||||
let pointers: Box<
|
||||
dyn Iterator<Item = ndk::event::Pointer<'_>>,
|
||||
> = match phase {
|
||||
event::TouchPhase::Started
|
||||
| event::TouchPhase::Ended => Box::new(
|
||||
std::iter::once(motion_event.pointer_at_index(
|
||||
motion_event.pointer_index(),
|
||||
)),
|
||||
),
|
||||
event::TouchPhase::Moved
|
||||
| event::TouchPhase::Cancelled => {
|
||||
Box::new(motion_event.pointers())
|
||||
}
|
||||
};
|
||||
|
||||
for pointer in pointers {
|
||||
let location = PhysicalPosition {
|
||||
x: pointer.x() as _,
|
||||
y: pointer.y() as _,
|
||||
};
|
||||
|
||||
let event = event::Event::WindowEvent {
|
||||
window_id,
|
||||
event: event::WindowEvent::Touch(
|
||||
|
||||
Reference in New Issue
Block a user