layout: simplify implementation of List.ScrollTo

Signed-off-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
Dominik Honnef
2023-02-24 17:11:14 +01:00
committed by Elias Naur
parent 4a1962e5e8
commit dc9a4a4009
+2 -2
View File
@@ -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
}