Skip to content

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

@Weibye

Description

@Weibye

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions