From 75da4db4fef57be3fb4eca875d8d50ff374fec3e Mon Sep 17 00:00:00 2001 From: Recrown Date: Tue, 20 Nov 2018 19:52:51 -0600 Subject: [PATCH] minor changes to text label --- .../Utilities/UI/Modular/Modules/TextLabel.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RhythmBullet/Utilities/UI/Modular/Modules/TextLabel.cs b/RhythmBullet/Utilities/UI/Modular/Modules/TextLabel.cs index 075f879..4fdf286 100644 --- a/RhythmBullet/Utilities/UI/Modular/Modules/TextLabel.cs +++ b/RhythmBullet/Utilities/UI/Modular/Modules/TextLabel.cs @@ -27,7 +27,7 @@ namespace RhythmBullet.UI.Modular.Modules { return displayedText; } - + set { displayedText = value; @@ -42,16 +42,16 @@ namespace RhythmBullet.UI.Modular.Modules } set { + if (value == null) value = "..."; modifiedTextSize = font.MeasureString(value); originalText = value; displayedText = value; } } - public TextLabel(string text, SpriteFont font, int height) + public TextLabel(SpriteFont font, string text = null) { Text = text; - bounds.Height = height; this.font = font; } @@ -84,7 +84,7 @@ namespace RhythmBullet.UI.Modular.Modules stringBuilder.Remove(stringBuilder.Length, ellipsis.Length - 1); stringBuilder.Insert(stringBuilder.Length, ellipsis); } - while (font.MeasureString(stringBuilder).X *scale > bounds.Width); + while (font.MeasureString(stringBuilder).X * scale > bounds.Width); ModifiedText = stringBuilder.ToString(); } @@ -92,12 +92,12 @@ namespace RhythmBullet.UI.Modular.Modules public void AttemptToScaleFont() { - if (modifiedTextSize.X * scale > bounds.Width || modifiedTextSize.X * scale < bounds.Width) + if (modifiedTextSize.X * scale > bounds.Width || modifiedTextSize.X * scale < bounds.Width - 5) { scale = bounds.Width / modifiedTextSize.X; } - if (modifiedTextSize.Y * scale > bounds.Height || modifiedTextSize.Y * scale > bounds.Height) + if (modifiedTextSize.Y * scale > bounds.Height || modifiedTextSize.Y * scale < bounds.Height - 5) { scale = bounds.Height / modifiedTextSize.Y; }