mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09: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;
|
originalSectionsMargin = scrollContentContainer.Margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScrollToTop(T section)
|
public void ScrollTo(Drawable section) => scrollContainer.ScrollTo(scrollContainer.GetChildPosInContent(section) - (FixedHeader?.BoundingBox.Height ?? 0));
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
private float lastKnownScroll;
|
private float lastKnownScroll;
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
|
@ -137,7 +137,7 @@ namespace osu.Game.Overlays
|
|||||||
if (lastSection != s)
|
if (lastSection != s)
|
||||||
{
|
{
|
||||||
lastSection = s;
|
lastSection = s;
|
||||||
sectionsContainer.ScrollToTop(lastSection);
|
sectionsContainer.ScrollTo(lastSection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user