~eliasnaur/gio

d7b1c7c33b33b48033c941a8d47b9fdf472671fc — Chris Waldon 6 months ago 51b1148
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>
1 files changed, 2 insertions(+), 2 deletions(-)

M layout/layout.go
M layout/layout.go => layout/layout.go +2 -2
@@ 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),
		},
		}),
	}
}