Reference · Browser table and SVG
landInDirectionfunction
The territory a key moves to from another: the nearest counter in that
direction, a little straighter being better than a little nearer, and only
among those inside view (the whole map when none is given), so that the
focus never leaves what is on the screen. Null when nothing lies that way.
Import it
import { landInDirection } from "@johnmorrisdotca/tenka/ui";
Definition
function landInDirection(from: number, arrow: TenkaArrow, map?: TenkaMapKey, view?: TenkaView): number | null
Parameters
| Name | Type | Description |
|---|---|---|
from | number | The source territory index. |
arrow | TenkaArrow | The keyboard navigation direction. |
map (optional) | TenkaMapKey | The native world or Europe map to use. |
view (optional) | TenkaView | undefined | The visible map bounds; the full map when omitted. |
Returns
number | null
The nearest territory in the direction and view, or null when none is available.
Examples
import { landInDirection } from "@johnmorrisdotca/tenka/ui";
console.log(landInDirection(0,"right"));1What it prints (run when this page was built)