Skip to main content

Accessors

note

All Module accessors are available in this class.

container

Type: HTMLElement | SVGElement

Returns the container element handling events.

const pointers = new Pointers({
container: document.getElementById('container'),
});

pointers.container; // container element

isStarted

Type: boolean

Indicates whether the start event has been triggered.

const pointers = new Pointers({
container: document.getElementById('container'),
});

pointers.isStarted; // true or false

move

Type: IPointersMove | null

Latest aggregated gesture snapshot from the most recent move update, or null before the first move after start / after end.

const pointers = new Pointers({
container: document.getElementById('container'),
minPointers: 2,
});

pointers.move?.center; // midpoint between pointers
pointers.move?.scale; // pinch multiplier since gesture start

pointersMap

Type: Map<number, IPointersItem>

Contains all currently active pointers.
Keys correspond to native pointerId values from Pointer Events API.
Entries are updated every frame and preserved until the pointer is fully released (pointerup / pointercancel).

const pointers = new Pointers({
container: document.getElementById('container'),
});

pointers.pointersMap; // map of active pointers