mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
reverted edit boxes to 0.6 behavior. closes #1937
This commit is contained in:
parent
7b21682fec
commit
2d2fe8bf57
|
@ -448,11 +448,10 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
s_DoScroll = true;
|
||||
s_ScrollStart = UI()->MouseX();
|
||||
int MxRel = (int)(UI()->MouseX() - pRect->x);
|
||||
float Offset = pRect->w/2.0f-TextRender()->TextWidth(0, FontSize, pStr, -1)/2.0f;
|
||||
|
||||
for(int i = 1; i <= Len; i++)
|
||||
{
|
||||
if(Offset + TextRender()->TextWidth(0, FontSize, pStr, i) - *pOffset > MxRel)
|
||||
if(TextRender()->TextWidth(0, FontSize, pStr, i) - *pOffset > MxRel)
|
||||
{
|
||||
s_AtIndex = i - 1;
|
||||
break;
|
||||
|
@ -562,15 +561,14 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
UI()->ClipEnable(pRect);
|
||||
Textbox.x -= *pOffset;
|
||||
|
||||
UI()->DoLabel(&Textbox, pDisplayStr, FontSize, CUI::ALIGN_CENTER);
|
||||
UI()->DoLabel(&Textbox, pDisplayStr, FontSize, CUI::ALIGN_LEFT);
|
||||
|
||||
// render the cursor
|
||||
if(UI()->LastActiveItem() == pID && !JustGotActive)
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
Textbox = *pRect;
|
||||
Textbox.x += Textbox.w/2.0f-w/2.0f;
|
||||
w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
Textbox.VSplitLeft(2.0f, 0, &Textbox);
|
||||
Textbox.x += (w-*pOffset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);
|
||||
|
||||
if((2*time_get()/time_freq()) % 2) // make it blink
|
||||
|
|
Loading…
Reference in a new issue