PointerTracker

class PointerTracker(pointerEvents: PointerEvents)(source)

Tracks the state of pointer interactions in an application.

The PointerTracker class listens to pointer events provided by a PointerEvents object and maintains a map of active pointers. Each pointer is uniquely identified by its ID and stores information such as its position and pressure.

The class subscribes to the following pointer events:

  • pointerDown: Adds a new pointer to the tracker when a pointer is pressed down.

  • moved: Updates the state of an existing pointer when it moves.

  • pointerUp: Removes a pointer from the tracker when it is released.

Parameters

pointerEvents

The source of pointer events to track.

Constructors

Link copied to clipboard
constructor(pointerEvents: PointerEvents)

Creates a PointerTracker instance that starts listening to the provided PointerEvents object.

Properties

Link copied to clipboard

A mutable map of active pointers. The keys represent the unique pointer IDs, and the values are Pointer objects containing the state of each pointer.