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

Commit

Permalink
Better JumpToIndex height calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
sinai-dev committed May 27, 2021
1 parent 5515b2e commit a46acba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/UI/Widgets/ScrollPool/ScrollPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public void JumpToIndex(int index, Action<T> onJumped)
RefreshCells(true, true);

// Slide to the normalized position of the index
float normalized = HeightCache[index].startPosition / HeightCache.TotalHeight;
var cache = HeightCache[index];
float normalized = (cache.startPosition + (cache.height * 0.5f)) / HeightCache.TotalHeight;

RuntimeProvider.Instance.StartCoroutine(ForceDelayedJump(index, normalized, onJumped));
}

Expand Down

0 comments on commit a46acba

Please sign in to comment.