mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Base bounds checks on +1 (to avoid worrying about current item heights)
This commit is contained in:
@ -574,11 +574,16 @@ namespace osu.Game.Screens.Select
|
|||||||
//scrollableContent.RemoveAll(p => p.Y < visibleUpperBound - p.DrawHeight || p.Y > visibleBottomBound || !p.IsPresent);
|
//scrollableContent.RemoveAll(p => p.Y < visibleUpperBound - p.DrawHeight || p.Y > visibleBottomBound || !p.IsPresent);
|
||||||
|
|
||||||
// Find index range of all items that should be on-screen
|
// Find index range of all items that should be on-screen
|
||||||
int firstIndex = yPositions.BinarySearch(visibleUpperBound - DrawableCarouselItem.MAX_HEIGHT);
|
int firstIndex = yPositions.BinarySearch(visibleUpperBound);
|
||||||
if (firstIndex < 0) firstIndex = ~firstIndex;
|
if (firstIndex < 0) firstIndex = ~firstIndex;
|
||||||
int lastIndex = yPositions.BinarySearch(visibleBottomBound);
|
int lastIndex = yPositions.BinarySearch(visibleBottomBound);
|
||||||
if (lastIndex < 0) lastIndex = ~lastIndex;
|
if (lastIndex < 0) lastIndex = ~lastIndex;
|
||||||
|
|
||||||
|
// as we can't be 100% sure on the size of individual carousel drawables,
|
||||||
|
// always play it safe and extend bounds by one.
|
||||||
|
firstIndex = Math.Max(0, firstIndex - 1);
|
||||||
|
lastIndex = Math.Min(yPositions.Count - 1, lastIndex + 1);
|
||||||
|
|
||||||
if (revalidateItems || firstIndex != displayedRange.first || lastIndex != displayedRange.last)
|
if (revalidateItems || firstIndex != displayedRange.first || lastIndex != displayedRange.last)
|
||||||
{
|
{
|
||||||
displayedRange = (firstIndex, lastIndex);
|
displayedRange = (firstIndex, lastIndex);
|
||||||
|
Reference in New Issue
Block a user