Fix selecting underneath selected blueprints

This commit is contained in:
smoogipoo 2019-11-05 17:28:42 +09:00
parent 621f4387c9
commit 0db34a47f8
1 changed files with 20 additions and 4 deletions

View File

@ -254,15 +254,31 @@ private void beginClickSelection(UIEvent e)
{
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;
}
}
}
}
/// <summary>