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.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0);
headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0; headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0;
T bestMatch = null; T bestMatch = Children.FirstOrDefault();
float minDiff = float.MaxValue; float minDiff = float.MinValue;
float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0; float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0;
foreach (var section in Children) 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; minDiff = diff;
bestMatch = section; bestMatch = section;