Skip to content

Commit

Permalink
fix upsert_leaf not setting a MeasureFunc for new leaf nodes (#7351)
Browse files Browse the repository at this point in the history
# Problem

The `upsert_leaf` method creates a new `MeasureFunc` and, if required, a new leaf node, but then it only adds the new `MeasureFunc` to existing leaf nodes.

## Solution

Add the `MeasureFunc` to new leaf nodes as well.
  • Loading branch information
ickshonpe committed Jan 24, 2023
1 parent 671e7a0 commit cf612c8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/bevy_ui/src/flex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,11 @@ impl FlexSurface {
size
},
));

if let Some(taffy_node) = self.entity_to_taffy.get(&entity) {
self.taffy.set_style(*taffy_node, taffy_style).unwrap();
self.taffy.set_measure(*taffy_node, Some(measure)).unwrap();
} else {
let taffy_node = taffy.new_leaf(taffy_style).unwrap();
let taffy_node = taffy.new_leaf_with_measure(taffy_style, measure).unwrap();
self.entity_to_taffy.insert(entity, taffy_node);
}
}
Expand Down

0 comments on commit cf612c8

Please sign in to comment.