Skip to content

Interface: PointerEngine

@roomful/core


@roomful/core / PointerEngine

Defined in: packages/core/src/types.ts:1626

Exposes the laser-pointer primitive for a room. A pointer engine broadcasts this peer’s transient “beam” position while active and surfaces remote peers’ beams so they can be drawn. It is close to the cursor engine, but a beam is only broadcast while PointerEngine.activate is in effect — deactivating (or unmounting/disconnecting) makes the beam disappear for every peer.

Like cursors and viewport, it rides the room’s event channel and uses normalized (01) coordinates, so no relay change is required.

activate(): void

Defined in: packages/core/src/types.ts:1650

Starts broadcasting this peer’s pointer beam. While active, pointer movement over the mounted element is broadcast to peers.

void

Nothing.


deactivate(): void

Defined in: packages/core/src/types.ts:1658

Stops broadcasting and announces an inactive beam so peers drop it (the laser disappears).

void

Nothing.


getAll(): PointerBeam[]

Defined in: packages/core/src/types.ts:1673

Returns all remote pointer beams.

PointerBeam[]

The current remote beams.


mount(element): void

Defined in: packages/core/src/types.ts:1634

Tracks mousemove on a container and broadcasts the normalized pointer position while active. Mounting also targets the built-in renderer.

HTMLElement

The container element to track.

void

Nothing.


render(options?): Unsubscribe

Defined in: packages/core/src/types.ts:1684

Renders a built-in, zero-config DOM overlay that draws every remote active beam over the container, updating as beams change. This is a convenience layer; apps that draw their own pointers can ignore it and use PointerEngine.subscribe instead.

PointerRenderOptions

The overlay container and style.

Unsubscribe

A cleanup function that removes the overlay.


subscribe(cb): Unsubscribe

Defined in: packages/core/src/types.ts:1666

Subscribes to remote pointer beams.

(beams) => void

The callback invoked with the current remote beams.

Unsubscribe

A function that removes the listener.


unmount(): void

Defined in: packages/core/src/types.ts:1642

Stops tracking the element, broadcasts an inactive beam so peers drop it, and tears down the built-in overlay.

void

Nothing.