mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Allow adjusting volume controls via a drag
This commit is contained in:
parent
24a06e1d65
commit
cdc6621f33
@ -309,10 +309,24 @@ namespace osu.Game.Overlays.Volume
|
|||||||
private const double max_acceleration = 5;
|
private const double max_acceleration = 5;
|
||||||
private const double acceleration_multiplier = 1.8;
|
private const double acceleration_multiplier = 1.8;
|
||||||
|
|
||||||
|
private const float mouse_drag_divisor = 20;
|
||||||
|
|
||||||
private ScheduledDelegate accelerationDebounce;
|
private ScheduledDelegate accelerationDebounce;
|
||||||
|
|
||||||
private void resetAcceleration() => accelerationModifier = 1;
|
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)
|
private void adjust(double delta, bool isPrecise)
|
||||||
{
|
{
|
||||||
if (delta == 0)
|
if (delta == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user