mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Prefer ScrollTo in SectionsContainer.
This commit is contained in:
parent
6cf36da389
commit
26b36c08a3
@ -139,16 +139,7 @@ namespace osu.Game.Graphics.Containers
|
||||
originalSectionsMargin = scrollContentContainer.Margin;
|
||||
}
|
||||
|
||||
public void ScrollToTop(T section)
|
||||
{
|
||||
float pos = scrollContainer.GetChildPosInContent(section);
|
||||
float current = scrollContainer.Current;
|
||||
float scrollOffset = FixedHeader?.LayoutSize.Y ?? 0;
|
||||
if (section == Children.First() && current < pos - scrollOffset) return;
|
||||
scrollContainer.ScrollTo(pos - scrollOffset);
|
||||
}
|
||||
|
||||
public void ScrollTo(Drawable section) => ScrollContainer.ScrollTo(ScrollContainer.GetChildPosInContent(section) - FixedHeader.BoundingBox.Height);
|
||||
public void ScrollTo(Drawable section) => scrollContainer.ScrollTo(scrollContainer.GetChildPosInContent(section) - (FixedHeader?.BoundingBox.Height ?? 0));
|
||||
|
||||
private float lastKnownScroll;
|
||||
protected override void UpdateAfterChildren()
|
||||
|
@ -137,7 +137,7 @@ namespace osu.Game.Overlays
|
||||
if (lastSection != s)
|
||||
{
|
||||
lastSection = s;
|
||||
sectionsContainer.ScrollToTop(lastSection);
|
||||
sectionsContainer.ScrollTo(lastSection);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user