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; }