mirror of
https://github.com/ppy/osu
synced 2024-12-19 05:15:30 +00:00
Bind UpdateVisibility() directly to source of truth
This commit is contained in:
parent
ea007af572
commit
003994ab75
@ -210,10 +210,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
}
|
||||
|
||||
if (DragBox.State == Visibility.Visible)
|
||||
{
|
||||
DragBox.Hide();
|
||||
SelectionHandler.UpdateVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
@ -352,11 +349,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// <summary>
|
||||
/// Selects all <see cref="SelectionBlueprint"/>s.
|
||||
/// </summary>
|
||||
private void selectAll()
|
||||
{
|
||||
SelectionBlueprints.ToList().ForEach(m => m.Select());
|
||||
SelectionHandler.UpdateVisibility();
|
||||
}
|
||||
private void selectAll() => SelectionBlueprints.ToList().ForEach(m => m.Select());
|
||||
|
||||
/// <summary>
|
||||
/// Deselects all selected <see cref="SelectionBlueprint"/>s.
|
||||
|
@ -201,8 +201,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
// there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
|
||||
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
|
||||
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
||||
|
||||
UpdateVisibility();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -214,8 +212,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
selectedBlueprints.Remove(blueprint);
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||
|
||||
UpdateVisibility();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -254,7 +250,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// <summary>
|
||||
/// Updates whether this <see cref="SelectionHandler"/> is visible.
|
||||
/// </summary>
|
||||
internal void UpdateVisibility()
|
||||
private void updateVisibility()
|
||||
{
|
||||
int count = selectedBlueprints.Count;
|
||||
|
||||
@ -421,7 +417,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
// bring in updates from selection changes
|
||||
EditorBeatmap.HitObjectUpdated += _ => UpdateTernaryStates();
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) => UpdateTernaryStates();
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) =>
|
||||
{
|
||||
updateVisibility();
|
||||
UpdateTernaryStates();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user