Add conversion for MouseButton in winit
This commit is contained in:
parent
6d248719f3
commit
28009bc26d
3 changed files with 184 additions and 180 deletions
|
|
@ -13,3 +13,15 @@ pub enum Button {
|
|||
/// Some other button.
|
||||
Other(u8),
|
||||
}
|
||||
|
||||
#[cfg(feature = "winit")]
|
||||
impl From<winit::event::MouseButton> for super::Button {
|
||||
fn from(mouse_button: winit::event::MouseButton) -> Self {
|
||||
match mouse_button {
|
||||
winit::event::MouseButton::Left => Button::Left,
|
||||
winit::event::MouseButton::Right => Button::Right,
|
||||
winit::event::MouseButton::Middle => Button::Middle,
|
||||
winit::event::MouseButton::Other(other) => Button::Other(other),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue