Add MaxWidth property for text rendering in UI controls and fix maxWidth parameter in canvas extension methods

This commit is contained in:
Stone_Red
2026-06-16 19:46:05 +02:00
parent 92cc387f2d
commit e7922bdf05
6 changed files with 9 additions and 2 deletions
+2 -1
View File
@@ -70,10 +70,11 @@ public static class CanvasExtensions
byte height = font.Height;
int targetWidth = width * targetHeight / height;
int endX = maxWidth == int.MaxValue ? int.MaxValue : x + maxWidth;
for (int i = 0; i < str.Length; i++)
{
if (x + targetWidth > maxWidth)
if (x + targetWidth > endX)
{
break;
}