Skip to content

Commit

Permalink
Remove different handling for childless nodes
Browse files Browse the repository at this point in the history
Having an empty children list should be the same as having no child
component.
  • Loading branch information
svents committed Nov 24, 2020
1 parent f7af601 commit d7afe94
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/bevy_ui/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ fn update_hierarchy(
previous_result,
);
}
} else {
previous_result = Some(parent_result);
}

previous_result
previous_result.or(Some(parent_result))
}

fn update_node_entity(
Expand Down Expand Up @@ -163,11 +161,11 @@ mod tests {
("1-2-0".to_owned(), 1),
("1-2-1".to_owned(), 2),
("1-2-2".to_owned(), 3),
("1-2-3".to_owned(), 1),
("1-3".to_owned(), 8),
("1-2-3".to_owned(), 4),
("1-3".to_owned(), 11),
// 2 has no transform
("2-0".to_owned(), 1),
("2-1".to_owned(), 1),
("2-1".to_owned(), 2),
("2-1-0".to_owned(), 1),
];
assert_eq!(actual_result, expected_result);
Expand Down

0 comments on commit d7afe94

Please sign in to comment.