Temp fixes for controls

This commit is contained in:
Дядя Женя 2020-12-16 09:03:32 +03:00 committed by def
parent b8ba2b226a
commit 38e6878c48
3 changed files with 6 additions and 5 deletions

View file

@ -3162,8 +3162,8 @@ void CMenus::SetMenuPage(int NewPage)
bool CMenus::HandleListInputs(const CUIRect &View, float &ScrollValue, const float ScrollAmount, int *pScrollOffset, const float ElemHeight, int &SelectedIndex, const int NumElems)
{
int NewIndex = -1;
int Num = (int)(View.h / ElemHeight) + 1;
int ScrollNum = maximum(NumElems - Num + 1, 0);
int Num = (int)(View.h / ElemHeight);
int ScrollNum = maximum(NumElems - Num, 0);
if(ScrollNum > 0)
{
if(pScrollOffset && *pScrollOffset >= 0)

View file

@ -543,8 +543,9 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe
// do the scrollbar
View.HSplitTop(gs_ListBoxRowHeight, &Row, 0);
int NumViewable = (int)(gs_ListBoxOriginalView.h / Row.h) + 1;
int Num = (NumItems + gs_ListBoxItemsPerRow - 1) / gs_ListBoxItemsPerRow - NumViewable + 1;
int NumViewable = (int)(gs_ListBoxOriginalView.h / Row.h) * gs_ListBoxItemsPerRow;
//int Num = (NumItems + gs_ListBoxItemsPerRow - 1) / gs_ListBoxItemsPerRow - NumViewable + 1;
int Num = NumItems - NumViewable;
if(Num <= 0)
{
Num = 0;

View file

@ -884,7 +884,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
static int s_SelectedControl = -1;
static float s_ScrollValue = 0;
int OldSelected = s_SelectedControl;
UiDoListboxStart(&s_ControlsList, &MainView, 475.0f, Localize("Controls"), "", 1, 1, s_SelectedControl, s_ScrollValue);
UiDoListboxStart(&s_ControlsList, &MainView, 500.0f, Localize("Controls"), "", 1, 1, s_SelectedControl, s_ScrollValue);
CUIRect MovementSettings, WeaponSettings, VotingSettings, ChatSettings, DummySettings, MiscSettings, ResetButton;
CListboxItem Item = UiDoListboxNextItem(&OldSelected, false, false, true);