Simplify implementation

This commit is contained in:
Dean Herbert 2019-11-05 18:25:38 +09:00
parent 3680b9a380
commit f77de7d880

View File

@ -254,31 +254,19 @@ namespace osu.Game.Screens.Edit.Compose.Components
{ {
Debug.Assert(!clickSelectionBegan); 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 blueprint in selectionBlueprints.AliveBlueprints)
foreach (SelectionBlueprint selected in selectionHandler.SelectedBlueprints)
{ {
if (selected.IsHovered) if (blueprint.IsHovered)
{ {
hoveringSelected = true; selectionHandler.HandleSelectionRequested(blueprint, e.CurrentState);
clickSelectionBegan = true;
break; 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;
}
}
}
} }
/// <summary> /// <summary>