1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:02:55 +08:00

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