mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
layout: simplify implementation of List.ScrollTo
Signed-off-by: Dominik Honnef <dominik@honnef.co>
This commit is contained in:
committed by
Elias Naur
parent
4a1962e5e8
commit
dc9a4a4009
+2
-2
@@ -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.
|
// ScrollTo scrolls to the specified item. THe result will only be accurate if all items have the same height.
|
||||||
// Otherwise, it will be approximate.
|
// Otherwise, it will be approximate.
|
||||||
func (l *List) ScrollTo(n int) {
|
func (l *List) ScrollTo(n int) {
|
||||||
l.Position.First = 0
|
l.Position.First = n
|
||||||
l.Position.Offset = 0
|
l.Position.Offset = 0
|
||||||
l.ScrollBy(float32(n))
|
l.Position.BeforeEnd = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user