Fix position on root node with RTL direction
Summary: If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477. Closes https://github.com/facebook/yoga/pull/502 Differential Revision: D4867144 Pulled By: emilsjolander fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
This commit is contained in:
parent
7da07fa9f3
commit
f7fe9a6219
|
@ -1324,8 +1324,12 @@ static void YGNodeSetPosition(const YGNodeRef node,
|
|||
const float mainSize,
|
||||
const float crossSize,
|
||||
const float parentWidth) {
|
||||
const YGFlexDirection mainAxis = YGResolveFlexDirection(node->style.flexDirection, direction);
|
||||
const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction);
|
||||
/* Root nodes should be always layouted as LTR, so we don't return negative values. */
|
||||
const YGDirection directionRespectingRoot = node->parent != NULL ? direction : YGDirectionLTR;
|
||||
const YGFlexDirection mainAxis =
|
||||
YGResolveFlexDirection(node->style.flexDirection, directionRespectingRoot);
|
||||
const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, directionRespectingRoot);
|
||||
|
||||
const float relativePositionMain = YGNodeRelativePosition(node, mainAxis, mainSize);
|
||||
const float relativePositionCross = YGNodeRelativePosition(node, crossAxis, crossSize);
|
||||
|
||||
|
|
Loading…
Reference in New Issue