Skip to content

Commit cf612c8

Browse files
committed
fix upsert_leaf not setting a MeasureFunc for new leaf nodes (#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.
1 parent 671e7a0 commit cf612c8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

crates/bevy_ui/src/flex/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,11 @@ impl FlexSurface {
108108
size
109109
},
110110
));
111-
112111
if let Some(taffy_node) = self.entity_to_taffy.get(&entity) {
113112
self.taffy.set_style(*taffy_node, taffy_style).unwrap();
114113
self.taffy.set_measure(*taffy_node, Some(measure)).unwrap();
115114
} else {
116-
let taffy_node = taffy.new_leaf(taffy_style).unwrap();
115+
let taffy_node = taffy.new_leaf_with_measure(taffy_style, measure).unwrap();
117116
self.entity_to_taffy.insert(entity, taffy_node);
118117
}
119118
}

0 commit comments

Comments
 (0)