1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 14:22:55 +08:00

Remove custom scroll logic

This commit is contained in:
Dean Herbert 2019-05-17 12:42:08 +09:00
parent 37e989fc64
commit 876f108e0a

View File

@ -26,12 +26,8 @@ namespace osu.Game.Overlays
private ChangelogContent listing; private ChangelogContent listing;
private ChangelogContent content; private ChangelogContent content;
private ScrollContainer scroll;
private SampleChannel sampleBack; private SampleChannel sampleBack;
private float savedScrollPosition;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuColour colour) private void load(AudioManager audio, OsuColour colour)
{ {
@ -48,7 +44,7 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = new Color4(49, 36, 54, 255), Colour = new Color4(49, 36, 54, 255),
}, },
scroll = new ScrollContainer new ScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false, ScrollbarVisible = false,
@ -106,15 +102,9 @@ namespace osu.Game.Overlays
switch (action) switch (action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
if (isAtListing) if (listing.Alpha == 1)
{ {
if (scroll.Current > scroll.GetChildPosInContent(listing)) State = Visibility.Hidden;
{
scroll.ScrollTo(0);
sampleBack?.Play();
}
else
State = Visibility.Hidden;
} }
else else
{ {
@ -146,17 +136,13 @@ namespace osu.Game.Overlays
API.Queue(req); API.Queue(req);
} }
private bool isAtListing;
public void ShowListing() public void ShowListing()
{ {
isAtListing = true;
header.ShowListing(); header.ShowListing();
content.Hide(); content.Hide();
badges.Current.Value = null; badges.Current.Value = null;
listing.Show(); listing.Show();
scroll.ScrollTo(savedScrollPosition);
} }
/// <summary> /// <summary>
@ -182,13 +168,6 @@ namespace osu.Game.Overlays
{ {
content.Show(); content.Show();
content.ShowBuild(populatedBuild); content.ShowBuild(populatedBuild);
if (scroll.Current > scroll.GetChildPosInContent(content))
scroll.ScrollTo(content);
if (isAtListing)
savedScrollPosition = scroll.Current;
isAtListing = false;
} }
if (build.Versions != null) if (build.Versions != null)