Merge pull request #17208 from peppy/blueprint-container-selected-items-bind

Automatically bind `BlueprintContainer`'s `SelectedItems` with its `SelectionHandler`
This commit is contained in:
Bartłomiej Dach 2022-03-11 03:48:42 +01:00 committed by GitHub
commit 1813d73d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -73,6 +73,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
SelectionHandler = CreateSelectionHandler(); SelectionHandler = CreateSelectionHandler();
SelectionHandler.DeselectAll = deselectAll; SelectionHandler.DeselectAll = deselectAll;
SelectionHandler.SelectedItems.BindTo(SelectedItems);
AddRangeInternal(new[] AddRangeInternal(new[]
{ {

View File

@ -29,11 +29,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
// bring in updates from selection changes // bring in updates from selection changes
EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates); EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates);
SelectedItems.BindTo(EditorBeatmap.SelectedHitObjects); SelectedItems.CollectionChanged += (sender, args) => Scheduler.AddOnce(UpdateTernaryStates);
SelectedItems.CollectionChanged += (sender, args) =>
{
Scheduler.AddOnce(UpdateTernaryStates);
};
} }
protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items); protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items);