fix: add tablet support for toplevel windows
This commit is contained in:
parent
5fc4372d87
commit
890a53fef1
1 changed files with 25 additions and 0 deletions
|
|
@ -269,6 +269,13 @@ pub fn window_event(
|
||||||
scale_factor,
|
scale_factor,
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
winit::event::PointerSource::TabletTool { .. } => {
|
||||||
|
let position = position.to_logical::<f64>(scale_factor);
|
||||||
|
|
||||||
|
Some(Event::Mouse(mouse::Event::CursorMoved {
|
||||||
|
position: Point::new(position.x as f32, position.y as f32),
|
||||||
|
}))
|
||||||
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
// TODO how to handle this for Touch? Is it different than a press? Need to double check winit impl
|
// TODO how to handle this for Touch? Is it different than a press? Need to double check winit impl
|
||||||
|
|
@ -306,6 +313,24 @@ pub fn window_event(
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
WindowEvent::PointerButton {
|
||||||
|
button: ButtonSource::TabletTool { button, .. },
|
||||||
|
state,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let button: Option<winit::event::MouseButton> = button.into();
|
||||||
|
|
||||||
|
button.map(mouse_button).map(|button| {
|
||||||
|
Event::Mouse(match state {
|
||||||
|
winit::event::ElementState::Pressed => {
|
||||||
|
mouse::Event::ButtonPressed(button)
|
||||||
|
}
|
||||||
|
winit::event::ElementState::Released => {
|
||||||
|
mouse::Event::ButtonReleased(button)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
WindowEvent::PointerButton {
|
WindowEvent::PointerButton {
|
||||||
button: ButtonSource::Touch { finger_id, force },
|
button: ButtonSource::Touch { finger_id, force },
|
||||||
state,
|
state,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue