generateLayers

Commons
stable

Compute the cumulative layout offset layers for the Origam layout system. Each registered layout item (AppBar, NavigationDrawer, Footer…) contributes its size to the running totals for its side (top/bottom/left/right), producing a cascade of offset objects used by the layout composable.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

layout
required
Array<string>
Ordered list of layout item IDs. Items are stacked in this order.
positions
required
Map<string, Ref<TDirectionBoth>>
Map from layout item ID to its anchored side (top | bottom | left | right).
layoutSizes
required
Map<string, Ref<number | string>>
Map from layout item ID to its rendered size on its anchor axis (pixels or CSS length).
activeItems
required
Map<string, Ref<boolean>>
Map from layout item ID to its visibility state. Inactive items contribute 0 to the offset.

API

Return value

The value returned by this util.

Ordered array of layer snapshots. Each entry holds the ID and the cumulative ILayer offsets at that point in the stack.

Usage

Examples

Ready-to-paste usage snippets.

Compute layout offsets for AppBar + Footer

typescript