From 9d109d4e05ea03c099fa88d9ed182e670ce7b0ba Mon Sep 17 00:00:00 2001 From: GGGuenni Date: Thu, 4 Feb 2021 15:22:05 +0100 Subject: [PATCH] Avoid overflow of the construction bar (#3573) --- core/src/com/unciv/ui/utils/ImageGetter.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/utils/ImageGetter.kt b/core/src/com/unciv/ui/utils/ImageGetter.kt index 47ff39b2bf..5f7e201b15 100644 --- a/core/src/com/unciv/ui/utils/ImageGetter.kt +++ b/core/src/com/unciv/ui/utils/ImageGetter.kt @@ -316,7 +316,9 @@ object ImageGetter { fun getProgressBarVertical(width: Float, height: Float, percentComplete: Float, progressColor: Color, backgroundColor: Color): Table { val advancementGroup = Table() - val completionHeight = height * percentComplete + var completionHeight = height * percentComplete + if (completionHeight > height) + completionHeight = height advancementGroup.add(getImage(whiteDotLocation).apply { color = backgroundColor }) .size(width, height - completionHeight).row() advancementGroup.add(getImage(whiteDotLocation).apply { color = progressColor }).size(width, completionHeight)