mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:33:21 +08:00
Refactor logic to avoid TimelineSelectionHandler
having to block base calls
This commit is contained in:
parent
866ae3472b
commit
6779503e57
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user