Skip to main content

Type Alias: UiAxis

UiAxis = UiPointAxis | UiStretchAxis

Defined in: ui/types/ui-axis.ts:72

One axis (x or y) of a RectTransformEcsComponent. Every field a UiPointAxis needs (size) is meaningless for a UiStretchAxis (which needs margin instead) and vice versa, so the two are modeled as a discriminated union on kind rather than one shape carrying both a size and a margin field of which only one actually applies - this is what makes it impossible to, say, set a margin on an axis that's actually point-anchored. Construct one with UiAxis's own point/stretch factories rather than a raw object literal.