This commit is contained in:
Дядя Женя 2020-12-14 08:50:20 +03:00 committed by def
parent aefcbf812d
commit b8ba2b226a
4 changed files with 4 additions and 14 deletions

View file

@ -887,7 +887,8 @@ float CMenus::DoScrollbarV(const void *pID, const CUIRect *pRect, float Current)
static float OffsetY;
pRect->HSplitTop(33, &Handle, 0);
Handle.y += (pRect->h - Handle.h) * Current;
Current = clamp(Current, 0.0f, 1.0f);
Handle.y = pRect->y + (pRect->h - Handle.h) * Current;
// logic
float ReturnValue = Current;

View file

@ -148,7 +148,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
RenderTools()->DrawUIRect(&View, ColorRGBA(0, 0, 0, 0.15f), 0, 0);
CUIRect Scroll;
View.VSplitRight(15, &View, &Scroll);
View.VSplitRight(10, &View, &Scroll);
int NumServers = ServerBrowser()->NumSortedServers();
@ -168,7 +168,6 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
static int s_ScrollBar = 0;
static float s_ScrollValue = 0;
Scroll.HMargin(5.0f, &Scroll);
s_ScrollValue = DoScrollbarV(&s_ScrollBar, &Scroll, s_ScrollValue);
if(Input()->KeyPress(KEY_TAB) && m_pClient->m_pGameConsole->IsClosed())

View file

@ -521,18 +521,10 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe
if(!LogicOnly)
{
// draw header
/*
View.HSplitTop(ms_ListheaderHeight, &Header, &View);
RenderTools()->DrawUIRect(&Header, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_T, 5.0f);
UI()->DoLabel(&Header, pTitle, Header.h * ms_FontmodHeight, 0);
*/
// background
RenderTools()->DrawUIRect(&View, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_ALL, 5.0f);
}
// prepare the scroll
View.VSplitRight(10, &View, &Scroll);
// setup the variables
@ -565,7 +557,6 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe
gs_ListBoxScrollValue += Num == 1 ? 0.1f : 3.0f / Num;
}
//Scroll.HMargin(5.0f, &Scroll);
gs_ListBoxScrollValue = clamp(DoScrollbarV(pID, &Scroll, gs_ListBoxScrollValue), 0.0f, 1.0f);
// the list

View file

@ -1012,14 +1012,13 @@ void CMenus::RenderGhost(CUIRect MainView)
RenderTools()->DrawUIRect(&View, ColorRGBA(0, 0, 0, 0.15f), 0, 0);
CUIRect Scroll;
View.VSplitRight(15, &View, &Scroll);
View.VSplitRight(10, &View, &Scroll);
int NumGhosts = m_lGhosts.size();
static int s_ScrollBar = 0;
static float s_ScrollValue = 0;
static int s_SelectedIndex = 0;
Scroll.HMargin(5.0f, &Scroll);
s_ScrollValue = DoScrollbarV(&s_ScrollBar, &Scroll, s_ScrollValue);
HandleListInputs(View, s_ScrollValue, 1.0f, nullptr, s_aCols[0].m_Rect.h, s_SelectedIndex, NumGhosts);