Skip to main content

Function: setUiFocus()

setUiFocus(world, canvas, entity): void

Defined in: ui/utilities/set-ui-focus.ts:20

Moves canvas's focus to entity (or clears it, for null), keeping CanvasEcsComponent.focusedEntity and the previous/next UiInteractableEcsComponent.isFocused flags in sync. Shared by createUiNavigationEcsSystem (directional navigation, cancelInput) and createUiInteractionEcsSystem (the pointer hovering an element also focuses it, so the highlight follows the mouse), so both focus paths agree on what "focused" means.

Parameters​

world​

EcsWorld

The ECS world canvas and entity belong to.

canvas​

CanvasEcsComponent

The canvas whose focus is changing.

entity​

number | null

The entity to focus, or null to clear focus.

Returns​

void