Debounce user-requested replay seeks (#6138)

Debounce user-requested replay seeks
This commit is contained in:
Dean Herbert 2019-09-17 16:38:29 +09:00 committed by GitHub
commit 7af194e5ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.MathUtils;
using osu.Framework.Threading;
namespace osu.Game.Screens.Play
{
@ -121,6 +122,12 @@ namespace osu.Game.Screens.Play
handleBase.X = newX;
}
protected override void OnUserChange(double value) => OnSeek?.Invoke(value);
private ScheduledDelegate scheduledSeek;
protected override void OnUserChange(double value)
{
scheduledSeek?.Cancel();
scheduledSeek = Schedule(() => OnSeek?.Invoke(value));
}
}
}