Skip to main content

InputEvent

Type Alias InputEvent 

Source
pub type InputEvent = Event;
Expand description

Alias used by platform backends for standard events.

Aliased Type§

pub enum InputEvent {
    Tick,
    PointerDown {
        x: i32,
        y: i32,
    },
    PointerUp {
        x: i32,
        y: i32,
    },
    PointerMove {
        x: i32,
        y: i32,
    },
    Touch {
        count: u8,
        points: [TouchPoint; 5],
    },
    PressDown {
        x: i32,
        y: i32,
    },
    PressRelease {
        x: i32,
        y: i32,
    },
    DoubleTap {
        x: i32,
        y: i32,
    },
    KeyDown {
        key: Key,
    },
    KeyUp {
        key: Key,
    },
}

Variants§

§

Tick

Called periodically to advance animations or timers.

§

PointerDown

A pointer (mouse or touch) was pressed at the given coordinates.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

PointerUp

The pointer was released.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

PointerMove

The pointer moved while still pressed.

Fields

§x: i32

Horizontal coordinate relative to the widget origin.

§y: i32

Vertical coordinate relative to the widget origin.

§

Touch

Multi-touch frame with per-point data.

Emitted when two or more simultaneous contacts are detected. Only points[..count] entries are valid.

Fields

§count: u8

Number of active contact points (2..=[MAX_TOUCH_POINTS]).

§points: [TouchPoint; 5]

Per-point data. Entries beyond count are meaningless.

§

PressDown

Stable contact began (debounced). Use for visual press feedback such as button highlighting. Emitted by the gesture recognizer, not by raw hardware input.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

PressRelease

Stable contact released (debounced). The primary “click/tap” action trigger. Widgets should match this instead of PointerUp for reliable single-fire behavior.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

DoubleTap

Two consecutive short taps detected at the given coordinates. Emitted by the DoubleTapRecognizer when two PressRelease events with short hold durations occur within the double-tap time window.

Fields

§x: i32

Horizontal coordinate.

§y: i32

Vertical coordinate.

§

KeyDown

A keyboard key was pressed.

Fields

§key: Key

Key that was pressed.

§

KeyUp

A keyboard key was released.

Fields

§key: Key

Key that was released.