Expand description
§Pointer event types
This module contains the core types for representing pointer input across mice, pens, and touch. These types are transport-agnostic and can be produced from platform backends (e.g. winit, web) and consumed in UI code.
§Key ideas:
PointerIdandPersistentDeviceIdhelp correlate states over time.PointerStatecarries position, pressure, tilt, modifiers and more.PointerEventis the main event enum: down/up/move/enter/leave/scroll/gesture.PointerInfo::is_primary_pointeris a convenience for primary interactions.
§Example: checking for primary pointer and using logical coordinates
use ui_events::pointer::{PointerEvent, PointerUpdate};
fn handle(ev: PointerEvent) {
if let PointerEvent::Move(PointerUpdate { pointer, current, .. }) = ev {
if pointer.is_primary_pointer() {
let lp = current.logical_position();
let _ = (lp.x, lp.y);
}
}
}Structs§
- Persistent
Device Id - An identifier for the pointing device that is stable across the session.
- Pointer
Button Event - An event representing a
PointerButtonthat was pressed or released. - Pointer
Buttons - A set of
PointerButtons. - Pointer
Gesture Event - An event representing a gesture
- Pointer
Id - A unique identifier for the pointer.
- Pointer
Info - Identifying information about a pointer, stable across states.
- Pointer
Orientation - Orientation of a pointer.
- Pointer
Scroll Event - An event representing a scroll
- Pointer
State - A single pointer state.
- Pointer
Update - A pointer update, along with coalesced and predicted states.
Enums§
- Pointer
Button - Describes a button of a pointer input device, such as a mouse or stylus pen.
- Pointer
Event - A standard
PointerEvent. - Pointer
Gesture - A touchpad gesture for pointer.
- Pointer
Type - The type of device that has generated a pointer event.
Type Aliases§
- Contact
Geometry - The size of an input, usually touch.