From: terencehill Date: Mon, 2 May 2016 14:15:14 +0000 (+0200) Subject: Limit number of lines displayed in a tooltip otherwise the menu refuses to allocate... X-Git-Tag: xonotic-v0.8.2~932^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6846dab75105d323887d3eff2490ab81cc4cdfa4;p=xonotic%2Fxonotic-data.pk3dir.git Limit number of lines displayed in a tooltip otherwise the menu refuses to allocate a too tall tooltip. It can happen for items controlling many cvars when menu_tooltips is 2, e.g. the "Powerup notifications" checkbox --- diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index b2b2d662a..96d98b9c5 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -588,9 +588,11 @@ void m_tooltip(vector pos) int i = 0; float w = 0; - for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; ++i) + for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i) { string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors); + if (i == 16) + s = "..."; float f = draw_TextWidth(s, false, fontsize); if (f > w) w = f; } @@ -660,9 +662,12 @@ void m_tooltip(vector pos) p = menuTooltipOrigin; p.x += SKINMARGIN_TOOLTIP_x / conwidth; p.y += SKINMARGIN_TOOLTIP_y / conheight; - for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; p.y += fontsize.y) + int i = 0; + for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining && i <= 16; ++i, p.y += fontsize.y) { string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors); + if (i == 16) + s = "..."; draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false); } }