mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
layout: fix dimensions of empty list
When the Min constraints are set but the list has no item to display, use those as the list returned dimensions. Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
@@ -293,6 +293,11 @@ func (l *List) layout(ops *op.Ops, macro op.MacroOp) Dimensions {
|
||||
if pos > mainMax {
|
||||
pos = mainMax
|
||||
}
|
||||
if crossMin, crossMax := l.Axis.crossConstraint(l.cs); maxCross < crossMin {
|
||||
maxCross = crossMin
|
||||
} else if maxCross > crossMax {
|
||||
maxCross = crossMax
|
||||
}
|
||||
dims := l.Axis.Convert(image.Pt(pos, maxCross))
|
||||
call := macro.Stop()
|
||||
defer clip.Rect(image.Rectangle{Max: dims}).Push(ops).Pop()
|
||||
|
||||
Reference in New Issue
Block a user