Closed 0-zen closed 1 year ago
Wow, yeah you're right, onMouseMove()
is being called multiple times before getMouseDelta()
is read. It looks like when devtools is closed all mouse events are coalesced into one event but when it is open then each event is emitted separately.
I think a better fix would be simply to remove line this.prevMouse = this.currMouse;
from onMouseMove()
, that way the previous mouse position will stay as the last position a delta was calculated from.
If you wanna update the PR with the change above I'll approve and get this merged. Thanks for pointing out what was wrong, I've taken a stab at this issue a few times and it stumped me so massive thanks.
No problem 👍 this repo is useful so I might continue to either tackle issues or make improvements. Was a pain to get git to understand where I wanted to push but here you go, the changes are done :)
Fixes #75
Nature of the bug: The devtools augmented significantly the number of calls to onMouseMove() per second (~50 -> ~450), which led to mouse deltas to get smaller. My guess is that it made the update of the mouse position in the model throttle.
Here's what I did:
Edited mouse.ts to add a limit to how many calls per second (max 25/s)
Ran
npm audit fix
to update some of the dependencies