Skip to main content

Function: uiAxisValue()

uiAxisValue(axis): number

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

Reads a UiAxis's literal size (UiPointAxis.size) or margin (UiStretchAxis.margin) - whichever field this axis's kind actually has - without the caller needing to branch on kind itself. Useful for code that treats an axis as an opaque "the number that isn't the anchor/pivot" regardless of what it means, e.g. a layout group falling back to an unmanaged child's own current size on an axis it doesn't control.

Parameters​

axis​

UiAxis

The axis to read.

Returns​

number

axis.size for a point axis, axis.margin for a stretch axis.