mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 04:32:57 +08:00
Use ShiftPressed
instead of explicitly checking both physical keys
Not only is this simpler, but it also is more correct (for explanation why, try holding both shift keys while dragging, and just releasing one of them - the previous code would briefly turn aspect ratio off).
This commit is contained in:
parent
c4ac6d20a0
commit
070668c96f
@ -51,9 +51,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (IsDragged && (e.Key == Key.ShiftLeft || e.Key == Key.ShiftRight))
|
||||
if (IsDragged)
|
||||
{
|
||||
applyScale(shouldLockAspectRatio: true);
|
||||
applyScale(shouldLockAspectRatio: e.ShiftPressed);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,8 +64,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
base.OnKeyUp(e);
|
||||
|
||||
if (IsDragged && (e.Key == Key.ShiftLeft || e.Key == Key.ShiftRight))
|
||||
applyScale(shouldLockAspectRatio: false);
|
||||
if (IsDragged)
|
||||
applyScale(shouldLockAspectRatio: e.ShiftPressed);
|
||||
}
|
||||
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user