Ui Button is still considered pressed when holding down, but moving cursor out of the button Rect
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 4d 8m
- Merged PRs (30d)
- 147
Description
## Bevy version
Current main, 2f4cf768661839079f49fe5ef9527248a9131b95
## 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)
```rs
pub enum CapturePolicy {
Capture,
NotCapture
}
```
Contributor guide
Assessment
This issue has not been assessed yet.