fix: attached mouse event listener to window instead of canvas element
This commit is contained in:
@@ -312,7 +312,7 @@ void main() {
|
||||
uniforms.iMouse.value = [x, y];
|
||||
}
|
||||
};
|
||||
canvas.addEventListener('pointermove', onPointerMove);
|
||||
window.addEventListener('pointermove', onPointerMove);
|
||||
|
||||
const loop = (t: number) => {
|
||||
rafRef.current = requestAnimationFrame(loop);
|
||||
@@ -357,7 +357,7 @@ void main() {
|
||||
|
||||
return () => {
|
||||
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
||||
canvas.removeEventListener('pointermove', onPointerMove);
|
||||
window.removeEventListener('pointermove', onPointerMove);
|
||||
observer.disconnect();
|
||||
ro.disconnect();
|
||||
if (canvas.parentElement === container) {
|
||||
|
||||
Reference in New Issue
Block a user