mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed a problem with the skin selector
This commit is contained in:
parent
d2519f7ab9
commit
1209ad9baf
|
@ -376,7 +376,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(void *pId, bool Selected)
|
||||||
if(NewIndex > -1 && NewIndex < gs_ListBoxNumItems)
|
if(NewIndex > -1 && NewIndex < gs_ListBoxNumItems)
|
||||||
{
|
{
|
||||||
// scroll
|
// scroll
|
||||||
float Offset = (NewIndex-gs_ListBoxNewSelected)*gs_ListBoxRowHeight;
|
float Offset = (NewIndex/gs_ListBoxItemsPerRow-gs_ListBoxNewSelected/gs_ListBoxItemsPerRow)*gs_ListBoxRowHeight;
|
||||||
int Scroll = gs_ListBoxOriginalView.y > Item.m_Rect.y+Offset ? -1 :
|
int Scroll = gs_ListBoxOriginalView.y > Item.m_Rect.y+Offset ? -1 :
|
||||||
gs_ListBoxOriginalView.y+gs_ListBoxOriginalView.h < Item.m_Rect.y+Item.m_Rect.h+Offset ? 1 : 0;
|
gs_ListBoxOriginalView.y+gs_ListBoxOriginalView.h < Item.m_Rect.y+Item.m_Rect.h+Offset ? 1 : 0;
|
||||||
if(Scroll)
|
if(Scroll)
|
||||||
|
@ -385,13 +385,13 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(void *pId, bool Selected)
|
||||||
int ScrollNum = (gs_ListBoxNumItems+gs_ListBoxItemsPerRow-1)/gs_ListBoxItemsPerRow-NumViewable+1;
|
int ScrollNum = (gs_ListBoxNumItems+gs_ListBoxItemsPerRow-1)/gs_ListBoxItemsPerRow-NumViewable+1;
|
||||||
if(Scroll < 0)
|
if(Scroll < 0)
|
||||||
{
|
{
|
||||||
int Num = (gs_ListBoxOriginalView.y-Item.m_Rect.y-Offset+gs_ListBoxRowHeight-1.0f)/(gs_ListBoxItemsPerRow*gs_ListBoxRowHeight);
|
int Num = (gs_ListBoxOriginalView.y-Item.m_Rect.y-Offset+gs_ListBoxRowHeight-1.0f)/gs_ListBoxRowHeight;
|
||||||
gs_ListBoxScrollValue -= (1.0f/ScrollNum)*Num;
|
gs_ListBoxScrollValue -= (1.0f/ScrollNum)*Num;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int Num = (Item.m_Rect.y+Item.m_Rect.h+Offset-(gs_ListBoxOriginalView.y+gs_ListBoxOriginalView.h)+gs_ListBoxRowHeight-1.0f)/
|
int Num = (Item.m_Rect.y+Item.m_Rect.h+Offset-(gs_ListBoxOriginalView.y+gs_ListBoxOriginalView.h)+gs_ListBoxRowHeight-1.0f)/
|
||||||
(gs_ListBoxItemsPerRow*gs_ListBoxRowHeight);
|
gs_ListBoxRowHeight;
|
||||||
gs_ListBoxScrollValue += (1.0f/ScrollNum)*Num;
|
gs_ListBoxScrollValue += (1.0f/ScrollNum)*Num;
|
||||||
}
|
}
|
||||||
if(gs_ListBoxScrollValue < 0.0f) gs_ListBoxScrollValue = 0.0f;
|
if(gs_ListBoxScrollValue < 0.0f) gs_ListBoxScrollValue = 0.0f;
|
||||||
|
|
Loading…
Reference in a new issue