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

Refactor logic to avoid TimelineSelectionHandler having to block base calls

This commit is contained in:
Dean Herbert 2022-01-05 16:56:54 +09:00
parent 866ae3472b
commit 6779503e57
4 changed files with 11 additions and 8 deletions

View File

@ -54,14 +54,19 @@ namespace osu.Game.Rulesets.Catch.Edit
public override bool HandleFlip(Direction direction, bool flipOverOrigin)
{
if (SelectedItems.Count == 0 && !flipOverOrigin)
return false;
var selectionRange = CatchHitObjectUtils.GetPositionRange(SelectedItems);
bool changed = false;
EditorBeatmap.PerformOnSelection(h =>
{
if (h is CatchHitObject catchObject)
changed |= handleFlip(selectionRange, catchObject, flipOverOrigin);
});
return changed;
}

View File

@ -89,6 +89,9 @@ namespace osu.Game.Rulesets.Osu.Edit
{
var hitObjects = selectedMovableObjects;
if (hitObjects.Length == 1 && !flipOverOrigin)
return false;
var flipQuad = flipOverOrigin ? new Quad(0, 0, OsuPlayfield.BASE_SIZE.X, OsuPlayfield.BASE_SIZE.Y) : getSurroundingQuad(hitObjects);
foreach (var h in hitObjects)

View File

@ -147,12 +147,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
switch (e.Action)
{
case GlobalAction.EditorFlipHorizontally:
HandleFlip(Direction.Horizontal, true);
return true;
return HandleFlip(Direction.Horizontal, true);
case GlobalAction.EditorFlipVertically:
HandleFlip(Direction.Vertical, true);
return true;
return HandleFlip(Direction.Vertical, true);
}
return false;

View File

@ -28,9 +28,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
// Importantly, we block the base call here.
// Other key operations will be handled by the composer view's SelectionHandler instead.
switch (e.Action)
{
case GlobalAction.EditorNudgeLeft:
@ -42,7 +39,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
return true;
}
return false;
return base.OnPressed(e);
}
/// <summary>