pixi-silk/ui/keys
Shared keyboard state: isKeyDown, modifier checks, onKey, isTypingTarget.
import { altDown, isKeyDown, isTypingTarget, modDown } from 'pixi-silk/ui/keys';
Functions#
| Function | Description |
|---|---|
| altDown | True while either Alt / Option is down. |
| isKeyDown | True while the key with this KeyboardEvent.code is down (e.g. ShiftLeft, KeyR, Space). |
| isTypingTarget | True when a key event comes from an input, textarea, select or content-editable element. The keys then belong to the field and not to the canvas. |
| modDown | True while either Control or Meta (Command) is down. |
| onKey | Calls fn on every key press and release on window. Auto-repeat presses are skipped. When the window loses focus, every held key gets a synthetic release. Returns the unsubscribe function. |
| shiftDown | True while either Shift is down. |