Skip to content

Commit

Permalink
Fix node update (#3785)
Browse files Browse the repository at this point in the history
# Objective

Fixes #3784

## Solution

Check if the node size is actually different from previous
  • Loading branch information
blaind committed Feb 4, 2022
1 parent b11ee3f commit fe0e558
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/bevy_ui/src/flex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,13 @@ pub fn flex_node_system(
// PERF: try doing this incrementally
for (entity, mut node, mut transform, parent) in node_transform_query.iter_mut() {
let layout = flex_surface.get_layout(entity).unwrap();
node.size = Vec2::new(
let new_size = Vec2::new(
to_logical(layout.size.width),
to_logical(layout.size.height),
);
if node.size != new_size {
node.size = new_size;
}
let position = &mut transform.translation;
position.x = to_logical(layout.location.x + layout.size.width / 2.0);
position.y = to_logical(layout.location.y + layout.size.height / 2.0);
Expand Down

0 comments on commit fe0e558

Please sign in to comment.