mirror of
https://github.com/kou029w/pucchinglgl.git
synced 2025-01-18 16:18:00 +00:00
refactor: handlers
This commit is contained in:
parent
8bc857d54f
commit
1b20ffa334
1 changed files with 3 additions and 3 deletions
|
@ -112,17 +112,17 @@ function main() {
|
|||
root.addEventListener("keydown", handleKeydown);
|
||||
root.addEventListener("touchstart", handleTouchmove, { passive: false });
|
||||
root.addEventListener("touchmove", handleTouchmove, { passive: false });
|
||||
root.addEventListener("keyup", handleMouseMoveEnd);
|
||||
root.addEventListener("touchend", handleMouseMoveEnd);
|
||||
root.addEventListener("mousedown", () => {
|
||||
root.addEventListener("mousemove", handleMouseMove);
|
||||
});
|
||||
for (const event of ["mouseup", "mouseleave"] as const) {
|
||||
root.addEventListener(event, () => {
|
||||
root.removeEventListener("mousemove", handleMouseMove);
|
||||
handleMouseMoveEnd();
|
||||
});
|
||||
}
|
||||
for (const event of ["keyup", "mouseup", "mouseleave", "touchend"] as const) {
|
||||
root.addEventListener(event, handleMouseMoveEnd);
|
||||
}
|
||||
root.appendChild(canvas);
|
||||
Object.assign(root.style, { overflow: "hidden", overscrollBehavior: "none" });
|
||||
window.addEventListener("resize", adjustCanvasSize);
|
||||
|
|
Loading…
Add table
Reference in a new issue