From dc9a4a4009863a0597f4d4de5519f0142eccfbe9 Mon Sep 17 00:00:00 2001 From: Dominik Honnef Date: Fri, 24 Feb 2023 17:11:14 +0100 Subject: [PATCH] layout: simplify implementation of List.ScrollTo Signed-off-by: Dominik Honnef --- layout/list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/list.go b/layout/list.go index dff237ae..0a8c11c7 100644 --- a/layout/list.go +++ b/layout/list.go @@ -381,7 +381,7 @@ func (l *List) ScrollBy(num float32) { // ScrollTo scrolls to the specified item. THe result will only be accurate if all items have the same height. // Otherwise, it will be approximate. func (l *List) ScrollTo(n int) { - l.Position.First = 0 + l.Position.First = n l.Position.Offset = 0 - l.ScrollBy(float32(n)) + l.Position.BeforeEnd = true } -- 2.45.2