Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more tools for UI tree traversal #15923

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/bevy_ui/src/accessibility.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
experimental::UiChildren,
experimental::UiTree,
prelude::{Button, Label},
widget::TextUiReader,
ComputedNode, UiImage,
Expand Down Expand Up @@ -66,11 +66,11 @@ fn calc_bounds(
fn button_changed(
mut commands: Commands,
mut query: Query<(Entity, Option<&mut AccessibilityNode>), Changed<Button>>,
ui_children: UiChildren,
ui_tree: UiTree,
mut text_reader: TextUiReader,
) {
for (entity, accessible) in &mut query {
let name = calc_name(&mut text_reader, ui_children.iter_ui_children(entity));
let name = calc_name(&mut text_reader, ui_tree.iter_children(entity));
if let Some(mut accessible) = accessible {
accessible.set_role(Role::Button);
if let Some(name) = name {
Expand All @@ -93,11 +93,11 @@ fn button_changed(
fn image_changed(
mut commands: Commands,
mut query: Query<(Entity, Option<&mut AccessibilityNode>), (Changed<UiImage>, Without<Button>)>,
ui_children: UiChildren,
ui_tree: UiTree,
mut text_reader: TextUiReader,
) {
for (entity, accessible) in &mut query {
let name = calc_name(&mut text_reader, ui_children.iter_ui_children(entity));
let name = calc_name(&mut text_reader, ui_tree.iter_children(entity));
if let Some(mut accessible) = accessible {
accessible.set_role(Role::Image);
if let Some(name) = name {
Expand Down
245 changes: 0 additions & 245 deletions crates/bevy_ui/src/experimental/ghost_hierarchy.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/bevy_ui/src/experimental/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
//! Be careful when using these features, especially in concert with third-party crates,
//! as they may not be fully supported, functional or stable.

mod ghost_hierarchy;
mod ui_tree;

pub use ghost_hierarchy::*;
pub use ui_tree::*;
Loading