Skip to content

1681-engine / ui / anchorPosition

Function: anchorPosition() ​

ts
function anchorPosition(
   anchor, 
   size, 
   viewport, 
   margin?, 
   snap?
): Point;

Defined in: src/ui/layout/anchor.ts:23

Top-left of a box of size pinned to anchor of the viewport, margin in from the edges (a number, or per side for a phone's notch). Centred anchors ignore the margins of the sides they do not touch.

Parameters ​

ParameterTypeDefault value
anchorScreenAnchorundefined
sizeSizeundefined
viewportSizeundefined
marginnumber | Partial<Insets>0
snapbooleanfalse

Returns ​

Point

Released under the MIT License.