Move action to private named method to avoid null inspection

This commit is contained in:
Salman Ahmed 2021-11-05 03:51:08 +03:00
parent 6197ef426d
commit 36d99a2e34

View File

@ -37,11 +37,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Margin = new MarginPadding(20), Margin = new MarginPadding(20),
Action = () => Action = scrollToTop
{
ScrollToStart();
Button.State = Visibility.Hidden;
}
}); });
} }
@ -58,6 +54,12 @@ namespace osu.Game.Overlays
Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden; Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden;
} }
private void scrollToTop()
{
ScrollToStart();
Button.State = Visibility.Hidden;
}
public class ScrollToTopButton : OsuHoverContainer public class ScrollToTopButton : OsuHoverContainer
{ {
private const int fade_duration = 500; private const int fade_duration = 500;