1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 21:02:56 +08:00

simplify tracking changes in shift key status

This commit is contained in:
OliBomby 2024-06-03 13:18:36 +02:00
parent ca41c84ba2
commit bb38cb4137

View File

@ -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;