1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-04 03:13:11 +08:00

Fix ComposeBlueprintContainer handling nudge keys when it can't nudge

This commit is contained in:
Dean Herbert 2025-01-20 18:55:42 +09:00
parent 3a37817ab2
commit 9a12f48dcc
No known key found for this signature in database

View File

@ -111,25 +111,26 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)
{ {
// Until the keys below are global actions, this will prevent conflicts with "seek between sample points"
// which has a default of ctrl+shift+arrows.
if (e.ShiftPressed)
return false;
if (e.ControlPressed) if (e.ControlPressed)
{ {
switch (e.Key) switch (e.Key)
{ {
case Key.Left: case Key.Left:
nudgeSelection(new Vector2(-1, 0)); return nudgeSelection(new Vector2(-1, 0));
return true;
case Key.Right: case Key.Right:
nudgeSelection(new Vector2(1, 0)); return nudgeSelection(new Vector2(1, 0));
return true;
case Key.Up: case Key.Up:
nudgeSelection(new Vector2(0, -1)); return nudgeSelection(new Vector2(0, -1));
return true;
case Key.Down: case Key.Down:
nudgeSelection(new Vector2(0, 1)); return nudgeSelection(new Vector2(0, 1));
return true;
} }
} }
@ -151,7 +152,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// 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 nudgeSelection(Vector2 delta) private bool nudgeSelection(Vector2 delta)
{ {
if (!nudgeMovementActive) if (!nudgeMovementActive)
{ {
@ -162,12 +163,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault(); var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
if (firstBlueprint == null) if (firstBlueprint == null)
return; return false;
// convert to game space coordinates // convert to game space coordinates
delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero); delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero);
SelectionHandler.HandleMovement(new MoveSelectionEvent<HitObject>(firstBlueprint, delta)); SelectionHandler.HandleMovement(new MoveSelectionEvent<HitObject>(firstBlueprint, delta));
return true;
} }
private void updatePlacementNewCombo() private void updatePlacementNewCombo()