Skip to content

Commit aa517af

Browse files
committed
Don't let popup title flow out of box
1 parent 3fb7b15 commit aa517af

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/game/client/components/menus.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,11 @@ int CMenus::Render()
11081108

11091109
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
11101110
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
1111-
UI()->DoLabelScaled(&Part, pTitle, 24.f, 0);
1111+
Part.VMargin(20.f/UI()->Scale(), &Part);
1112+
if(TextRender()->TextWidth(0, 24.f, pTitle, -1) > Part.w)
1113+
UI()->DoLabelScaled(&Part, pTitle, 24.f, -1, (int)Part.w);
1114+
else
1115+
UI()->DoLabelScaled(&Part, pTitle, 24.f, 0);
11121116
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
11131117
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
11141118
Part.VMargin(20.f/UI()->Scale(), &Part);

0 commit comments

Comments
 (0)