Update Yoga.cpp

This commit is contained in:
Jacob Parker
2022-12-09 15:21:24 +00:00
committed by GitHub
parent 35f3335efc
commit 6fbb09a22c

View File

@@ -2566,6 +2566,10 @@ static void YGJustifyMainAxis(
collectedFlexItemsValues.remainingFreeSpace / collectedFlexItemsValues.remainingFreeSpace /
numberOfAutoMarginsOnCurrentLine; numberOfAutoMarginsOnCurrentLine;
} }
if (i != startOfLineIndex) {
collectedFlexItemsValues.mainDim += betweenMainDim;
}
if (performLayout) { if (performLayout) {
child->setLayoutPosition( child->setLayoutPosition(
@@ -2585,14 +2589,14 @@ static void YGJustifyMainAxis(
// If we skipped the flex step, then we can't rely on the measuredDims // If we skipped the flex step, then we can't rely on the measuredDims
// because they weren't computed. This means we can't call // because they weren't computed. This means we can't call
// YGNodeDimWithMargin. // YGNodeDimWithMargin.
collectedFlexItemsValues.mainDim += betweenMainDim + collectedFlexItemsValues.mainDim +=
child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap() + child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap() +
childLayout.computedFlexBasis.unwrap(); childLayout.computedFlexBasis.unwrap();
collectedFlexItemsValues.crossDim = availableInnerCrossDim; collectedFlexItemsValues.crossDim = availableInnerCrossDim;
} else { } else {
// The main dimension is the sum of all the elements dimension plus // The main dimension is the sum of all the elements dimension plus
// the spacing. // the spacing.
collectedFlexItemsValues.mainDim += betweenMainDim + collectedFlexItemsValues.mainDim +=
YGNodeDimWithMargin(child, mainAxis, availableInnerWidth); YGNodeDimWithMargin(child, mainAxis, availableInnerWidth);
if (isNodeBaselineLayout) { if (isNodeBaselineLayout) {