mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 04:47:39 +09:00
Merge pull request #12043 from bdach/fix-reverse-crash
Fix selection box operation hotkeys not registering in change handler
This commit is contained in:
commit
b3e96c8385
@ -113,16 +113,25 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (e.Repeat || !e.ControlPressed)
|
if (e.Repeat || !e.ControlPressed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool runOperationFromHotkey(Func<bool> operation)
|
||||||
|
{
|
||||||
|
operationStarted();
|
||||||
|
bool result = operation?.Invoke() ?? false;
|
||||||
|
operationEnded();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.G:
|
case Key.G:
|
||||||
return CanReverse && OnReverse?.Invoke() == true;
|
return CanReverse && runOperationFromHotkey(OnReverse);
|
||||||
|
|
||||||
case Key.H:
|
case Key.H:
|
||||||
return CanScaleX && OnFlip?.Invoke(Direction.Horizontal) == true;
|
return CanScaleX && runOperationFromHotkey(() => OnFlip?.Invoke(Direction.Horizontal) ?? false);
|
||||||
|
|
||||||
case Key.J:
|
case Key.J:
|
||||||
return CanScaleY && OnFlip?.Invoke(Direction.Vertical) == true;
|
return CanScaleY && runOperationFromHotkey(() => OnFlip?.Invoke(Direction.Vertical) ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user