Handling multiple mouse move events


The project in work on requires multiple mouse move events which need to be handled at once.

For example:

1: MouseMove event which run a real-time coordinated updater using ray caster
2: MouseMove event which allows me to click and drag objects in scene

These two function need to be executed at once. Though I can add two event Listeners as the project grows and more such events might be needed, the complexity increases. I’m looking for some way in which I can handle all the mouse events at once place and execute the logic (which I’m looking for).


I think you can handle the mouse events easily in react three fiber. All the events will be fired in an organized way and it will not put you in a complicated codebase.

I don’t think its that easy. These events are to be executed every frame and these tends to be lag when CPU intense functions are binded to mouse event handler. The functions completes execution after the frame is rendered.