Fix items without blueprints are not deselected

This commit is contained in:
ekrctb 2022-10-06 13:50:56 +09:00
parent 2a7476cc4a
commit 0d448e6cc8
3 changed files with 15 additions and 13 deletions

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
};
SelectionHandler = CreateSelectionHandler();
SelectionHandler.DeselectAll = deselectAll;
SelectionHandler.DeselectAll = DeselectAll;
SelectionHandler.SelectedItems.BindTo(SelectedItems);
AddRangeInternal(new[]
@ -145,7 +145,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (endClickSelection(e) || ClickedBlueprint != null)
return true;
deselectAll();
DeselectAll();
return true;
}
@ -234,7 +234,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (!SelectionHandler.SelectedBlueprints.Any())
return false;
deselectAll();
DeselectAll();
return true;
}
@ -399,18 +399,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
/// <summary>
/// Selects all <see cref="SelectionBlueprint{T}"/>s.
/// Select all currently-present items.
/// </summary>
protected virtual void SelectAll()
{
// Scheduled to allow the change in lifetime to take place.
Schedule(() => SelectionBlueprints.ToList().ForEach(m => m.Select()));
}
protected abstract void SelectAll();
/// <summary>
/// Deselects all selected <see cref="SelectionBlueprint{T}"/>s.
/// Deselect all selected items.
/// </summary>
private void deselectAll() => SelectionHandler.SelectedBlueprints.ToList().ForEach(m => m.Deselect());
protected void DeselectAll() => SelectedItems.Clear();
protected virtual void OnBlueprintSelected(SelectionBlueprint<T> blueprint)
{

View File

@ -131,8 +131,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override void SelectAll()
{
Composer.Playfield.KeepAllAlive();
base.SelectAll();
SelectedItems.Clear();
SelectedItems.AddRange(Beatmap.HitObjects);
}
protected override void OnBlueprintSelected(SelectionBlueprint<HitObject> blueprint)

View File

@ -117,6 +117,12 @@ namespace osu.Game.Skinning.Editor
return false;
}
protected override void SelectAll()
{
SelectedItems.Clear();
SelectedItems.AddRange(targetComponents.SelectMany(list => list));
}
/// <summary>
/// Move the current selection spatially by the specified delta, in screen coordinates (ie. the same coordinates as the blueprints).
/// </summary>