Fix align-content: center, flex-end alignment with margin
Summary: This fixes ```align-content: center``` and ```align-content: flex-end``` when the child exceeds the parents size. See #476. It also fixes those layouts if the child has ```margin: auto``` set. Closes https://github.com/facebook/yoga/pull/477 Differential Revision: D4697833 Pulled By: emilsjolander fbshipit-source-id: d081ec7ea559a5f2bd3271c3a4dc272960beddfa
This commit is contained in:
parent
6cbb57d0df
commit
18c239ee22
|
@ -2624,10 +2624,6 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
crossAxisParentSize,
|
||||
parentWidth) -
|
||||
paddingAndBorderAxisCross;
|
||||
|
||||
if (measureModeCrossDim == YGMeasureModeAtMost) {
|
||||
containerCrossAxis = fminf(containerCrossAxis, availableInnerCrossDim);
|
||||
}
|
||||
}
|
||||
|
||||
// If there's no flex wrap, the cross dimension is defined by the container.
|
||||
|
@ -2735,11 +2731,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
|
||||
if (YGMarginLeadingValue(child, crossAxis)->unit == YGUnitAuto &&
|
||||
YGMarginTrailingValue(child, crossAxis)->unit == YGUnitAuto) {
|
||||
leadingCrossDim += remainingCrossDim / 2;
|
||||
leadingCrossDim += fmaxf(0.0f, remainingCrossDim / 2);
|
||||
} else if (YGMarginTrailingValue(child, crossAxis)->unit == YGUnitAuto) {
|
||||
// No-Op
|
||||
} else if (YGMarginLeadingValue(child, crossAxis)->unit == YGUnitAuto) {
|
||||
leadingCrossDim += remainingCrossDim;
|
||||
leadingCrossDim += fmaxf(0.0f, remainingCrossDim);
|
||||
} else if (alignItem == YGAlignFlexStart) {
|
||||
// No-Op
|
||||
} else if (alignItem == YGAlignCenter) {
|
||||
|
|
Loading…
Reference in New Issue