From 6fbb09a22c0be3464f0b512d262baf136a0e6c54 Mon Sep 17 00:00:00 2001 From: Jacob Parker Date: Fri, 9 Dec 2022 15:21:24 +0000 Subject: [PATCH 1/2] 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 88c77ab850..e4bf5b7c2c 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) { From 62a777f510c2fd806fa607acd088340ff25d5fa6 Mon Sep 17 00:00:00 2001 From: Jacob Parker Date: Mon, 12 Dec 2022 09:36:31 +0000 Subject: [PATCH 2/2] format --- yoga/Yoga.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index e4bf5b7c2c..ce578a9bfa 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -2566,7 +2566,7 @@ static void YGJustifyMainAxis( collectedFlexItemsValues.remainingFreeSpace / numberOfAutoMarginsOnCurrentLine; } - + if (i != startOfLineIndex) { collectedFlexItemsValues.mainDim += betweenMainDim; }