1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-06 08:15:59 +02:00

Fixed jittering centering

This commit is contained in:
Brian Fiete 2019-09-23 07:39:35 -07:00
parent 4882a0a1aa
commit 9465247dfe

View file

@ -854,7 +854,11 @@ namespace Beefy.gfx
fontMetrics.mMaxWidth = Math.Max(fontMetrics.mMaxWidth, aWidth);
if (justification == 0)
useX += (width - aWidth) / 2;
{
// This strange-looking construct is so that odd-length lines and even-length lines do not 'jitter'
// relative to each other as we're resizing a window
useX += ((int)(width)&~1 - (int)aWidth) / 2;
}
else if (justification == 1)
useX += width - aWidth;
}