layout: ensure Flex{Alignment: Middle} respects minimum constraint

Before this change, the middle alignment would align according to
the widest child. This change aligns according to the widest child
or minimum constraint, whichever is largest.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-08-16 15:48:46 +02:00
parent a55065af9c
commit 8425d2a6aa
+1 -1
View File
@@ -142,7 +142,7 @@ func (f Flex) Layout(gtx Context, children ...FlexChild) Dimensions {
children[i].call = c
children[i].dims = dims
}
var maxCross int
maxCross := crossMin
var maxBaseline int
for _, child := range children {
if c := f.Axis.Convert(child.dims.Size).Y; c > maxCross {