1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 15:26:07 +08:00

Use input events rather than scene graph traversals

This commit is contained in:
smoogipoo 2018-11-30 15:47:55 +09:00
parent e83f6707bf
commit bc3fcb87b7

View File

@ -163,10 +163,10 @@ namespace osu.Game.Screens.Edit
switch (e.Key) switch (e.Key)
{ {
case Key.Left: case Key.Left:
seek(-1); seek(e, -1);
return true; return true;
case Key.Right: case Key.Right:
seek(1); seek(e, 1);
return true; return true;
} }
@ -184,9 +184,9 @@ namespace osu.Game.Screens.Edit
while (Math.Abs(scrollAccumulation) > precision) while (Math.Abs(scrollAccumulation) > precision)
{ {
if (scrollAccumulation > 0) if (scrollAccumulation > 0)
seek(-1); seek(e, -1);
else else
seek(1); seek(e, 1);
scrollAccumulation = scrollAccumulation < 0 ? Math.Min(0, scrollAccumulation + precision) : Math.Max(0, scrollAccumulation - precision); scrollAccumulation = scrollAccumulation < 0 ? Math.Min(0, scrollAccumulation + precision) : Math.Max(0, scrollAccumulation - precision);
} }
@ -241,9 +241,9 @@ namespace osu.Game.Screens.Edit
LoadComponentAsync(currentScreen, screenContainer.Add); LoadComponentAsync(currentScreen, screenContainer.Add);
} }
private void seek(int direction) private void seek(UIEvent e, int direction)
{ {
double amount = GetContainingInputManager().CurrentState.Keyboard.ShiftPressed ? 2 : 1; double amount = e.ShiftPressed ? 2 : 1;
if (direction < 1) if (direction < 1)
clock.SeekBackward(!clock.IsRunning, amount); clock.SeekBackward(!clock.IsRunning, amount);