mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 23:55:39 +00:00
widget/material: ensure scrollbar within dimensions
This commit fixes a visual-only bug in the ListStyle that could make the scrollbar float at the edge of the maximum constraints when the list did not occupy the full constraints. The list would still reserve layout space for the scrollbar in the correct position, but the scrollbar would not be displayed there. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -281,7 +281,12 @@ func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement)
|
||||
// layout.Direction respects the minimum, so ensure that the
|
||||
// scrollbar will be drawn on the correct edge even if the provided
|
||||
// layout.Context had a zero minimum constraint.
|
||||
gtx.Constraints.Min = gtx.Constraints.Max
|
||||
gtx.Constraints.Min = listDims.Size
|
||||
if l.AnchorStrategy == Occupy {
|
||||
min := l.state.Axis.Convert(gtx.Constraints.Min)
|
||||
min.Y += barWidth
|
||||
gtx.Constraints.Min = l.state.Axis.Convert(min)
|
||||
}
|
||||
anchoring.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
return l.ScrollbarStyle.Layout(gtx, l.state.Axis, start, end)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user