1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 07:36:05 +08:00

Fix crash when deselecting via ctrl+click

This commit is contained in:
smoogipoo 2020-01-24 17:30:37 +09:00
parent ea2271c905
commit 28727bbafd

View File

@ -110,7 +110,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnMouseDown(MouseDownEvent e) protected override bool OnMouseDown(MouseDownEvent e)
{ {
beginClickSelection(e); beginClickSelection(e);
prepareSelectionMovement(); prepareSelectionMovement();
return e.Button == MouseButton.Left; return e.Button == MouseButton.Left;
@ -356,21 +355,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary> /// <summary>
/// Attempts to begin the movement of any selected blueprints. /// Attempts to begin the movement of any selected blueprints.
/// </summary> /// </summary>
/// <returns>Whether movement began.</returns> private void prepareSelectionMovement()
private bool prepareSelectionMovement()
{ {
Debug.Assert(movementBlueprint == null); if (!selectionHandler.SelectedBlueprints.Any())
return;
// Any selected blueprint that is hovered can begin the movement of the group, however only the earliest hitobject is used for movement // Any selected blueprint that is hovered can begin the movement of the group, however only the earliest hitobject is used for movement
// A special case is added for when a click selection occurred before the drag // A special case is added for when a click selection occurred before the drag
if (!clickSelectionBegan && !selectionHandler.SelectedBlueprints.Any(b => b.IsHovered)) if (!clickSelectionBegan && !selectionHandler.SelectedBlueprints.Any(b => b.IsHovered))
return false; return;
// Movement is tracked from the blueprint of the earliest hitobject, since it only makes sense to distance snap from that hitobject // Movement is tracked from the blueprint of the earliest hitobject, since it only makes sense to distance snap from that hitobject
movementBlueprint = selectionHandler.SelectedBlueprints.OrderBy(b => b.HitObject.StartTime).First(); movementBlueprint = selectionHandler.SelectedBlueprints.OrderBy(b => b.HitObject.StartTime).First();
movementBlueprintOriginalPosition = movementBlueprint.SelectionPoint; // todo: unsure if correct movementBlueprintOriginalPosition = movementBlueprint.SelectionPoint; // todo: unsure if correct
return true;
} }
/// <summary> /// <summary>