GetRight returns 0 even GetLeft, GetWidth and GetTop, GetHeight return correct values.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18.9k
- Forks
- 1.6k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
I have one root node (r) with two child nodes (c1, c2) with these settings:
C.YGNodeStyleSetFlexDirection(n, C.YGFlexDirectionRow) // layout as row => nodes are left to right
C.YGNodeStyleSetFlexGrow(n, 0) // stay in space from parent
C.YGNodeStyleSetFlexShrink(n, 1) // shrink to fix in space from parent (makes sense when using percent
C.YGNodeStyleSetHeightPercent(n, 100)
C.YGNodeStyleSetWidthPercent(n, 100)
Doing a YGNodeCalculateLayout(r, 2000,1000, YGDirectionLTR) I would expect the following results:
assert.Equal(t, float32(0), r.GetLeft())
assert.Equal(t, float32(0), r.GetTop())
assert.Equal(t, float32(2000), r.GetWidth())
assert.Equal(t, float32(1000), r.GetHeight())
assert.Equal(t, float32(2000), r.GetRight()) <== this returns 0
assert.Equal(t, float32(1000), r.GetBottom()) <== this returns 0
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported layout with the Go calls to YGNodeCalculateLayout and the GetLeft/GetTop/GetWidth/GetHeight/GetRight/GetBottom accessors. Compare the edge accessors with the calculated position and size values shown in the issue; done means GetRight and GetBottom return the expected 2000 and 1000 values, with a regression check for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, go
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100