
# 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. ---
28 lines
928 B
TOML
28 lines
928 B
TOML
[package]
|
|
name = "bevy_input_focus"
|
|
version = "0.15.0-dev"
|
|
edition = "2021"
|
|
description = "Keyboard focus management"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
rust-version = "1.76.0"
|
|
|
|
[dependencies]
|
|
bevy_app = { path = "../bevy_app", version = "0.15.0-dev", default-features = false }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev", default-features = false }
|
|
bevy_input = { path = "../bevy_input", version = "0.15.0-dev", default-features = false }
|
|
bevy_hierarchy = { path = "../bevy_hierarchy", version = "0.15.0-dev", default-features = false }
|
|
bevy_window = { path = "../bevy_window", version = "0.15.0-dev", default-features = false }
|
|
|
|
[dev-dependencies]
|
|
smol_str = "0.2"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
|
|
all-features = true
|