Account for path width correctly in LineGraph

This commit is contained in:
David Zhao 2019-03-07 13:45:55 +09:00
parent 00cdb3a44a
commit d97c070ef1

View File

@ -102,9 +102,9 @@ namespace osu.Game.Graphics.UserInterface
for (int i = 0; i < values.Length; i++) for (int i = 0; i < values.Length; i++)
{ {
float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; // Make sure that we are accounting for path width when calculating vertex positions
float y = GetYPosition(values[i]) * DrawHeight - 1; float x = (i + count - values.Length) / (float)(count - 1) * (DrawWidth - path.PathWidth);
// the -1 is for inner offset in path (actually -PathWidth) float y = GetYPosition(values[i]) * (DrawHeight - path.PathWidth);
path.AddVertex(new Vector2(x, y)); path.AddVertex(new Vector2(x, y));
} }
} }