mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 17:33:12 +08:00
simplify tracking changes in shift key status
This commit is contained in:
parent
ca41c84ba2
commit
bb38cb4137
@ -63,31 +63,20 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
if (!e.Repeat && (e.Key == Key.ShiftLeft || e.Key == Key.ShiftRight))
|
||||
updateCirclePieceColour();
|
||||
|
||||
handleDragToggle(e);
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyUpEvent e)
|
||||
{
|
||||
handleDragToggle(e);
|
||||
if (e.Key == Key.ShiftLeft || e.Key == Key.ShiftRight)
|
||||
updateCirclePieceColour();
|
||||
|
||||
base.OnKeyUp(e);
|
||||
}
|
||||
|
||||
private bool lastShiftPressed;
|
||||
|
||||
private void handleDragToggle(KeyboardEvent key)
|
||||
{
|
||||
bool shiftPressed = key.ShiftPressed;
|
||||
|
||||
if (shiftPressed == lastShiftPressed) return;
|
||||
|
||||
lastShiftPressed = shiftPressed;
|
||||
updateCirclePieceColour();
|
||||
}
|
||||
|
||||
private void updateCirclePieceColour()
|
||||
{
|
||||
Color4 colour = colours.Yellow;
|
||||
|
Loading…
Reference in New Issue
Block a user