pub enum Event {
MousePress {
button: MouseButton,
position: (f64, f64),
modifiers: Modifiers,
handled: bool,
},
MouseRelease {
button: MouseButton,
position: (f64, f64),
modifiers: Modifiers,
handled: bool,
},
MouseMotion {
button: Option<MouseButton>,
delta: (f64, f64),
position: (f64, f64),
modifiers: Modifiers,
handled: bool,
},
MouseWheel {
delta: (f64, f64),
position: (f64, f64),
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
Fields
Type of button
position: (f64, f64)The screen position in logical pixels, to get it in physical pixels, multiply it with the device pixel ratio. The first value defines the position on the horizontal axis with zero being at the left border of the window and the second on the vertical axis with zero being at the top edge of the window.
Fired when a button is pressed or the screen is touched.
MouseRelease
Fields
Type of button
position: (f64, f64)The screen position in logical pixels, to get it in physical pixels, multiply it with the device pixel ratio. The first value defines the position on the horizontal axis with zero being at the left border of the window and the second on the vertical axis with zero being at the top edge of the window.
Fired when a button is released or the screen is stopped being touched.
MouseMotion
Fields
Type of button if a button is pressed.
delta: (f64, f64)The relative movement of the mouse/finger since last Event::MouseMotion event.
position: (f64, f64)The screen position in logical pixels, to get it in physical pixels, multiply it with the device pixel ratio. The first value defines the position on the horizontal axis with zero being at the left border of the window and the second on the vertical axis with zero being at the top edge of the window.
Fired continuously when the mouse or a finger on the screen is moved.
MouseWheel
Fields
delta: (f64, f64)The relative scrolling since the last Event::MouseWheel event.
position: (f64, f64)The screen position in logical pixels, to get it in physical pixels, multiply it with the device pixel ratio. The first value defines the position on the horizontal axis with zero being at the left border of the window and the second on the vertical axis with zero being at the top edge of the window.
Fired continuously when the mouse wheel or equivalent is applied.
MouseEnter
Fired when the mouse enters the window.
MouseLeave
Fired when the mouse leaves the window.
KeyPress
Fields
Fired when a key is pressed.
KeyRelease
Fields
Fired when a key is released.
ModifiersChange
Fired when the modifiers change.
Text(String)
Fires when some text has been written.