@vladkrutenyuk/three-kvy-core
Version:
Everything you need to create any-complexity 3D apps with Three.js. Empower Three.js with a modular, lifecycle-managed context that seamlessly propagates through objects via reusable features providing structured logic.
29 lines (28 loc) • 1.19 kB
TypeScript
import { CoreContext, CoreContextModule, ModulesRecordDefault, ReturnOfUseCtx } from "@vladkrutenyuk/three-kvy-core";
export declare class KeysInput extends CoreContextModule {
readonly isKeysInput: true;
/** (readonly) Flag to check if `shift` key is pressed */
get shift(): boolean;
/** (readonly) Flag to check if `alt` key is pressed */
get alt(): boolean;
/** (readonly) Flag to check if `ctrl` key is pressed */
get ctrl(): boolean;
/** (readonly) Flag to check if `meta` key is pressed */
get meta(): boolean;
_shift: boolean;
_alt: boolean;
_ctrl: boolean;
_meta: boolean;
private readonly _keys;
constructor();
protected useCtx(ctx: CoreContext<ModulesRecordDefault>): ReturnOfUseCtx;
/**
* Check if key is pressed now.
* @param {globalThis.KeyboardEvent["code"]} key - current pressed key in format of {@link https://developer.mozilla.org/docs/Web/API/KeyboardEvent/code KeyboardEvent.code}. Example: `KeyW`, `KeyD`, `Digit2`, `Space`, etc.
*/
has: (key: globalThis.KeyboardEvent["code"]) => boolean;
private onKeyDown;
private onKeyUp;
private onBlur;
private updFnKeys;
}