Spaces:
Running
Running
Download editor/src/Controls.ts from dylanebert/gsplat-editor: direct link, hf CLI and curl.
- Browser
- Download file 848 Bytes
-
https://huggingface.co/spaces/dylanebert/gsplat-editor/resolve/main/editor/src/Controls.ts
- Command line
-
hf download hf://spaces/dylanebert/gsplat-editor/editor/src/Controls.ts
-
curl -L -o Controls.ts https://huggingface.co/spaces/dylanebert/gsplat-editor/resolve/main/editor/src/Controls.ts
848 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("mousedown", this.handleInput.bind(this)); | |
| canvas.addEventListener("mousemove", this.handleInput.bind(this)); | |
| canvas.addEventListener("mouseup", 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 }; | |