1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Merge pull request #23660 from peppy/simplify-deselect

Fix crash when deleting dragged object in skin editor
This commit is contained in:
Bartłomiej Dach 2023-05-25 17:27:41 +02:00 committed by GitHub
commit b59f4aee99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
};
SelectionHandler = CreateSelectionHandler();
SelectionHandler.DeselectAll = DeselectAll;
SelectionHandler.SelectedItems.BindTo(SelectedItems);
AddRangeInternal(new[]

View File

@ -197,9 +197,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
#region Selection Handling
/// <summary>
/// Bind an action to deselect all selected blueprints.
/// Deselect all selected items.
/// </summary>
internal Action DeselectAll { private get; set; }
protected void DeselectAll() => SelectedItems.Clear();
/// <summary>
/// Handle a blueprint becoming selected.
@ -303,7 +303,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (blueprint.IsSelected)
return false;
DeselectAll?.Invoke();
DeselectAll();
blueprint.Select();
return true;
}
@ -311,6 +311,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected void DeleteSelected()
{
DeleteItems(SelectedItems.ToArray());
DeselectAll();
}
#endregion