-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
If there is no movement, DragStart is not triggered. #17233
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Startled that direct float equality works here, and that the previous pr didn't use an epsilon. I need to review what's been happening here, but I we should probably just be ignoring movement events on the input side if they don't actually move. |
crates/bevy_picking/src/events.rs
Outdated
@@ -668,6 +668,9 @@ pub fn pointer_events( | |||
|
|||
// Emit DragEntry and DragStart the first time we move while pressing an entity | |||
for (press_target, (location, _, hit)) in state.pressing.iter() { | |||
if delta == Vec2::ZERO { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't this be done outside of the loop? delta
doesn't change with each iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the delta of a move event is zero, subsequent events should be skipped. |
Looking good, thanks. After further review, looks like the other check is a slightly different cross-frame delta. So this all looks correct now and what I said earlier about moving it was wrong. It's still weird that we don't need an epsilon here, but I'll take it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the "raw" inputs that we get from the OS / input devices are filtered to remove tiny perturbations, which is why we end up not needing an epsilon. I've watched the mouse input streams before and they're shockingly un-jittery.
If it moves, Drag should be triggered again, so since it has been checked above, the check in Drag below should be unnecessary, right? |
It doesn't seem to be a logical conclusion. Since it's correct, I won't bother with it anymore (sorry) |
Objective
Fixed the issue where DragStart was triggered even when there was no movement
#17230
Solution
Testing
Migration Guide