Skip to content

Function: safeArea() ​

ts
function safeArea(
   cell, 
   layout, 
   options?
): Rect;

The largest axis-aligned rectangle that fits wholly inside a cell's shape (its outline, holes and rounded corners), so content placed there isn't clipped. With aspect, the largest rectangle of that shape. Among equally large positions it picks the one nearest the cell's center. In layout coordinates; see safeAreaCss for CSS.

Works for any shape, convex or not. Results are cached per cell.

Parameters ​

ParameterType
cellCell
layoutPick<Layout, "cornerRadius" | "view">
optionsSafeAreaOptions

Returns ​

Rect

Hat tiling and isohedral tilings after Craig S. Kaplan's hatviz and Tactile (BSD 3-Clause).