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 viewport_interaction_active condition #101

Merged
merged 1 commit into from
Mar 28, 2024
Merged

fix viewport_interaction_active condition #101

merged 1 commit into from
Mar 28, 2024

Conversation

imsfc
Copy link
Contributor

@imsfc imsfc commented Mar 27, 2024

Fixes #100

@jakobhellermann
Copy link
Owner

good find, thanks for the fix

@jakobhellermann jakobhellermann merged commit 87e0ce6 into jakobhellermann:main Mar 28, 2024
@jakobhellermann
Copy link
Owner

jakobhellermann commented Mar 28, 2024

Hm, seem like this fix breaks scrolling in the orbit cam, I'll have to investigate

@jakobhellermann
Copy link
Owner

jakobhellermann commented Mar 28, 2024

I think the real fix here would be to only react to scroll mouse events from the editor window, which would also fix #78

@jakobhellermann
Copy link
Owner

jakobhellermann commented Mar 28, 2024

Okay, now I remember how that code was supposed to work.

The editor cameras should only be active when you're not currently hovering the editor UI, i.e. only active when !pointer_used. But that alone would mean that when you start dragging the camera around and move outside the viewport into editor UI, it would suddenly stop turning the camera. So even if pointer_used, if you're currently in an active editor interaction (dragging the mouse), then viewport_interaction_active is true.

So the problematic situation occurs when

  1. start click in editor window (egui input.pointer.press_start_time is set)
  2. drag mouse over to other window (or alt tab so you end up on other window) -> press_start_time is never cleared
  3. bevy_editor_pls never thinks you stopped dragging your mouse, so when you drag around on the main window the camera is still active

Clicking once on the editor window clears this state and everything behaves as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

viewport_interaction_active function error
2 participants