mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 16:37:26 +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)
|
public override bool HandleFlip(Direction direction, bool flipOverOrigin)
|
||||||
{
|
{
|
||||||
|
if (SelectedItems.Count == 0 && !flipOverOrigin)
|
||||||
|
return false;
|
||||||
|
|
||||||
var selectionRange = CatchHitObjectUtils.GetPositionRange(SelectedItems);
|
var selectionRange = CatchHitObjectUtils.GetPositionRange(SelectedItems);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
EditorBeatmap.PerformOnSelection(h =>
|
EditorBeatmap.PerformOnSelection(h =>
|
||||||
{
|
{
|
||||||
if (h is CatchHitObject catchObject)
|
if (h is CatchHitObject catchObject)
|
||||||
changed |= handleFlip(selectionRange, catchObject, flipOverOrigin);
|
changed |= handleFlip(selectionRange, catchObject, flipOverOrigin);
|
||||||
});
|
});
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +89,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
var hitObjects = selectedMovableObjects;
|
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);
|
var flipQuad = flipOverOrigin ? new Quad(0, 0, OsuPlayfield.BASE_SIZE.X, OsuPlayfield.BASE_SIZE.Y) : getSurroundingQuad(hitObjects);
|
||||||
|
|
||||||
foreach (var h in hitObjects)
|
foreach (var h in hitObjects)
|
||||||
|
@ -147,12 +147,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.EditorFlipHorizontally:
|
case GlobalAction.EditorFlipHorizontally:
|
||||||
HandleFlip(Direction.Horizontal, true);
|
return HandleFlip(Direction.Horizontal, true);
|
||||||
return true;
|
|
||||||
|
|
||||||
case GlobalAction.EditorFlipVertically:
|
case GlobalAction.EditorFlipVertically:
|
||||||
HandleFlip(Direction.Vertical, true);
|
return HandleFlip(Direction.Vertical, true);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,9 +28,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
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)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.EditorNudgeLeft:
|
case GlobalAction.EditorNudgeLeft:
|
||||||
@ -42,7 +39,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return base.OnPressed(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user