Merge branch 'editor-fix-multiple-selection' into editor-clipboard

This commit is contained in:
Dean Herbert
2020-09-14 15:47:20 +09:00

View File

@ -144,18 +144,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary> /// </summary>
/// <param name="blueprint">The blueprint.</param> /// <param name="blueprint">The blueprint.</param>
internal void HandleSelected(SelectionBlueprint blueprint) internal void HandleSelected(SelectionBlueprint blueprint)
{
if (!selectedBlueprints.Contains(blueprint))
{ {
selectedBlueprints.Add(blueprint); selectedBlueprints.Add(blueprint);
// need to check this as well, as there are potentially multiple SelectionHandlers and the above check is not enough. // there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject)) if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject); EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
UpdateVisibility(); UpdateVisibility();
} }
}
/// <summary> /// <summary>
/// Handle a blueprint becoming deselected. /// Handle a blueprint becoming deselected.
@ -163,13 +160,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param> /// <param name="blueprint">The blueprint.</param>
internal void HandleDeselected(SelectionBlueprint blueprint) internal void HandleDeselected(SelectionBlueprint blueprint)
{ {
if (selectedBlueprints.Remove(blueprint)) selectedBlueprints.Remove(blueprint);
{
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject); EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
UpdateVisibility(); UpdateVisibility();
} }
}
/// <summary> /// <summary>
/// Handle a blueprint requesting selection. /// Handle a blueprint requesting selection.