Handle constant graphs better

This commit is contained in:
Bartłomiej Dach
2020-11-23 22:12:32 +01:00
parent 8347ecf494
commit 5701b32bae
3 changed files with 53 additions and 5 deletions

View File

@ -124,8 +124,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
if (currentTick < min)
continue;
float y = -Interpolation.ValueAt(currentTick, 0, 1f, min, max);
addRowTick(y, currentTick);
float y;
// special-case the min == max case to match LineGraph.
// lerp isn't really well-defined over a zero interval anyway.
if (min == max)
y = currentTick > 1 ? 1 : 0;
else
y = Interpolation.ValueAt(currentTick, 0, 1f, min, max);
// y axis is inverted in graph-like coordinates.
addRowTick(-y, currentTick);
}
}