mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 17:17:26 +08:00
Fix SelectionBox buttons freezing when button is triggered via key event
This commit is contained in:
parent
cab97a96ab
commit
9cc6ee2ebc
@ -150,13 +150,25 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.G:
|
case Key.G:
|
||||||
return CanReverse && reverseButton?.TriggerClick() == true;
|
if (!CanReverse || reverseButton == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
reverseButton.TriggerAction();
|
||||||
|
return true;
|
||||||
|
|
||||||
case Key.Comma:
|
case Key.Comma:
|
||||||
return canRotate.Value && rotateCounterClockwiseButton?.TriggerClick() == true;
|
if (!canRotate.Value || rotateCounterClockwiseButton == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
rotateCounterClockwiseButton.TriggerAction();
|
||||||
|
return true;
|
||||||
|
|
||||||
case Key.Period:
|
case Key.Period:
|
||||||
return canRotate.Value && rotateClockwiseButton?.TriggerClick() == true;
|
if (!canRotate.Value || rotateClockwiseButton == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
rotateClockwiseButton.TriggerAction();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(e);
|
return base.OnKeyDown(e);
|
||||||
@ -285,7 +297,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
Action = action
|
Action = action
|
||||||
};
|
};
|
||||||
|
|
||||||
button.OperationStarted += freezeButtonPosition;
|
button.Clicked += freezeButtonPosition;
|
||||||
button.HoverLost += unfreezeButtonPosition;
|
button.HoverLost += unfreezeButtonPosition;
|
||||||
|
|
||||||
button.OperationStarted += operationStarted;
|
button.OperationStarted += operationStarted;
|
||||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
public Action? Action;
|
public Action? Action;
|
||||||
|
|
||||||
|
public event Action? Clicked;
|
||||||
|
|
||||||
public event Action? HoverLost;
|
public event Action? HoverLost;
|
||||||
|
|
||||||
public SelectionBoxButton(IconUsage iconUsage, string tooltip)
|
public SelectionBoxButton(IconUsage iconUsage, string tooltip)
|
||||||
@ -51,9 +53,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
Circle.FlashColour(Colours.GrayF, 300);
|
Circle.FlashColour(Colours.GrayF, 300);
|
||||||
|
|
||||||
TriggerOperationStarted();
|
Clicked?.Invoke();
|
||||||
Action?.Invoke();
|
|
||||||
TriggerOperationEnded();
|
TriggerAction();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,5 +74,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LocalisableString TooltipText { get; }
|
public LocalisableString TooltipText { get; }
|
||||||
|
|
||||||
|
internal void TriggerAction()
|
||||||
|
{
|
||||||
|
TriggerOperationStarted();
|
||||||
|
Action?.Invoke();
|
||||||
|
TriggerOperationEnded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user