From 5f818bc5e7f9d49464fab0d282b7e40768e9203a Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Fri, 17 Feb 2023 20:07:45 +0100 Subject: [PATCH] widget/material: use more efficient way of scrolling lists Signed-off-by: Dominik Honnef --- widget/material/list.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/widget/material/list.go b/widget/material/list.go index 81a7c9842..cca3465c5 100644 --- a/widget/material/list.go +++ b/widget/material/list.go @@ -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 {