The 2D layer · function

routeUiPointer

Route a pointer. Returns the node this call activated, or null.

Explained in Sprites and tilemaps.

function routeUiPointer(input: UiInput, root: UiNode, x: number, y: number, down: boolean): UiNode | null
import { routeUiPointer } from '@driftengine/ui2d';

Parameters

ParameterTypeDescription
inputUiInput
rootUiNode
xnumber
ynumber
downboolean

In depth

An activation is a press and a release on the same node, which is what every pointer convention worth copying does and what lets somebody who has pressed the wrong button slide off it and let go. A release somewhere else clears the press and activates nothing.

Press moves focus to the node pressed when that node is focusable, and leaves focus alone otherwise — clicking the background should not silently take the keyboard away from a field.

Allocates nothing, and is meant to be called once per frame with whatever the pointer is doing.