pub enum Event {
MousePress {
button: MouseButton,
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
MouseRelease {
button: MouseButton,
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
MouseMotion {
button: Option<MouseButton>,
delta: (f32, f32),
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
MouseWheel {
delta: (f32, f32),
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
PinchGesture {
delta: f32,
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
RotationGesture {
delta: Radians,
position: PhysicalPoint,
modifiers: Modifiers,
handled: bool,
},
MouseEnter,
MouseLeave,
KeyPress {
kind: Key,
modifiers: Modifiers,
handled: bool,
},
KeyRelease {
kind: Key,
modifiers: Modifiers,
handled: bool,
},
ModifiersChange {
modifiers: Modifiers,
},
Text(String),
}
Expand description
An input event (from mouse, keyboard or similar).
Variants§
MousePress
Fired when a button is pressed or the screen is touched.
MouseRelease
Fired when a button is released or the screen is stopped being touched.
MouseMotion
Fired continuously when the mouse or a finger on the screen is moved.
Fields
Type of button if a button is pressed.
delta: (f32, f32)
The relative movement of the mouse/finger since last Event::MouseMotion event in logical pixels.
position: PhysicalPoint
The screen position in physical pixels.
MouseWheel
Fired continuously when the mouse wheel or equivalent is applied.
Fields
delta: (f32, f32)
The relative scrolling since the last Event::MouseWheel event.
position: PhysicalPoint
The screen position in physical pixels.
PinchGesture
Fired continuously when a pinch input gesture is recognized, such as on a Mac trackpad
Fields
delta: f32
The relative pinching since the last Event::PinchGesture event (positive is zoom in).
position: PhysicalPoint
The screen position in physical pixels.
RotationGesture
Fired continuously when a rotation input gesture is recognized, such as on a Mac trackpad
Fields
delta: Radians
The relative rotation since the last Event::RotationGesture event (positive is counterclockwise).
position: PhysicalPoint
The screen position in physical pixels.
MouseEnter
Fired when the mouse enters the window.
MouseLeave
Fired when the mouse leaves the window.
KeyPress
Fired when a key is pressed.
Fields
KeyRelease
Fired when a key is released.
Fields
ModifiersChange
Fired when the modifiers change.
Text(String)
Fires when some text has been written.