mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:52:55 +08:00
Merge pull request #22504 from peppy/fix-editor-positional-nudge-undo
Fix beatmap editor positional nudging not being undoable
This commit is contained in:
commit
cb7540564a
@ -91,6 +91,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
blueprint.DrawableObject = drawableObject;
|
blueprint.DrawableObject = drawableObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool nudgeMovementActive;
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
{
|
{
|
||||||
if (e.ControlPressed)
|
if (e.ControlPressed)
|
||||||
@ -98,19 +100,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Left:
|
case Key.Left:
|
||||||
moveSelection(new Vector2(-1, 0));
|
nudgeSelection(new Vector2(-1, 0));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Key.Right:
|
case Key.Right:
|
||||||
moveSelection(new Vector2(1, 0));
|
nudgeSelection(new Vector2(1, 0));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Key.Up:
|
case Key.Up:
|
||||||
moveSelection(new Vector2(0, -1));
|
nudgeSelection(new Vector2(0, -1));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Key.Down:
|
case Key.Down:
|
||||||
moveSelection(new Vector2(0, 1));
|
nudgeSelection(new Vector2(0, 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,12 +120,29 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnKeyUp(KeyUpEvent e)
|
||||||
|
{
|
||||||
|
base.OnKeyUp(e);
|
||||||
|
|
||||||
|
if (nudgeMovementActive && !e.ControlPressed)
|
||||||
|
{
|
||||||
|
Beatmap.EndChange();
|
||||||
|
nudgeMovementActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move the current selection spatially by the specified delta, in gamefield coordinates (ie. the same coordinates as the blueprints).
|
/// Move the current selection spatially by the specified delta, in gamefield coordinates (ie. the same coordinates as the blueprints).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="delta"></param>
|
/// <param name="delta"></param>
|
||||||
private void moveSelection(Vector2 delta)
|
private void nudgeSelection(Vector2 delta)
|
||||||
{
|
{
|
||||||
|
if (!nudgeMovementActive)
|
||||||
|
{
|
||||||
|
nudgeMovementActive = true;
|
||||||
|
Beatmap.BeginChange();
|
||||||
|
}
|
||||||
|
|
||||||
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
|
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
|
||||||
|
|
||||||
if (firstBlueprint == null)
|
if (firstBlueprint == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user