diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index dc04b72f..56801630 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2614,6 +2614,10 @@ static void YGJustifyMainAxis( numberOfAutoMarginsOnCurrentLine; } + if (i != startOfLineIndex) { + collectedFlexItemsValues.mainDim += betweenMainDim; + } + if (performLayout) { child->setLayoutPosition( childLayout.position[pos[mainAxis]] + @@ -2632,14 +2636,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) {