2019-08-29 01:35:37 +02:00
|
|
|
/// The button of a mouse.
|
2019-07-20 19:12:31 +02:00
|
|
|
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
|
|
|
|
pub enum Button {
|
2019-08-29 01:35:37 +02:00
|
|
|
/// The left mouse button.
|
2019-07-20 19:12:31 +02:00
|
|
|
Left,
|
2019-08-29 01:35:37 +02:00
|
|
|
|
|
|
|
|
/// The right mouse button.
|
2019-07-20 19:12:31 +02:00
|
|
|
Right,
|
2019-08-29 01:35:37 +02:00
|
|
|
|
|
|
|
|
/// The middle (wheel) button.
|
2019-07-20 19:12:31 +02:00
|
|
|
Middle,
|
2019-08-29 01:35:37 +02:00
|
|
|
|
|
|
|
|
/// Some other button.
|
2019-07-20 19:12:31 +02:00
|
|
|
Other(u8),
|
|
|
|
|
}
|
2019-09-02 05:10:14 +02:00
|
|
|
|
|
|
|
|
#[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),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|