Open Nyan11 opened 7 months ago
Thanks for the detailed report. Today we looked at it with @Enzo-Demeulenaere but still no fix.
IMHO the examples with 0.5 show most evidently that something is wrong, because it should be symmetric.
We can add tests in BlFrameLayoutConstraintTest
, which already has covers many cases but not with margins.
A candidate is:
testChildAlignLeft05Top05WithMargin
child constraintsDo: [ :c |
c margin: (BlInsets all: 10).
c frame horizontal alignLeftAt: 0.5.
c frame vertical alignTopAt: 0.5 ].
self waitTestingSpaces.
self assert: child position equals: 55 @ 55
But I'm not sure if we should expect 55@55 or 60@60.
I edited the title because there is no issue when no alignment with coordinate.
I played with the child's constraints of this example to check:
"Child has a margin of 5px"
a := 5.
child := BlElement new.
child background: Color blue.
child constraintsDo: [ :c |
c frame vertical alignTop.
c frame horizontal alignRight ].
child margin: (BlInsets all: a).
"Parent has padding, shown by it's border"
parent := BlElement new.
parent background: Color red translucent.
parent layout: BlFrameLayout new.
parent padding: (BlInsets all: a).
parent border: (BlBorder paint: Color red translucent width: a).
parent beOutskirtsInside.
parent addChild: child.
parent position: 50@50.
parent size: 100@100.
s := BlSpace new.
s extent: 200@200.
s root addChild: parent.
s show.
Hello,
I was working with BlFrameLayout and i discover a bug.
Reproduction
No bug
In a playground you can do:
With bug
Go in the class
BlFrameLayoutAlignmentExampleTest
on instance side and replace the methodchild
with:Then go in playground and do:
Explication of the bug
I will focus on the 4 elements at the center of the image. In
BlFrameLayoutAlignmentExampleTest
the four elements at the center are in aBlFrameLayout
. Each element receive a different frame constraints. For the top left element the constraints are :alignBottom: 0.5
andalignRight: 0.5
, For the bottom right the constraints are:alignTop: 0.5
andalignLeft: 0.5
.In the next image i highlighted the two elements and their respective margin.
We can see that in the element on the top-left, the margin is taken into account by the
BlFrameLayout
for the position and in the bottom-right element the margin is not taken into account.