Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/layout

LayoutNode: a headless flex layout engine with no Pixi in it.

import { LayoutNode } from 'pixi-silk/layout';

Classes#

ClassDescription
LayoutNodeA box in a layout tree. Give it a style, children or a measure function, then call LayoutNode.calculate on the root. Each node’s LayoutNode.layout holds its box.

Interfaces#

InterfaceDescription
ComputedLayoutThe box a layout pass computed for a node, relative to its parent’s top-left corner.
LayoutStyleThe style of a layout node. Every property is optional and defaults to the CSS initial value.
SizeA size in pixels.

Type Aliases#

Type AliasDescription
AlignContentCross axis distribution of the lines of a wrapping container.
AlignItemsCross axis alignment of items in their line. baseline lines up first text baselines in a row.
EdgesBox edges, as in CSS: one value for all sides, [vertical, horizontal], [top, horizontal, bottom] or [top, right, bottom, left].
FlexDirectionMain axis of a container. row lays children out left to right, column top to bottom.
JustifyContentMain axis distribution of the free space in a line.
LengthA length: pixels, a percent of the containing box ('50%') or 'auto'.
MeasureFunctionMeasures leaf content (text, a sprite) for the space offered. Either argument is Infinity when that axis is unconstrained. Return the content size without padding. baseline is the distance from the top to the first text baseline, for alignItems: 'baseline'.