mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Better word wrapping for hoverwatch
This commit is contained in:
parent
9afa24e5d7
commit
76d997fca7
2 changed files with 6 additions and 1 deletions
|
@ -887,7 +887,7 @@ namespace Beefy.gfx
|
|||
if (fontMetrics != null)
|
||||
fontMetrics.mLineCount++;
|
||||
|
||||
drawHeight += Draw(g, StringView(workingStr, 0, checkIdx), useX, useY, justification, width, stringEndMode, fontMetrics);
|
||||
drawHeight += Draw(g, StringView(workingStr, 0, checkIdx), useX, useY, justification, width, .Truncate, fontMetrics);
|
||||
useY += GetLineSpacing();
|
||||
workingStr.Adjust(checkIdx);
|
||||
}
|
||||
|
|
|
@ -1257,6 +1257,8 @@ namespace IDE.ui
|
|||
|
||||
if ((wantWordWrap) && (useWidth < wantWidth))
|
||||
{
|
||||
float actualMaxWidth = 0;
|
||||
|
||||
for (WatchListViewItem listViewItem in listView.GetRoot().mChildItems)
|
||||
{
|
||||
if (listViewItem.mLabel == null)
|
||||
|
@ -1265,11 +1267,14 @@ namespace IDE.ui
|
|||
listView.mWordWrap = true;
|
||||
FontMetrics fontMetrics = .();
|
||||
float nameHeight = font.Draw(null, listViewItem.mLabel, 0, 0, -1, useWidth - GS!(32), FontOverflowMode.Wrap, &fontMetrics);
|
||||
actualMaxWidth = Math.Max(actualMaxWidth, fontMetrics.mMaxWidth);
|
||||
|
||||
float addHeight = nameHeight - listViewItem.mSelfHeight;
|
||||
height += addHeight;
|
||||
}
|
||||
|
||||
useWidth = actualMaxWidth + GS!(32);
|
||||
|
||||
listView.mColumns[0].mWidth = useWidth - GS!(2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue