mirror of
https://github.com/nzp-team/quakec.git
synced 2024-12-11 21:22:03 +00:00
MENU: m_menu.qc: cap maxlen at 23
This commit is contained in:
parent
854530bf8a
commit
51d8827319
1 changed files with 3 additions and 6 deletions
|
@ -554,12 +554,9 @@ void(float order, vector minmaxsteps, string cvar_s, float is_int, float no_text
|
||||||
|
|
||||||
static void(string id, vector pos, vector size, __inout string text, __inout float cursor) handle_text_input =
|
static void(string id, vector pos, vector size, __inout string text, __inout float cursor) handle_text_input =
|
||||||
{
|
{
|
||||||
float maxlen = 0;
|
// best length to fit the largest character in the font
|
||||||
|
// ex: AAAAAAAAAAAAAAAAAAAAAAA
|
||||||
if (getTextWidth(text, MENU_TEXT_SMALL.x) + 18 >= size.x)
|
float maxlen = 23;
|
||||||
maxlen = strlen(text);
|
|
||||||
else
|
|
||||||
maxlen = 128;
|
|
||||||
|
|
||||||
sui_action_element(pos, size, id, sui_noop);
|
sui_action_element(pos, size, id, sui_noop);
|
||||||
if (sui_is_clicked(id)) cursor = strlen(text);
|
if (sui_is_clicked(id)) cursor = strlen(text);
|
||||||
|
|
Loading…
Reference in a new issue