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

Ui Button is still considered pressed when holding down, but moving cursor out of the button Rect #7239

Open
Weibye opened this issue Jan 16, 2023 · 1 comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Feature A new feature, making something new possible

Comments

@Weibye
Copy link
Contributor

Weibye commented Jan 16, 2023

Bevy version

Current main, 2f4cf76

What you did

  1. run ui/button example
  2. press cursor down on button
  3. It reads "Pressed"
  4. Keep holding mouse button down
  5. Move cursor out of the Button Rect
  6. It still reads "Pressed" until the mouse is released, regardless of where the cursor is at the time of release

What were you expecting?

I would expect the button to stop being considered pressed when moving out of the bounds of the button.
At the very least I would expect it to stop being considered pressed when exiting the window.

Additional information

Now, that being said, I'm pretty sure we do want to keep the behaviour for buttons or other interactable UI elements to "capture mouse", but there should also be a way to set up an interactable element so that it considers moving out of the bounds as a "release"

Perhaps something like this to go with the Interaction enum? (Not very attached to the name)

pub enum CapturePolicy {
    Capture,
    NotCapture
}
@Weibye Weibye added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible labels Jan 16, 2023
@Pietrek14
Copy link
Contributor

I will try to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants