bevy/crates/bevy_input_focus
Erick Z ced6159d93
Improve bevy_input_focus (#16749)
# Objective

I was curious to use the newly created `bevy_input_focus`, but I found
some issues with it
  - It was only implementing traits for `World`.
  - Lack of tests
  - `is_focus_within` logic was incorrect.


## Solution
 This PR includes some improvements to the `bevy_input_focus` crate: 
- Add new `IsFocusedHelper` that doesn't require access to `&World`. It
implements `IsFocused`
- Remove `IsFocused` impl for `DeferredWorld`. Since it already
implements `Deref<Target=World>` it was just duplication of code.
- impl `SetInputFocus` for `Commands`. There was no way to use
`SetFocusCommand` directly. This allows it.
- The `is_focus_within` logic has been fixed to check descendants.
Previously it was checking if any of the ancestors had focus which is
not correct according to the documentation.
  - Added a bunch of unit tests to verify the logic of the crate.

## Testing

- Did you test these changes? If so, how? Yes, running newly added unit
tests.

---
2024-12-12 19:15:08 +00:00
..
src Improve bevy_input_focus (#16749) 2024-12-12 19:15:08 +00:00
Cargo.toml Improve bevy_input_focus (#16749) 2024-12-12 19:15:08 +00:00
README.md Add "bevy_input_focus" crate. (#15611) 2024-12-05 18:08:31 +00:00

Bevy Input Focus

License Crates.io Downloads Docs Discord