From d7b1c7c33b33b48033c941a8d47b9fdf472671fc Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Wed, 22 Mar 2023 16:11:15 -0400 Subject: [PATCH] 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 --- layout/layout.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/layout.go b/layout/layout.go index f36dbd5c..0b91a21b 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -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), - }, + }), } }