1681-engine / ui / UiPointerGate
Variable: UiPointerGate ​
const UiPointerGate: object;Defined in: src/ui/UiPointerGate.ts:17
Keeps a press on a canvas widget from also counting as a press in the world.
Pixi's event system listens on the canvas in the capture phase, so it hit-tests the widgets and runs their pointerdown handlers before Pointer's own listener on the same canvas sees the event. A widget marks the native event (consume), and the gate, chained into Pointer.ignorePress, tells Pointer to leave that press out. A game's own ignorePress keeps working: the gate asks it too.
Type Declaration ​
consume() ​
consume(e): void;Marks a native event (a federated event's nativeEvent) as taken by the UI.
Parameters ​
| Parameter | Type |
|---|---|
e | object | null | undefined |
Returns ​
void
install() ​
install(): () => void;Chains the gate into Pointer.ignorePress; counted, so two UI roots install it once. Returns the uninstall.
Returns ​
() => void
wasConsumed() ​
wasConsumed(e): boolean;Whether the UI took this native event (a game's own canvas listener may ask too).
Parameters ​
| Parameter | Type |
|---|---|
e | object | null | undefined |
Returns ​
boolean