Skip to content

Function: penSample()

penSample(event): PenSample

Defined in: telemetry.ts:216

Normalize a pointer event into a PenSample, deriving whichever orientation pair the browser withheld.

Preference order when both are present: spherical wins. It is the newer, higher-resolution pair (radians, not rounded integer degrees), and a tilt pair derived from it loses precision that a tilt pair reported natively would also have lost — so there is nothing to gain by preferring the legacy field and real resolution to lose.

With neither, the pen is treated as upright: altitude = π/2, azimuth = 0. That is exactly right for a mouse, and it is the graceful degradation for a stylus whose browser tells us nothing — the tilt dynamics simply go quiet and pressure and velocity carry the stroke alone.

Parameters

event

PointerLike

Returns

PenSample