Add test coverage and fix fail case where a drag selection ends incorrectly with cyclic selection

This commit is contained in:
Dean Herbert
2023-03-15 15:16:48 +09:00
parent 3c4e2d8700
commit 1cf870d956
2 changed files with 17 additions and 2 deletions

View File

@ -178,6 +178,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
endClickSelection(e);
clickSelectionHandled = false;
isDraggingBlueprint = false;
wasDragStarted = false;
});
finishSelectionMovement();
@ -191,6 +192,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
lastDragEvent = e;
wasDragStarted = true;
if (movementBlueprints != null)
{
@ -399,7 +401,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
return false;
}
if (selectedBlueprintAlreadySelectedOnMouseDown && AllowCyclicSelection)
if (!wasDragStarted && selectedBlueprintAlreadySelectedOnMouseDown && AllowCyclicSelection)
{
// If a click occurred and was handled by the currently selected blueprint but didn't result in a drag,
// cycle between other blueprints which are also under the cursor.
@ -485,6 +487,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
private bool isDraggingBlueprint;
/// <summary>
/// Whether a drag operation was started at all.
/// </summary>
private bool wasDragStarted;
/// <summary>
/// Attempts to begin the movement of any selected blueprints.
/// </summary>