@egjs/axes
Version:
A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.
35 lines (34 loc) • 1.05 kB
TypeScript
import { ElementType } from "../types";
import { InputType, InputTypeObserver } from "./InputType";
export declare const KEY_LEFT_ARROW = 37;
export declare const KEY_A = 65;
export declare const KEY_UP_ARROW = 38;
export declare const KEY_W = 87;
export declare const KEY_RIGHT_ARROW = 39;
export declare const KEY_D = 68;
export declare const KEY_DOWN_ARROW = 40;
export declare const KEY_S = 83;
export interface MoveKeyInputOption {
scale?: number[];
}
export declare class MoveKeyInput implements InputType {
options: MoveKeyInputOption;
axes: string[];
element: HTMLElement;
private _observer;
private _enabled;
private _holding;
private _timer;
constructor(el: ElementType, options?: MoveKeyInputOption);
mapAxes(axes: string[]): void;
connect(observer: InputTypeObserver): InputType;
disconnect(): this;
destroy(): void;
enable(): this;
disable(): this;
isEnabled(): boolean;
private _onKeydown;
private _onKeyup;
private _attachEvent;
private _detachEvent;
}