Fix scheduled calls piling up during transactions

This commit is contained in:
Dean Herbert 2023-04-06 23:39:36 +09:00
parent 9c8b25e034
commit ad717d2368
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
@ -47,9 +48,13 @@ protected override void LoadComplete()
EditorBeatmap.TransactionEnded += updateInspectorText;
}
private ScheduledDelegate? rollingTextUpdate;
private void updateInspectorText()
{
inspectorText.Clear();
rollingTextUpdate?.Cancel();
rollingTextUpdate = null;
switch (EditorBeatmap.SelectedHitObjects.Count)
{
@ -108,7 +113,7 @@ private void updateInspectorText()
// I'd hope there's a better way to do this, but I don't want to bind to each and every property above to watch for changes.
// This is a good middle-ground for the time being.
Scheduler.AddDelayed(updateInspectorText, 250);
rollingTextUpdate ??= Scheduler.AddDelayed(updateInspectorText, 250);
break;
default: