Documentation
    Preparing search index...

    Function collectPickables

    • Collects the §71 picking candidates of a UI tree into out, root first and then depth-first in insertion order, and returns it.

      const candidates: Pickable[] = [];               // reused
      const input = new PointerInput(canvas, {
      camera,
      pickables: () => collectPickables(uiRoot, candidates),
      });

      A subtree is pruned at any node that is visible = false or enabled = false — a hidden panel's buttons are not clickable, and pruning at the node rather than filtering per widget means a plain Group hides its UI descendants too. A widget that survives the walk is a candidate unless it is UIWidget.interactive = false, which drops that widget alone and keeps its children.

      The order matters: pick sorts hits by distance with a stable sort, and coplanar widgets are all at the same distance, so a tie resolves to whichever came first here — the ancestor. A child that must win over its parent needs a real depth difference, which is why layout never writes z: set child.transform.position.z (a few thousandths toward the camera is enough) and the picker orders them properly.

      Zero-alloc when out is supplied: it is overwritten and truncated.

      Parameters

      Returns Pickable[]