changed text scaling method from iteration to calculation (faster)
This commit is contained in:
1 parent
da3fa9fcbb
commit
7d6609a771
1 file changed
+16
-13
+16
-13
@@ -688,26 +688,27 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
RectangleF bounds = CDraw.GetTextBounds(this);
|
RectangleF bounds = CDraw.GetTextBounds(this);
|
||||||
|
|
||||||
while (bounds.Width > Bounds.W)
|
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
|
||||||
{
|
{
|
||||||
h -= 0.2f;
|
float factor = Bounds.W / bounds.Width;
|
||||||
|
float step = h * (1 - factor);
|
||||||
|
h *= factor;
|
||||||
switch (HAlign)
|
switch (HAlign)
|
||||||
{
|
{
|
||||||
case EHAlignment.Top:
|
case EHAlignment.Top:
|
||||||
y += 0.05f;
|
y += step * 0.25f;
|
||||||
break;
|
break;
|
||||||
case EHAlignment.Center:
|
case EHAlignment.Center:
|
||||||
y += 0.1f;
|
y += step * 0.50f;
|
||||||
break;
|
break;
|
||||||
case EHAlignment.Bottom:
|
case EHAlignment.Bottom:
|
||||||
y += 0.15f;
|
y += step * 0.75f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds = CDraw.GetTextBounds(this, h);
|
bounds = CFonts.GetTextBounds(this, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Align)
|
switch (Align)
|
||||||
@@ -792,19 +793,21 @@ namespace Vocaluxe.Menu
|
|||||||
float y = Y;
|
float y = Y;
|
||||||
RectangleF bounds = CFonts.GetTextBounds(this);
|
RectangleF bounds = CFonts.GetTextBounds(this);
|
||||||
|
|
||||||
while (bounds.Width > Bounds.W)
|
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
|
||||||
{
|
{
|
||||||
h -= 0.2f;
|
float factor = Bounds.W / bounds.Width;
|
||||||
|
float step = h * (1 - factor);
|
||||||
|
h *= factor ;
|
||||||
switch (HAlign)
|
switch (HAlign)
|
||||||
{
|
{
|
||||||
case EHAlignment.Top:
|
case EHAlignment.Top:
|
||||||
y += 0.05f;
|
y += step * 0.25f;
|
||||||
break;
|
break;
|
||||||
case EHAlignment.Center:
|
case EHAlignment.Center:
|
||||||
y += 0.1f;
|
y += step * 0.50f;
|
||||||
break;
|
break;
|
||||||
case EHAlignment.Bottom:
|
case EHAlignment.Bottom:
|
||||||
y += 0.15f;
|
y += step * 0.75f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user