mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Adjust tick-based wheel control to be more correct
This commit is contained in:
@ -187,15 +187,19 @@ namespace osu.Game.Screens.Edit
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
scrollAccumulation += e.ScrollDelta.X + e.ScrollDelta.Y * (e.IsPrecise ? 0.1 : 1);
|
||||
if (Math.Abs(scrollAccumulation) < 1)
|
||||
return true;
|
||||
|
||||
if (scrollAccumulation > 0)
|
||||
clock.SeekBackward(!clock.IsRunning);
|
||||
else
|
||||
clock.SeekForward(!clock.IsRunning);
|
||||
const int precision = 1;
|
||||
|
||||
while (Math.Abs(scrollAccumulation) > precision)
|
||||
{
|
||||
if (scrollAccumulation > 0)
|
||||
clock.SeekBackward(!clock.IsRunning);
|
||||
else
|
||||
clock.SeekForward(!clock.IsRunning);
|
||||
|
||||
scrollAccumulation = scrollAccumulation < 0 ? Math.Min(0, scrollAccumulation + precision) : Math.Max(0, scrollAccumulation - precision);
|
||||
}
|
||||
|
||||
scrollAccumulation = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user