Skip to content

Commit 12f0188

Browse files
authored
DebugModeLabel: fix cut off text when Disable tiny font is enabled (#706)
1 parent 696346b commit 12f0188

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Source/Client/UI/IngameDebug.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,19 @@ internal static float DoDevInfo(float y)
143143

144144
internal static float DoDebugModeLabel(float y)
145145
{
146-
float x = UI.screenWidth - BtnWidth - BtnMargin;
146+
const float width = 90f;
147+
float x = UI.screenWidth - width - BtnMargin;
147148

148149
if (Multiplayer.Client != null && Multiplayer.GameComp.debugMode)
149150
{
150151
var text = "Debug mode\n";
151152
if (Multiplayer.LocalServer != null) text += "Host";
152153
else text += "Client";
154+
var height = Text.CalcHeight(text, width);
153155
using (MpStyle.Set(GameFont.Tiny).Set(TextAnchor.MiddleCenter))
154-
Widgets.Label(new Rect(x, y, BtnWidth, 30f), text);
156+
Widgets.Label(new Rect(x, y, width, height), text);
155157

156-
return BtnHeight;
158+
return height;
157159
}
158160

159161
return 0;

0 commit comments

Comments
 (0)