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:
commit
b59f4aee99
@ -92,7 +92,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
};
|
||||
|
||||
SelectionHandler = CreateSelectionHandler();
|
||||
SelectionHandler.DeselectAll = DeselectAll;
|
||||
SelectionHandler.SelectedItems.BindTo(SelectedItems);
|
||||
|
||||
AddRangeInternal(new[]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user