@qubixstudio/webinput
v0.0.19
Published
Helper for working with input in web development, dedicated mostly for threejs projects.
Downloads
104
Maintainers
Readme
webinput
Handle mouse and keyboard inputs by interface. Using
Web Input Interface
onMouseClick(event: QMouseEvent): void
onMouseDown(event: QMouseEvent): void
onMouseDrag(event: QMouseEvent): void
onMouseUp(event: QMouseEvent): void
onMouseMove(event: QMouseEvent): void
onMouseDragClick(event: QMouseEvent): void
onKeyDown(event: KeyboardEvent): void
onKeyUp(event: KeyboardEvent): void
Usage
import { IInputListener, QMouseEvent, InputMgr } from '@qubixdevops/webinput';
class YourCalss implements IInputListener {
initInput() : void {
InputMgr.instance.registerDom("HTMLCanvasElement");
InputMgr.instance.addListener(this);
}
destroy() : void {
InputMgr.instance.unregisterDom("HTMLCanvasElement");
}
onMouseClick(event: QMouseEvent): void {
//handle mouse click
}
onKeyDown(event: KeyboardEvent): void {
//handle key click
}
}
Created by qubixstudio
https://www.qubixstudio.com/