Do not show timing distribution graph in offset control if there's not enough timed hits

Intended to address concerns raised in
https://github.com/ppy/osu/pull/30620#issuecomment-2475744164.
This commit is contained in:
Bartłomiej Dach 2024-11-14 13:16:32 +01:00
parent bbe2c87837
commit bd1d3cad49
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View File

@ -30,7 +30,7 @@ public static class HitEventExtensions
foreach (var e in hitEvents)
{
if (!affectsUnstableRate(e))
if (!AffectsUnstableRate(e))
continue;
count++;
@ -57,7 +57,7 @@ public static class HitEventExtensions
/// </returns>
public static double? CalculateAverageHitError(this IEnumerable<HitEvent> hitEvents)
{
double[] timeOffsets = hitEvents.Where(affectsUnstableRate).Select(ev => ev.TimeOffset).ToArray();
double[] timeOffsets = hitEvents.Where(AffectsUnstableRate).Select(ev => ev.TimeOffset).ToArray();
if (timeOffsets.Length == 0)
return null;
@ -65,6 +65,6 @@ public static class HitEventExtensions
return timeOffsets.Average();
}
private static bool affectsUnstableRate(HitEvent e) => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit();
public static bool AffectsUnstableRate(HitEvent e) => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit();
}
}

View File

@ -195,7 +195,10 @@ private void scoreChanged(ValueChangedEvent<ScoreInfo?> score)
},
};
if (hitEvents.Count < 10)
// affecting unstable rate here is used as a substitute of determining if a hit event represents a *timed* hit event,
// i.e. an user input that the user had to *time to the track*,
// i.e. one that it *makes sense to use* when doing anything with timing and offsets.
if (hitEvents.Count(HitEventExtensions.AffectsUnstableRate) < 10)
{
referenceScoreContainer.AddRange(new Drawable[]
{