mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
widget: make Icon honour its constraints
This is a breaking change as Icon.Layout no longer requests a size. Before: sz := unit.Dp(20) ic.Layout(gtx, sz) After: sz := gtx.Metric.Px(unit.Dp(20)) gtx.Constraints.Min = image.Pt(sz, 0) ic.Layout(gtx) Fixes gio#240 Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
@@ -170,7 +170,8 @@ func (b IconButtonStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
size := gtx.Px(b.Size)
|
||||
if b.Icon != nil {
|
||||
b.Icon.Color = b.Color
|
||||
b.Icon.Layout(gtx, unit.Px(float32(size)))
|
||||
gtx.Constraints.Min = image.Point{X: size}
|
||||
b.Icon.Layout(gtx)
|
||||
}
|
||||
return layout.Dimensions{
|
||||
Size: image.Point{X: size, Y: size},
|
||||
|
||||
Reference in New Issue
Block a user