Add FocusPolicy to NodeBundle and ImageBundle (#3952)
# Objective `FocusPolicy` allows tracking `Interaction` of a parent node when a player hovers/clicks at the child node, and I see no reason why it shouldn't exist in these 2 nodes. Resolves #2488 ## Solution Add it! In the tracking system it's used as `Option`:e749ee786c/crates/bevy_ui/src/focus.rs (L71)and then it treats it as `Block` if it's not present:e749ee786c/crates/bevy_ui/src/focus.rs (L162)and the default value ise749ee786c/crates/bevy_ui/src/focus.rs (L47-L51)so it should be compatible with all existing UIs that use `..Default::default()`
This commit is contained in:
parent
5104397683
commit
d3e526bfc0
@ -23,6 +23,8 @@ pub struct NodeBundle {
|
|||||||
pub color: UiColor,
|
pub color: UiColor,
|
||||||
/// Describes the image of the node
|
/// Describes the image of the node
|
||||||
pub image: UiImage,
|
pub image: UiImage,
|
||||||
|
/// Whether this node should block interaction with lower nodes
|
||||||
|
pub focus_policy: FocusPolicy,
|
||||||
/// The transform of the node
|
/// The transform of the node
|
||||||
pub transform: Transform,
|
pub transform: Transform,
|
||||||
/// The global transform of the node
|
/// The global transform of the node
|
||||||
@ -46,6 +48,8 @@ pub struct ImageBundle {
|
|||||||
pub color: UiColor,
|
pub color: UiColor,
|
||||||
/// The image of the node
|
/// The image of the node
|
||||||
pub image: UiImage,
|
pub image: UiImage,
|
||||||
|
/// Whether this node should block interaction with lower nodes
|
||||||
|
pub focus_policy: FocusPolicy,
|
||||||
/// The transform of the node
|
/// The transform of the node
|
||||||
pub transform: Transform,
|
pub transform: Transform,
|
||||||
/// The global transform of the node
|
/// The global transform of the node
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user