gsplat-editor / editor /src /Controls.ts
dylanebert's picture
dylanebert HF staff
initial commit
e6b949c
raw
history blame
700 Bytes
import { InputHandler } from "./InputHandler";
class Controls {
private _inputHandlers: InputHandler[];
constructor(inputHandlers: InputHandler[], canvas: HTMLCanvasElement) {
this._inputHandlers = inputHandlers;
window.addEventListener("keydown", this.handleInput.bind(this));
canvas.addEventListener("mousemove", this.handleInput.bind(this));
canvas.addEventListener("click", this.handleInput.bind(this));
canvas.addEventListener("contextmenu", this.handleInput.bind(this));
}
handleInput(event: Event) {
for (const handler of this._inputHandlers) {
handler.handleInput(event);
}
}
}
export { Controls };