From 0db34a47f8314f1d46c48f44e04e31d8a80a9077 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 5 Nov 2019 17:28:42 +0900 Subject: [PATCH 1/3] Fix selecting underneath selected blueprints --- .../Compose/Components/BlueprintContainer.cs | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index a145dea6af..7a3a303ff3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -254,15 +254,31 @@ namespace osu.Game.Screens.Edit.Compose.Components { Debug.Assert(!clickSelectionBegan); - foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints) + bool hoveringSelected = false; + + // Make sure any already-selected blueprints aren't being hovered over + foreach (SelectionBlueprint selected in selectionHandler.SelectedBlueprints) { - if (blueprint.IsHovered) + if (selected.IsHovered) { - selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState); - clickSelectionBegan = true; + hoveringSelected = true; break; } } + + // Attempt a new selection at the mouse position + if (!hoveringSelected) + { + foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints) + { + if (blueprint.IsHovered) + { + selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState); + clickSelectionBegan = true; + break; + } + } + } } /// From f77de7d88013f30bd3567b4af2f7d223029b50e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Nov 2019 18:25:38 +0900 Subject: [PATCH 2/3] Simplify implementation --- .../Compose/Components/BlueprintContainer.cs | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 7a3a303ff3..02dd60eac1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -254,31 +254,19 @@ namespace osu.Game.Screens.Edit.Compose.Components { Debug.Assert(!clickSelectionBegan); - bool hoveringSelected = false; + // If a select blueprint is already hovered, disallow changes in selection. + if (selectionHandler.SelectedBlueprints.Any(s => s.IsHovered)) + return; - // Make sure any already-selected blueprints aren't being hovered over - foreach (SelectionBlueprint selected in selectionHandler.SelectedBlueprints) + foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints) { - if (selected.IsHovered) + if (blueprint.IsHovered) { - hoveringSelected = true; + selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState); + clickSelectionBegan = true; break; } } - - // Attempt a new selection at the mouse position - if (!hoveringSelected) - { - foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints) - { - if (blueprint.IsHovered) - { - selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState); - clickSelectionBegan = true; - break; - } - } - } } /// From f4b93ec9438f49d852bb7172ad3a6b8c368fd5d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Nov 2019 18:29:08 +0900 Subject: [PATCH 3/3] Add exception when holding control --- .../Screens/Edit/Compose/Components/BlueprintContainer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index 02dd60eac1..288c712bde 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -255,7 +255,9 @@ namespace osu.Game.Screens.Edit.Compose.Components Debug.Assert(!clickSelectionBegan); // If a select blueprint is already hovered, disallow changes in selection. - if (selectionHandler.SelectedBlueprints.Any(s => s.IsHovered)) + // Exception is made when holding control, as deselection should still be allowed. + if (!e.CurrentState.Keyboard.ControlPressed && + selectionHandler.SelectedBlueprints.Any(s => s.IsHovered)) return; foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints)