1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Merge pull request #10634 from bdach/fix-leftover-selection-box-tooltip

Fix selection box action tooltips still being visible after object deletion
This commit is contained in:
Dean Herbert 2020-11-01 23:02:29 +09:00 committed by GitHub
commit e1b8875553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 22 deletions

View File

@ -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.

View File

@ -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,23 +250,18 @@ 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;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;
if (count > 0)
{
Show();
OnSelectionChanged();
}
else
Hide();
this.FadeTo(count > 0 ? 1 : 0);
OnSelectionChanged();
}
/// <summary>
/// Triggered whenever more than one object is selected, on each change.
/// Triggered whenever the set of selected objects changes.
/// Should update the selection box's state to match supported operations.
/// </summary>
protected virtual void OnSelectionChanged()
@ -421,7 +412,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) =>
{
Scheduler.AddOnce(updateVisibility);
UpdateTernaryStates();
};
}
/// <summary>