layout: ensure Spacer obeys constraints

This commit ensures that the Spacer type doesn't break layouts
by ignoring when its min constraints require it to be larger or
its max constraints require it to be smaller.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-03-22 16:11:15 -04:00
committed by Elias Naur
parent 51b11486c5
commit d7b1c7c33b
+2 -2
View File
@@ -211,10 +211,10 @@ type Spacer struct {
func (s Spacer) Layout(gtx Context) Dimensions {
return Dimensions{
Size: image.Point{
Size: gtx.Constraints.Constrain(image.Point{
X: gtx.Dp(s.Width),
Y: gtx.Dp(s.Height),
},
}),
}
}