Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit a46acba

Browse files
committed
Better JumpToIndex height calculation
1 parent 5515b2e commit a46acba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/UI/Widgets/ScrollPool/ScrollPool.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ public void JumpToIndex(int index, Action<T> onJumped)
142142
RefreshCells(true, true);
143143

144144
// Slide to the normalized position of the index
145-
float normalized = HeightCache[index].startPosition / HeightCache.TotalHeight;
145+
var cache = HeightCache[index];
146+
float normalized = (cache.startPosition + (cache.height * 0.5f)) / HeightCache.TotalHeight;
147+
146148
RuntimeProvider.Instance.StartCoroutine(ForceDelayedJump(index, normalized, onJumped));
147149
}
148150

0 commit comments

Comments
 (0)