mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
widget/material: prevent invalid list item constraints
Previously, a bug in the ListStyle could result in items being passed a negative value in the minimum constraints. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -257,7 +257,13 @@ func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement)
|
||||
max := l.state.Axis.Convert(gtx.Constraints.Max)
|
||||
min := l.state.Axis.Convert(gtx.Constraints.Min)
|
||||
max.Y -= barWidth
|
||||
if max.Y < 0 {
|
||||
max.Y = 0
|
||||
}
|
||||
min.Y -= barWidth
|
||||
if min.Y < 0 {
|
||||
min.Y = 0
|
||||
}
|
||||
gtx.Constraints.Max = l.state.Axis.Convert(max)
|
||||
gtx.Constraints.Min = l.state.Axis.Convert(min)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user