pub enum Event {
Show 27 variants
MouseMove {
position: Point,
},
MouseDown {
position: Point,
button: MouseButton,
},
MouseUp {
position: Point,
button: MouseButton,
},
Scroll {
delta_x: f32,
delta_y: f32,
},
KeyDown {
key: Key,
},
KeyUp {
key: Key,
},
TextInput {
text: String,
},
FocusIn,
FocusOut,
MouseEnter,
MouseLeave,
Resize {
width: f32,
height: f32,
},
TouchStart {
id: TouchId,
position: Point,
pressure: f32,
},
TouchMove {
id: TouchId,
position: Point,
pressure: f32,
},
TouchEnd {
id: TouchId,
position: Point,
},
TouchCancel {
id: TouchId,
},
PointerDown {
pointer_id: PointerId,
pointer_type: PointerType,
position: Point,
pressure: f32,
is_primary: bool,
button: Option<MouseButton>,
},
PointerMove {
pointer_id: PointerId,
pointer_type: PointerType,
position: Point,
pressure: f32,
is_primary: bool,
},
PointerUp {
pointer_id: PointerId,
pointer_type: PointerType,
position: Point,
is_primary: bool,
button: Option<MouseButton>,
},
PointerCancel {
pointer_id: PointerId,
},
PointerEnter {
pointer_id: PointerId,
pointer_type: PointerType,
},
PointerLeave {
pointer_id: PointerId,
pointer_type: PointerType,
},
GesturePinch {
scale: f32,
center: Point,
state: GestureState,
},
GestureRotate {
angle: f32,
center: Point,
state: GestureState,
},
GesturePan {
delta: Point,
velocity: Point,
state: GestureState,
},
GestureLongPress {
position: Point,
},
GestureTap {
position: Point,
count: u8,
},
}Expand description
Input event types.
Variants§
MouseMove
Mouse moved to position
MouseDown
Mouse button pressed
MouseUp
Mouse button released
Scroll
Mouse wheel scrolled
KeyDown
Key pressed
KeyUp
Key released
TextInput
Text input received
FocusIn
Widget gained focus
FocusOut
Widget lost focus
MouseEnter
Mouse entered widget bounds
MouseLeave
Mouse left widget bounds
Resize
Window resized
TouchStart
Touch started
Fields
TouchMove
Touch moved
TouchEnd
Touch ended
TouchCancel
Touch cancelled (e.g., palm rejection)
PointerDown
Pointer down
PointerMove
Pointer moved
Fields
§
pointer_type: PointerTypePointer type
PointerUp
Pointer up
PointerCancel
Pointer cancelled
PointerEnter
Pointer entered element
PointerLeave
Pointer left element
GesturePinch
Pinch gesture
GestureRotate
Rotate gesture
Fields
§
state: GestureStateGesture state
GesturePan
Pan/drag gesture
GestureLongPress
Long press gesture
GestureTap
Tap gesture
Implementations§
Source§impl Event
impl Event
Sourcepub const fn is_keyboard(&self) -> bool
pub const fn is_keyboard(&self) -> bool
Check if this is a keyboard event.
Sourcepub const fn is_pointer(&self) -> bool
pub const fn is_pointer(&self) -> bool
Check if this is a pointer event.
Sourcepub const fn is_gesture(&self) -> bool
pub const fn is_gesture(&self) -> bool
Check if this is a gesture event.
Sourcepub const fn pointer_id(&self) -> Option<PointerId>
pub const fn pointer_id(&self) -> Option<PointerId>
Get the pointer ID if this is a pointer event.
Sourcepub const fn pointer_type(&self) -> Option<PointerType>
pub const fn pointer_type(&self) -> Option<PointerType>
Get the pointer type if this is a pointer event.
Sourcepub const fn gesture_state(&self) -> Option<GestureState>
pub const fn gesture_state(&self) -> Option<GestureState>
Get gesture state if this is a gesture event.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more