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
1 changed files with 7 additions and 5 deletions

View File

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