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
@@ -17,6 +17,7 @@ struct YGNode {
|
||||
void* context_ = nullptr;
|
||||
YGPrintFunc print_ = nullptr;
|
||||
bool hasNewLayout_ = true;
|
||||
bool isReferenceBaseline_ = false;
|
||||
YGNodeType nodeType_ = YGNodeTypeDefault;
|
||||
YGMeasureFunc measure_ = nullptr;
|
||||
YGBaselineFunc baseline_ = nullptr;
|
||||
@@ -93,6 +94,10 @@ struct YGNode {
|
||||
return lineIndex_;
|
||||
}
|
||||
|
||||
bool isReferenceBaseline() {
|
||||
return isReferenceBaseline_;
|
||||
}
|
||||
|
||||
// returns the YGNodeRef that owns this YGNode. An owner is used to identify
|
||||
// the YogaTree that a YGNode belongs to.
|
||||
// This method will return the parent of the YGNode when a YGNode only belongs
|
||||
@@ -211,6 +216,10 @@ struct YGNode {
|
||||
lineIndex_ = lineIndex;
|
||||
}
|
||||
|
||||
void setIsReferenceBaseline(bool isReferenceBaseline) {
|
||||
isReferenceBaseline_ = isReferenceBaseline;
|
||||
}
|
||||
|
||||
void setOwner(YGNodeRef owner) {
|
||||
owner_ = owner;
|
||||
}
|
||||
|
Reference in New Issue
Block a user