1681-engine / ui / nextFocus
Function: nextFocus() ​
ts
function nextFocus(
rects,
current,
dir,
wrap?
): number;Defined in: src/ui/layout/focusNav.ts:32
Spatial navigation (a gamepad's d-pad, the arrow keys): from current, the nearest item whose centre lies in dir, an item straight ahead preferred over a nearer one off to the side. With wrap, going past the last item comes back in from the far side on the same line. Returns current when nothing lies that way.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
rects | readonly Rect[] | undefined |
current | number | undefined |
dir | NavDirection | undefined |
wrap | boolean | false |
Returns ​
number