minor changes to text label
This commit is contained in:
parent
a402df1475
commit
75da4db4fe
@ -42,16 +42,16 @@ namespace RhythmBullet.UI.Modular.Modules
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (value == null) value = "...";
|
||||||
modifiedTextSize = font.MeasureString(value);
|
modifiedTextSize = font.MeasureString(value);
|
||||||
originalText = value;
|
originalText = value;
|
||||||
displayedText = value;
|
displayedText = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextLabel(string text, SpriteFont font, int height)
|
public TextLabel(SpriteFont font, string text = null)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
bounds.Height = height;
|
|
||||||
this.font = font;
|
this.font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace RhythmBullet.UI.Modular.Modules
|
|||||||
stringBuilder.Remove(stringBuilder.Length, ellipsis.Length - 1);
|
stringBuilder.Remove(stringBuilder.Length, ellipsis.Length - 1);
|
||||||
stringBuilder.Insert(stringBuilder.Length, ellipsis);
|
stringBuilder.Insert(stringBuilder.Length, ellipsis);
|
||||||
}
|
}
|
||||||
while (font.MeasureString(stringBuilder).X *scale > bounds.Width);
|
while (font.MeasureString(stringBuilder).X * scale > bounds.Width);
|
||||||
|
|
||||||
ModifiedText = stringBuilder.ToString();
|
ModifiedText = stringBuilder.ToString();
|
||||||
}
|
}
|
||||||
@ -92,12 +92,12 @@ namespace RhythmBullet.UI.Modular.Modules
|
|||||||
|
|
||||||
public void AttemptToScaleFont()
|
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;
|
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;
|
scale = bounds.Height / modifiedTextSize.Y;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user