The per-pointer position maps and input context.
ReadonlyoriginsReadonlypreviousReadonlypositionsReadonlyeventReadonlytoolThe name of the tool this event is attributed to, or undefined when no tool was
current. Resolve it to the tool itself with GradumEvent.tool.
ReadonlyeventReadonlyclickReadonlyinputReadonlykeysReadonlypositionWhether GradumEvent.scaledPosition and its per-pointer equivalents actually
scale, or hand back the raw position. Assign a callback to decide per read — useful when a canvas
is only sometimes transformed. Defaults to true.
GradumDragEvent.origins in document space. Falls back to the raw origins when scaling is not authorized.
GradumDragEvent.previousPositions in document space. Falls back to the raw positions when scaling is not authorized.
GradumDragEvent.positions in document space. Falls back to the raw positions when scaling is not authorized.
GradumDragEvent.deltaPositions in document space, so the deltas match the coordinates of a panned or zoomed canvas.
The event position in document space, obtained by running GradumEvent.position
through scalePosition. Falls back to the raw position when scaling is not authorized.
Function
closest
The type of element to look for.
The constructor to match against.
Optionalstrict: boolean | Element
When true, the match must also contain the event
position, so an ancestor the pointer has left is rejected. Pass an Element to test against that
element's bounds instead, or false to skip the check.
Optionalfrom: ClosestOrigin
Where to start searching from.
The nearest matching element, or null if there is none.
Function
closest
A custom-element tag name, or a CSS selector.
Optionalstrict: boolean | Element
When true, the match must also contain the event
position. Pass an Element to test against that element's bounds instead, or false to skip it.
Optionalfrom: ClosestOrigin
Where to start searching from.
The nearest matching element, or null if there is none.
ProtectedscaleProtected Function
scalePositionsMap
A new map with each position scaled. The input is unchanged.
Map every point in a per-pointer map into document space. Used by GradumDragEvent to expose scaled variants of its position maps.
GradumDragEvent
Description
The event fired for
gradum-drag,gradum-drag-start, andgradum-drag-end. It tracks every active pointer at once, so a multi-touch drag reports one entry per finger: each map below is keyed by pointer id. Every position is available raw and scaled into document space, along with the per-event deltas.