1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 01:33:20 +08:00

Move model selection handling to base SelectionHandler class

This commit is contained in:
Dean Herbert 2021-04-27 17:42:10 +09:00
parent eac139ca0e
commit 32416e4e31
2 changed files with 5 additions and 16 deletions

View File

@ -37,22 +37,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
};
}
internal override void HandleSelected(SelectionBlueprint<HitObject> blueprint)
{
base.HandleSelected(blueprint);
// there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.Item))
EditorBeatmap.SelectedHitObjects.Add(blueprint.Item);
}
internal override void HandleDeselected(SelectionBlueprint<HitObject> blueprint)
{
base.HandleDeselected(blueprint);
EditorBeatmap.SelectedHitObjects.Remove(blueprint.Item);
}
protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items);
#region Selection State

View File

@ -196,6 +196,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param>
internal virtual void HandleSelected(SelectionBlueprint<T> blueprint)
{
// there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
if (!SelectedItems.Contains(blueprint.Item))
SelectedItems.Add(blueprint.Item);
selectedBlueprints.Add(blueprint);
}
@ -205,6 +209,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="blueprint">The blueprint.</param>
internal virtual void HandleDeselected(SelectionBlueprint<T> blueprint)
{
SelectedItems.Remove(blueprint.Item);
selectedBlueprints.Remove(blueprint);
}