From 0327c46d36df0d1950c54536262ff38988712480 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 19:29:12 -0400 Subject: [PATCH] Fixed columns not being able to have zero fill --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgressGraph.cs | 3 +++ osu.Game/Screens/Play/SongProgressGraphColumn.cs | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 6fa91a46c4..1f0b993fee 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -41,7 +41,7 @@ namespace osu.Desktop.VisualTests List newValues = new List(); for (int i = 0; i < 1000; i++) { - newValues.Add(random.Next(1, 11)); + newValues.Add(random.Next(0, 11)); } progress.DisplayValues(newValues); diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 06810c7d07..921b630db3 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -70,6 +70,9 @@ namespace osu.Game.Screens.Play private void recalculateValues() { + // Resizes values to fit the amount of columns and stores it in calculatedValues + // Defaults to all zeros if values is null + calculatedValues.RemoveAll(delegate { return true; }); if (values == null) diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index b92cf63865..95fcf5ad36 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -59,7 +59,14 @@ namespace osu.Game.Screens.Play for (int i = 0; i < drawableRows.Count; i++) { - drawableRows[i].Colour = i <= Filled ? colour : empty_colour; + if (Filled == 0) // i <= Filled doesn't work for zero fill + { + drawableRows[i].Colour = empty_colour; + } + else + { + drawableRows[i].Colour = i <= Filled ? colour : empty_colour; + } } }