anchorToPoint

Commons
stable

Convert a parsed anchor descriptor (side + align) into an absolute viewport-space point relative to the given bounding box.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

anchor
required
TParsedAnchor
A parsed anchor object with a side (top | bottom | left | right) and an align value specifying the cross-axis position.
box
required
IBox
The bounding box (x, y, width, height) of the reference element.

API

Return value

The value returned by this util.

A viewport-space {x, y} coordinate at the computed anchor position on the bounding box.

Usage

Examples

Ready-to-paste usage snippets.

Convert a top-center anchor to a point

typescript