1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

bestMatch changes on entering section with screen top border

This commit is contained in:
Fukashi13 2020-05-14 14:33:12 +02:00
parent 9d557bf806
commit e390d70b70

View File

@ -189,15 +189,15 @@ namespace osu.Game.Graphics.Containers
headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0);
headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0;
T bestMatch = null;
float minDiff = float.MaxValue;
T bestMatch = Children.FirstOrDefault();
float minDiff = float.MinValue;
float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0;
foreach (var section in Children)
{
float diff = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset);
float diff = scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset;
if (diff < minDiff)
if ((minDiff < diff) & (diff < 0))
{
minDiff = diff;
bestMatch = section;