Skip to content
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 incorrect drag when pressing after a movement #53

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Dec 29, 2023

implements suggestion from https://github.com/johanhelsing/bevy_pancam/pull/48/files#r1346483971

Description from #48:

When combining pancam drag with other draggable elements, I wanted to disable pancams before it could move.

Unfortunately the current pancam movement implementation can move the camera the first frame we detect a button_grab, as if user was already button_grabing previous frame.

more context for this: https://discord.com/channels/844211600009199626/1158800311171960972/1159149631117201419

Most important information from discord's discussion: pancam's implementation leads to such scenario:

### frames

  1. no click, position(0,0)
  2. click, position(0,1) -> pancam detects a drag (because we cached last position, without checking for grab_button) and moves (green 🟢) ; but bevy_mod_input only detects the click (I think that's more correct)
  3. position(0,2) -> I disable the pancam (red 🔴), pancam doesn't run (orange 🟠 )
Italian Trulli

@johanhelsing johanhelsing added the bug Something isn't working label Jan 6, 2024
Copy link
Owner

@johanhelsing johanhelsing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@johanhelsing johanhelsing merged commit 9951359 into johanhelsing:main Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants