1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Improve precision wheel adjustment handling

This commit is contained in:
Dean Herbert 2018-06-13 17:03:56 +09:00
parent e0b68e4e09
commit cee5be1d56

View File

@ -206,11 +206,18 @@ namespace osu.Game.Overlays.Volume
return false;
}
// because volume precision is set to 0.01, this local is required to keep track of more precise adjustments and only apply when possible.
private double scrollAmount;
protected override bool OnScroll(InputState state)
{
double amount = adjust_step * state.Mouse.ScrollDelta.Y * (state.Mouse.HasPreciseScroll ? 0.5f : 1);
scrollAmount += adjust_step * state.Mouse.ScrollDelta.Y * (state.Mouse.HasPreciseScroll ? 0.1f : 1);
Volume += Math.Sign(amount) * Math.Max(0.01, Math.Abs(amount));
if (Math.Abs(scrollAmount) < Bindable.Precision)
return true;
Volume += scrollAmount;
scrollAmount = 0;
return true;
}