Skip to content

Commit

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

# 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 authored and ItsDoot committed Feb 1, 2023
1 parent c5d260f commit 7753e60
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 7753e60

Please sign in to comment.