1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 22:17:46 +08:00

Fix regression in quick delete mouse action blocking

This commit is contained in:
Dean Herbert 2021-04-13 13:03:14 +09:00
parent b4c75ba3c6
commit 66e74da2b7
3 changed files with 9 additions and 8 deletions

View File

@ -83,8 +83,9 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("right click", () => InputManager.Click(MouseButton.Right));
AddAssert("slider has 2 points", () => slider.Path.ControlPoints.Count == 2);
// second click should nuke the object completely.
AddStep("right click", () => InputManager.Click(MouseButton.Right));
// second click should nuke the object completely.
AddAssert("no hitobjects in beatmap", () => EditorBeatmap.HitObjects.Count == 0);
AddStep("release shift", () => InputManager.ReleaseKey(Key.ShiftLeft));

View File

@ -135,7 +135,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnMouseDown(MouseDownEvent e)
{
bool selectionPerformed = beginClickSelection(e);
bool selectionPerformed = performMouseDownActions(e);
// even if a selection didn't occur, a drag event may still move the selection.
prepareSelectionMovement();
@ -343,7 +343,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
/// <param name="e">The input event that triggered this selection.</param>
/// <returns>Whether a selection was performed.</returns>
private bool beginClickSelection(MouseButtonEvent e)
private bool performMouseDownActions(MouseButtonEvent e)
{
// Iterate from the top of the input stack (blueprints closest to the front of the screen first).
// Priority is given to already-selected blueprints.
@ -351,7 +351,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
if (!blueprint.IsHovered) continue;
return clickSelectionBegan = SelectionHandler.HandleSelectionRequested(blueprint, e);
return clickSelectionBegan = SelectionHandler.MouseDownSelectionRequested(blueprint, e);
}
return false;
@ -375,7 +375,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
if (!blueprint.IsHovered) continue;
return clickSelectionBegan = SelectionHandler.HandleDeselectionRequested(blueprint, e);
return clickSelectionBegan = SelectionHandler.MouseUpSelectionRequested(blueprint, e);
}
}

View File

@ -220,12 +220,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param>
/// <param name="e">The mouse event responsible for selection.</param>
/// <returns>Whether a selection was performed.</returns>
internal bool HandleSelectionRequested(SelectionBlueprint blueprint, MouseButtonEvent e)
internal bool MouseDownSelectionRequested(SelectionBlueprint blueprint, MouseButtonEvent e)
{
if (e.ShiftPressed && e.Button == MouseButton.Right)
{
handleQuickDeletion(blueprint);
return false;
return true;
}
// while holding control, we only want to add to selection, not replace an existing selection.
@ -244,7 +244,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param>
/// <param name="e">The mouse event responsible for deselection.</param>
/// <returns>Whether a deselection was performed.</returns>
internal bool HandleDeselectionRequested(SelectionBlueprint blueprint, MouseButtonEvent e)
internal bool MouseUpSelectionRequested(SelectionBlueprint blueprint, MouseButtonEvent e)
{
if (blueprint.IsSelected)
{