elementToViewport

Commons
stable

Converts a point in element-local space to viewport space by adding the element's bounding-box offset. Inverse of viewportToElement.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

point
required
TElementPoint
A point in element-local coordinates (x, y relative to the element origin).
offset
required
TOffset | IBox
The element's position in the viewport, expressed as a TOffset { x, y } or IBox (DOMRect-like) whose x/y properties are used.

API

Return value

The value returned by this util.

The equivalent point in viewport coordinates.

Usage

Examples

Ready-to-paste usage snippets.

Convert element-local point to viewport

typescript