Skip to content

1681-engine / ui / InputShield

Class: InputShield ​

Defined in: src/ui/dom/InputShield.ts:14

Keeps input meant for the DOM UI from reaching the engine. It listens on the overlay's root as events bubble out of it and stops the ones shouldShield names, so the element under them still gets them (a text field still types) but listeners on the window and document (Keyboard, a game's own) never hear them.

Presses on the overlay never reach Pointer anyway, which counts presses only on the canvas; the shield covers keys, wheel and window-level listeners. Releases always pass, or a key held when a field took focus would stick.

Constructors ​

Constructor ​

ts
new InputShield(root, options?): InputShield;

Defined in: src/ui/dom/InputShield.ts:17

Parameters ​

ParameterType
rootHTMLElement
optionsShieldOptions

Returns ​

InputShield

Accessors ​

typing ​

Get Signature ​

ts
get typing(): boolean;

Defined in: src/ui/dom/InputShield.ts:25

Whether the player is typing in a field of the UI now (a game may also skip its hotkeys).

Returns ​

boolean

Methods ​

destroy() ​

ts
destroy(): void;

Defined in: src/ui/dom/InputShield.ts:30

Returns ​

void

Released under the MIT License.