added functionality using which child node can tell parent node to use it as a reference baseline
Summary: @public Currently only parent can tell the layout to align its children based on baseline. But if one of the children is a column or row then basealign does not work as expected. We have added an api setReferenceBaseline which when set to true would mean that it's baseline would be considered as the reference baseline for parent amongst its siblings. If there are more than one siblings with referenceBaseline set, the first one would be considered. Reviewed By: davidaurelio Differential Revision: D12883323 fbshipit-source-id: 19beccfc47d98bb38f81f5b66ba764e83680f821
This commit is contained in:
committed by
Facebook Github Bot
parent
7a60399b2b
commit
4e2011c381
@@ -88,6 +88,14 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeRemoveChild(YGNodeHandle node, YGNodeHandle child);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeSetIsReferenceBaseline(
|
||||
YGNodeHandle node,
|
||||
bool isReferenceBaseline);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool YGNodeIsReferenceBaseline(YGNodeHandle node);
|
||||
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void YGNodeCalculateLayout(
|
||||
YGNodeHandle node,
|
||||
|
@@ -519,6 +519,19 @@ namespace Facebook.Yoga
|
||||
Native.YGNodeSetHasNewLayout(_ygNode, false);
|
||||
}
|
||||
|
||||
public bool IsReferenceBaseline
|
||||
{
|
||||
get
|
||||
{
|
||||
return Native.YGNodeIsReferenceBaseline(_ygNode);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
Native.YGNodeSetIsReferenceBaseline(_ygNode, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValuesEqual(float f1, float f2)
|
||||
{
|
||||
if (float.IsNaN(f1) || float.IsNaN(f2))
|
||||
@@ -594,7 +607,7 @@ namespace Facebook.Yoga
|
||||
}
|
||||
|
||||
public void CalculateLayout(
|
||||
float width = YogaConstants.Undefined,
|
||||
float width = YogaConstants.Undefined,
|
||||
float height = YogaConstants.Undefined)
|
||||
{
|
||||
Native.YGNodeCalculateLayout(
|
||||
|
Reference in New Issue
Block a user