#[non_exhaustive]pub enum InputEvent {
PointerMoved {
position: Point,
},
PointerButton {
button: PointerButton,
state: ElementState,
position: Point,
modifiers: Modifiers,
},
PointerScroll {
delta_x: f32,
delta_y: f32,
position: Point,
},
PointerLeft,
TouchDown {
id: TouchId,
position: Point,
},
TouchMoved {
id: TouchId,
position: Point,
},
TouchUp {
id: TouchId,
position: Point,
cancelled: bool,
},
Key {
code: KeyCode,
state: ElementState,
repeat: bool,
modifiers: Modifiers,
},
Text {
ch: char,
},
SurfaceResized {
size: Size,
scale_factor: f32,
},
CloseRequested,
}Expand description
Something the user or the windowing system did.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PointerMoved
The pointer moved to position.
PointerButton
A pointer button changed state.
PointerScroll
The wheel or a scroll gesture moved.
Both deltas are content offsets, not device movement: positive y
scrolls content down and positive x scrolls it right, which is the
sign a scroll view adds straight to its offset. A backend reporting the
gesture instead — most of them do — negates both on the way in.
Saying it for one axis and not the other is how the horizontal wheel
came out backwards on macOS and stayed that way: y carried this note
and x carried none, so the runner negated one and passed the other
through.
Fields
PointerLeft
The pointer left the surface. Clear hover state.
TouchDown
A finger touched down.
Fields
id: TouchIdFinger identity, valid until the matching InputEvent::TouchUp.
TouchMoved
A finger moved while down.
TouchUp
A finger lifted, or its sequence was cancelled.
Fields
Key
A key changed state.
Fields
state: ElementStateDown or up.
Text
Committed text, one character at a time.
Emitted after dead-key composition, so pressing ¨ then o yields exactly
one Text('ö') and no text for the dead key itself.
SurfaceResized
The surface changed size or DPI. Invalidate layout and damage history.
Fields
CloseRequested
The user asked to close. The application decides whether to honour it.
Trait Implementations§
Source§impl Clone for InputEvent
impl Clone for InputEvent
Source§fn clone(&self) -> InputEvent
fn clone(&self) -> InputEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more