PointerDown

View source

Captures the pointer data emitted by a browser pointerdown event.

The value preserves the pointer identity and device type, maps the browser button code to key, and stores the event’s local offset as a reusable Vector2 position.

Examples

const down = new PointerDown(event)
if (down.key === 0) console.log('primary pointer pressed', down.position)

Constructor


constructor(event: PointerEvent)

View source

Maps pointerId to id, pointerType to pointerType, and button to key. The position is set from the event’s offsetX and offsetY.

Parameters

NameDescriptionDefault
event

Browser pointer event to capture.

—

Properties


readonlypointerType: string

View source

The browser pointerType, such as mouse, pen, or touch.

readonlykey: number

View source

The browser button value for the pressed button. This field is named key to match the window input event API.

readonlyposition: Vector2

View source

Local pointer coordinates copied from offsetX and offsetY.

Default: ...