iced-yoda/core/src/mouse/event.rs

58 lines
1.3 KiB
Rust
Raw Normal View History

2019-07-20 19:12:31 +02:00
use super::Button;
/// A mouse event.
2019-09-05 09:59:38 +02:00
///
/// _**Note:** This type is largely incomplete! If you need to track
/// additional events, feel free to [open an issue] and share your use case!_
///
/// [open an issue]: https://github.com/hecrj/iced/issues
2019-07-20 19:12:31 +02:00
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Event {
/// The mouse cursor entered the window.
CursorEntered,
/// The mouse cursor left the window.
CursorLeft,
/// The mouse cursor was moved
CursorMoved {
/// The X coordinate of the mouse position
x: f32,
/// The Y coordinate of the mouse position
y: f32,
},
/// A mouse button was pressed.
ButtonPressed(Button),
/// A mouse button was released.
ButtonReleased(Button),
2019-07-20 19:12:31 +02:00
/// The mouse wheel was scrolled.
WheelScrolled {
/// The scroll movement.
delta: ScrollDelta,
},
2019-10-29 19:00:46 +01:00
}
/// A scroll movement.
2019-10-29 19:00:46 +01:00
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ScrollDelta {
/// A line-based scroll movement
2019-10-29 19:00:46 +01:00
Lines {
2019-07-20 19:12:31 +02:00
/// The number of horizontal lines scrolled
2019-10-29 19:00:46 +01:00
x: f32,
2019-07-20 19:12:31 +02:00
/// The number of vertical lines scrolled
2019-10-29 19:00:46 +01:00
y: f32,
},
/// A pixel-based scroll movement
2019-10-29 19:00:46 +01:00
Pixels {
/// The number of horizontal pixels scrolled
x: f32,
/// The number of vertical pixels scrolled
y: f32,
2019-07-20 19:12:31 +02:00
},
}