Skip to content

@modoki/engine / index / pickInDirection

Function: pickInDirection()

pickInDirection(from, candidates, dir): string | null

Nearest focusable in dir from from, scored by distance ALONG the axis plus a penalty for perpendicular offset (so a slightly-off but closer target still wins, but a wildly-sideways one loses). Candidates not strictly in the pressed direction are excluded. Returns the winning GUID or null. Pure — the app feeds real rects, tests feed fabricated ones.

Parameters

from

ScreenRect

candidates

object[]

dir

NavDir

Returns

string | null

Built with Modoki.