1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:47:46 +08:00

Fix hotkey presses generating unnecessary undo history

The buttons don't check whether the operation they correspond to is
possible to perform in the current state of the selection box, so not
checking `Can{Reverse,Rotate}` causes superfluous undo states to be
added without any real changes if an attempt is made to reverse or
rotate a selection that cannot be reversed or rotated.
This commit is contained in:
Bartłomiej Dach 2023-06-27 22:25:01 +02:00
parent 444f71541a
commit 9be2d9d62e
No known key found for this signature in database

View File

@ -171,13 +171,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
switch (e.Key)
{
case Key.G:
return reverseButton?.TriggerClick() == true;
return CanReverse && reverseButton?.TriggerClick() == true;
case Key.Comma:
return rotateCounterClockwiseButton?.TriggerClick() == true;
return CanRotate && rotateCounterClockwiseButton?.TriggerClick() == true;
case Key.Period:
return rotateClockwiseButton?.TriggerClick() == true;
return CanRotate && rotateClockwiseButton?.TriggerClick() == true;
}
return base.OnKeyDown(e);