Skip to main content

Module pointer

Module pointer 

Source
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:

§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§

PersistentDeviceId
An identifier for the pointing device that is stable across the session.
PointerButtonEvent
An event representing a PointerButton that was pressed or released.
PointerButtons
A set of PointerButtons.
PointerGestureEvent
An event representing a gesture
PointerId
A unique identifier for the pointer.
PointerInfo
Identifying information about a pointer, stable across states.
PointerOrientation
Orientation of a pointer.
PointerScrollEvent
An event representing a scroll
PointerState
A single pointer state.
PointerUpdate
A pointer update, along with coalesced and predicted states.

Enums§

PointerButton
Describes a button of a pointer input device, such as a mouse or stylus pen.
PointerEvent
A standard PointerEvent.
PointerGesture
A touchpad gesture for pointer.
PointerType
The type of device that has generated a pointer event.

Type Aliases§

ContactGeometry
The size of an input, usually touch.