-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(useRaycaster): set delta on pointer-missed events #853
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi, @andretchen0 is this contemplated in your refactor #844? Should we merge this PR first? |
In the event system rewrite, Here's the code. (It's called const distance = (incomingEvent.type === 'click' || incomingEvent.type === 'contextmenu' || incomingEvent.type === 'dblclick' || incomingEvent.type === 'pointerup')
? Math.sqrt(((incomingEvent.offsetX - config.pointerDownPosition.x) ** 2) + ((incomingEvent.offsetY - config.pointerDownPosition.y) ** 2))
: 0 Also in the rewrite, users can supply their own Fwiw, for the use case under discussion, the new system also implements pointer capture, which makes dragging things around a lot simpler.
I don't have a feeling one way or another on this one. |
Fwiw, the new event system sets Screen.Recording.2024-10-17.at.13.11.31.movBut,
So, again, I don't have a strong opinion here. We can merge here if it helps someone, but there are changes in the pipeline for the next major version. |
Hi @AntoninRousset did you check the latest comments? We are currently working on something that will change some of the behaviors on v5, let us know if you still want to merge this one in the meantime |
Thank you @alvarosabu. I think the suggested behaviour makes sense (to be honest, I even thought this already the case). I would expect Would you also fire a Nevertheless, the constant delta of 0 we are experimenting now seems to be a bug and I am happy to see that it will be fixed. Personally I don't need this to be merged soon, so I guess you can close this. |
That's how the current event system handles it, but that changes with the new version.
This brings us closer to R3F's behavior. And it's more flexible:
This is a case I've thought about handling. I would be interested in getting more details. Can you put a code example an explanation in StackBlitz or elsewhere? Thanks! |
Fixes #852.
Introduces a very small overhead because the delta is computed for every pointerup event.