Skip to content

Commit

Permalink
UI debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Davier committed Jan 6, 2021
1 parent cd8007a commit 63a52a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/bevy_ui/src/flex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ without UI components as a child of an entity with UI components, results may be
}
}
if !contains {
info!("added window roots");
let new_root = self
.stretch
.new_node(stretch::style::Style::default(), vec![*child])
Expand Down Expand Up @@ -240,6 +241,7 @@ pub fn flex_node_system(
Flags<Transform>,
)>,
) {
info!("flex_node_system");
// assume one window for time being...
let logical_to_physical_factor = if let Some(primary_window) = windows.get_primary() {
primary_window.scale_factor()
Expand All @@ -248,6 +250,7 @@ pub fn flex_node_system(
};

if scale_factor_reader.latest(&scale_factor_events).is_some() {
info!("changed scale factor");
update_changed(
&mut *flex_surface,
logical_to_physical_factor,
Expand All @@ -266,6 +269,7 @@ pub fn flex_node_system(
{
// update changed nodes
for (entity, style, calculated_size) in query.iter() {
info!("changed style {:?}", entity);
// TODO: remove node from old hierarchy if its root has changed
if let Some(calculated_size) = calculated_size {
flex_surface.upsert_leaf(entity, &style, *calculated_size, scaling_factor);
Expand All @@ -276,6 +280,7 @@ pub fn flex_node_system(
}

for (entity, style, calculated_size) in changed_size_query.iter() {
info!("changed calculated size {:?} {:?}", entity, calculated_size);
flex_surface.upsert_leaf(entity, &style, *calculated_size, logical_to_physical_factor);
}

Expand All @@ -288,11 +293,13 @@ pub fn flex_node_system(

// update children
for (entity, children) in children_query.iter() {
info!("changed children {:?}: {:?}", entity, children);
flex_surface.update_children(entity, &children);
}

// update the window's root nodes if it was resized
for event in resized_reader.iter(&resized_events) {
info!("resized window");
flex_surface.update_window(windows.get(event.id).unwrap());
}

Expand Down

0 comments on commit 63a52a1

Please sign in to comment.