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.
This commit is contained in:
ickshonpe 2023-01-24 16:09:52 +00:00
parent 671e7a0de8
commit cf612c8349

View File

@ -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);
}
}