The 2D layer · function

uiFocusOrder

Every focusable node, in tree order, appended to out.

Explained in Sprites and tilemaps.

function uiFocusOrder(root: UiNode, out: UiNode[]): UiNode[]
import { uiFocusOrder } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
rootUiNode
outUiNode[]

In depth

Tree order rather than a declared tab index: the order a tree is built in is the order it reads in, and a second ordering is a second thing to keep in step with the first. A caller that wants a different order moves the node.

out is cleared first and reused, so a caller may hold one array. This is not a per-frame path — focus changes when a key is pressed.