GetRight returns 0 even GetLeft, GetWidth and GetTop, GetHeight return correct values. #1053
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have one root node (r) with two child nodes (c1, c2) with these settings:
Doing a
YGNodeCalculateLayout(r, 2000,1000, YGDirectionLTR)
I would expect the following results:The problem is that GetRight(==GetLeft+GetWidth?) and GetBottom(==GetTop+GetHeight) don't return the correct values, even the values from which I assume Right and Bottom are calculate dare correct.
Can someone tell me what's going on here?
The values are correct. The left/top/right/bottom properties in the computed layout specify the distance to the corresponding edge of the parent node.
Ah, ok. Thanks. And for the root nodes, because there is no parent, it's 0.
Hmm... I now hit a new problem with child nodes. Adding two child-nodes (lob11, lob12) (lob=layout object) to the above root, which each covering half of the root node, I would expect:
lob11.GetRight() is inconsistent, because lob12.GetLeft() returns the correct value. So, why not the same behavior lob11.GetRight()?
Related: #1158
Which layout results can we actually expect to be set? Perhaps I am totally misunderstanding the situation but it seems that in almost all cases they aren't all set correctly:
See e.g. this very simple example.
which makes no sense, the invariants have to be
left + width + right = parent.width
andtop + height + bottom = parent.height
, right?"Bottom" does not appear to be relative to the parent node, just always 0 - e.g:
node1
's bottom is not 0 distance fromroot
's bottom, asnode2
is also a child ofroot
, and is positionedd beneath it.