1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 15:23:14 +08:00

Extract disabling progress bar user-interactivity

This commit is contained in:
Salman Ahmed 2021-01-18 10:46:48 +03:00
parent 4e6c1a3906
commit bd44bf8c0b
3 changed files with 13 additions and 8 deletions

View File

@ -40,8 +40,14 @@ namespace osu.Game.Graphics.UserInterface
set => CurrentNumber.Value = value;
}
public ProgressBar()
private readonly bool userInteractive;
public override bool HandlePositionalInput => userInteractive;
public override bool HandleNonPositionalInput => userInteractive;
public ProgressBar(bool userInteractive)
{
this.userInteractive = userInteractive;
CurrentNumber.MinValue = 0;
CurrentNumber.MaxValue = 1;
RelativeSizeAxes = Axes.X;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
public DownloadProgressBar(BeatmapSetInfo beatmapSet)
: base(beatmapSet)
{
AddInternal(progressBar = new InteractionDisabledProgressBar
AddInternal(progressBar = new ProgressBar(false)
{
Height = 0,
Alpha = 0,
@ -64,11 +64,5 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
}
}, true);
}
private class InteractionDisabledProgressBar : ProgressBar
{
public override bool HandlePositionalInput => false;
public override bool HandleNonPositionalInput => false;
}
}
}

View File

@ -411,6 +411,11 @@ namespace osu.Game.Overlays
private class HoverableProgressBar : ProgressBar
{
public HoverableProgressBar()
: base(true)
{
}
protected override bool OnHover(HoverEvent e)
{
this.ResizeHeightTo(progress_height, 500, Easing.OutQuint);