From 9be2d9d62e131d22e98b650bdb82e48c97d8f18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 27 Jun 2023 22:25:01 +0200 Subject: [PATCH] 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. --- osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index 05fe137732..e93b9f0691 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -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);