Skip to content

projectPointer

projectPointer(ev, target): object

Defined in: src/modules/input/pointer-provider.ts:150

The default DPI-aware canvas projection: maps an event’s client coordinates to the target’s backing-pixel coordinates. For a canvas-like target (one exposing numeric width/height) it scales the CSS-space offset by width / rect.width (and the same for height), so a CSS-stretched or high-DPR canvas still reports coordinates in its drawing-buffer space. Non-canvas targets fall back to the raw rect-local offset.

Accepts any event with clientX/clientY (Pointer, Mouse, Touch-derived), so it works equally in pointer* and click/dblclick handlers. This is the same projection PointerProvider applies by default; it is exported so consumers that read the pointer at event time (rather than through the tick-read provider) can share the exact math instead of re-deriving it.

number

number

PointerTarget

object

x: number

y: number