minor changes to text label
This commit is contained in:
parent
a402df1475
commit
75da4db4fe
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user