The 2D layer · function
routeUiKey
Route a key. Returns the node it activated, or null.
Explained in Sprites and tilemaps.
function routeUiKey(input: UiInput, root: UiNode, key: string, shift?: boolean): UiNode | nullimport { routeUiKey } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
input | UiInput | |
root | UiNode | |
key | string | |
shift? | boolean |
In depth
Three keys and no more: Tab and Shift+Tab move focus, Enter and ' ' activate what has it.
Everything else is the caller's — a text field's own characters, a game's own bindings — and is
reported as unhandled by returning null so the caller can tell.
key is a DOM KeyboardEvent.key, because that is what a consumer already has and inventing a
second spelling of Tab would be a table to keep in step.