Disallow deselections with right clicks

This commit is contained in:
smoogipoo
2019-11-13 17:21:48 +09:00
parent 9c52d239b4
commit 76ab0ecd3c

View File

@ -313,14 +313,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// Attempts to select any hovered blueprints. /// Attempts to select any hovered blueprints.
/// </summary> /// </summary>
/// <param name="e">The input event that triggered this selection.</param> /// <param name="e">The input event that triggered this selection.</param>
private void beginClickSelection(UIEvent e) private void beginClickSelection(MouseButtonEvent e)
{ {
Debug.Assert(!clickSelectionBegan); Debug.Assert(!clickSelectionBegan);
// If a select blueprint is already hovered, disallow changes in selection. // Deselections are only allowed for control + left clicks
// Exception is made when holding control, as deselection should still be allowed. bool allowDeselection = e.ControlPressed && e.Button == MouseButton.Left;
if (!e.CurrentState.Keyboard.ControlPressed &&
selectionHandler.SelectedBlueprints.Any(s => s.IsHovered)) // Todo: This is probably incorrectly disallowing multiple selections on stacked objects
if (!allowDeselection && selectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
return; return;
foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints) foreach (SelectionBlueprint blueprint in selectionBlueprints.AliveBlueprints)