The 2D layer · function
uiHitTest
The interactive node under a point, or null.
Explained in Sprites and tilemaps.
function uiHitTest(root: UiNode, x: number, y: number): UiNode | nullimport { uiHitTest } from '@driftengine/ui2d';Parameters
| Parameter | Type | Description |
|---|---|---|
root | UiNode | |
x | number | |
y | number |
In depth
Searched last-drawn first, because the last thing drawn is the thing on top and a hit test that disagreed with the picture would be a button that responds where it is not.
A node that is not interactive does not block what is behind it. A panel is a backdrop, and
a backdrop that swallowed clicks would make every button under a plate dead — which is the
failure a caller cannot see and would spend an afternoon on. A caller that wants a modal to
swallow clicks marks the modal itself interactive, which says so.
Allocates nothing.