From 6fbb09a22c0be3464f0b512d262baf136a0e6c54 Mon Sep 17 00:00:00 2001 From: Jacob Parker Date: Fri, 9 Dec 2022 15:21:24 +0000 Subject: [PATCH] Update Yoga.cpp --- yoga/Yoga.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 88c77ab8..e4bf5b7c 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2566,6 +2566,10 @@ static void YGJustifyMainAxis( collectedFlexItemsValues.remainingFreeSpace / numberOfAutoMarginsOnCurrentLine; } + + if (i != startOfLineIndex) { + collectedFlexItemsValues.mainDim += betweenMainDim; + } if (performLayout) { child->setLayoutPosition( @@ -2585,14 +2589,14 @@ static void YGJustifyMainAxis( // 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 // YGNodeDimWithMargin. - collectedFlexItemsValues.mainDim += betweenMainDim + + collectedFlexItemsValues.mainDim += child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap() + childLayout.computedFlexBasis.unwrap(); collectedFlexItemsValues.crossDim = availableInnerCrossDim; } else { // The main dimension is the sum of all the elements dimension plus // the spacing. - collectedFlexItemsValues.mainDim += betweenMainDim + + collectedFlexItemsValues.mainDim += YGNodeDimWithMargin(child, mainAxis, availableInnerWidth); if (isNodeBaselineLayout) {