1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Allow adjusting volume controls via a drag

This commit is contained in:
Dean Herbert 2024-01-16 16:37:05 +09:00
parent 24a06e1d65
commit cdc6621f33
No known key found for this signature in database

View File

@ -309,10 +309,24 @@ namespace osu.Game.Overlays.Volume
private const double max_acceleration = 5;
private const double acceleration_multiplier = 1.8;
private const float mouse_drag_divisor = 20;
private ScheduledDelegate accelerationDebounce;
private void resetAcceleration() => accelerationModifier = 1;
protected override bool OnDragStart(DragStartEvent e)
{
adjust(-e.Delta.Y / mouse_drag_divisor, true);
return true;
}
protected override void OnDrag(DragEvent e)
{
adjust(-e.Delta.Y / mouse_drag_divisor, true);
base.OnDrag(e);
}
private void adjust(double delta, bool isPrecise)
{
if (delta == 0)