pub trait IsFocused {
// Required methods
fn is_focused(&self, entity: Entity) -> bool;
fn is_focus_within(&self, entity: Entity) -> bool;
fn is_focus_visible(&self, entity: Entity) -> bool;
fn is_focus_within_visible(&self, entity: Entity) -> bool;
}
Expand description
Trait which defines methods to check if an entity currently has focus.
This is implemented for World
and IsFocusedHelper
.
DeferredWorld
indirectly implements it through Deref
.
For use within systems, use IsFocusedHelper
.
Modify the InputFocus
resource to change the focused entity.
Required Methods§
Sourcefn is_focused(&self, entity: Entity) -> bool
fn is_focused(&self, entity: Entity) -> bool
Returns true if the given entity has input focus.
Sourcefn is_focus_within(&self, entity: Entity) -> bool
fn is_focus_within(&self, entity: Entity) -> bool
Returns true if the given entity or any of its descendants has input focus.
Note that for unusual layouts, the focus may not be within the entity’s visual bounds.
Sourcefn is_focus_visible(&self, entity: Entity) -> bool
fn is_focus_visible(&self, entity: Entity) -> bool
Returns true if the given entity has input focus and the focus indicator should be visible.
Sourcefn is_focus_within_visible(&self, entity: Entity) -> bool
fn is_focus_within_visible(&self, entity: Entity) -> bool
Returns true if the given entity, or any descendant, has input focus and the focus indicator should be visible.