mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget/material: ensure List handles zero minimum constraints
This change ensures that the scrollbar anchors to the proper edge of the content even when the list was drawn with a zero minimum constraint. Without this, the layout.Direction used to anchor the scrollbar will choose to use the minimum size and anchor it to the opposite edge of the content. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -271,6 +271,10 @@ func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement)
|
||||
majorAxisSize := l.state.Axis.Convert(listDims.Size).X
|
||||
start, end := fromListPosition(l.state.Position, length, majorAxisSize)
|
||||
anchoring.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
// layout.Dimension 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
|
||||
return l.ScrollbarStyle.Layout(gtx, l.state.Axis, start, end)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user