Skip to content

Commit

Permalink
widget/material: use more efficient way of scrolling lists
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Honnef <[email protected]>
  • Loading branch information
dominikh authored and eliasnaur committed Feb 24, 2023
1 parent 8af4472 commit 5f818bc
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions widget/material/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,7 @@ func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement)
if delta := l.state.ScrollDistance(); delta != 0 {
// Handle any changes to the list position as a result of user interaction
// with the scrollbar.
l.state.List.Position.Offset += int(math.Round(float64(float32(l.state.Position.Length) * delta)))

// Ensure that the list pays attention to the Offset field when the scrollbar drag
// is started while the bar is at the end of the list. Without this, the scrollbar
// cannot be dragged away from the end.
l.state.List.Position.BeforeEnd = true
l.state.List.ScrollBy(delta * float32(length))
}

if l.AnchorStrategy == Occupy {
Expand Down

0 comments on commit 5f818bc

Please sign in to comment.