1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 22:35:23 +08:00

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

View File

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

View File

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