fix: attached mouse event listener to window instead of canvas element

This commit is contained in:
Melvin Ragusa
2026-01-23 11:54:30 +01:00
parent 4d8fc7ad85
commit f3ff2a7b9c

View File

@@ -312,7 +312,7 @@ void main() {
uniforms.iMouse.value = [x, y]; uniforms.iMouse.value = [x, y];
} }
}; };
canvas.addEventListener('pointermove', onPointerMove); window.addEventListener('pointermove', onPointerMove);
const loop = (t: number) => { const loop = (t: number) => {
rafRef.current = requestAnimationFrame(loop); rafRef.current = requestAnimationFrame(loop);
@@ -357,7 +357,7 @@ void main() {
return () => { return () => {
if (rafRef.current) cancelAnimationFrame(rafRef.current); if (rafRef.current) cancelAnimationFrame(rafRef.current);
canvas.removeEventListener('pointermove', onPointerMove); window.removeEventListener('pointermove', onPointerMove);
observer.disconnect(); observer.disconnect();
ro.disconnect(); ro.disconnect();
if (canvas.parentElement === container) { if (canvas.parentElement === container) {