register method

void register(
  1. InteractableComponentInstance c
)

Registers a component to be considered for focus and hover handling.

Must be called once for each interactive component in the UI before handling input. Components should be re-registered every frame after layout, since componentInstances is cleared on reset.

Implementation

void register(InteractableComponentInstance c) {
  context.componentInstances.add(c);
  if (context.componentInstances.length - 1 ==
      context.currentComponentIndex) {
    context.currentComponent = c;
    context.currentComponent!.focus();
  }
}