1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Fix inactive columns flickering on and off mid-scroll

This commit is contained in:
Bartłomiej Dach 2022-04-26 22:43:58 +02:00
parent 94d07e147f
commit 21377d2a4d
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -333,8 +333,13 @@ namespace osu.Game.Overlays.Mods
// the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space.
// note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns.
float leftScrollBound = Math.Clamp(Current, 0, ScrollableExtent);
float rightScrollBound = leftScrollBound + DrawWidth;
float leftVisibleBound = Math.Clamp(Current, 0, ScrollableExtent);
float rightVisibleBound = leftVisibleBound + DrawWidth;
// if a movement is occurring at this time, the bounds below represent the full range of columns that the scroll movement will encompass.
// this will be used to ensure that columns do not change state from active to inactive back and forth until they are fully scrolled past.
float leftMovementBound = Math.Min(Current, Target);
float rightMovementBound = Math.Max(Current, Target) + DrawWidth;
foreach (var column in Child)
{
@ -343,8 +348,12 @@ namespace osu.Game.Overlays.Mods
var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), ScrollContent);
var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), ScrollContent);
column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound)
&& Precision.DefinitelyBigger(rightScrollBound, topRight.X);
bool isCurrentlyVisible = Precision.AlmostBigger(topLeft.X, leftVisibleBound)
&& Precision.DefinitelyBigger(rightVisibleBound, topRight.X);
bool isBeingScrolledToward = Precision.AlmostBigger(topLeft.X, leftMovementBound)
&& Precision.DefinitelyBigger(rightMovementBound, topRight.X);
column.Active.Value = isCurrentlyVisible || isBeingScrolledToward;
}
}
}