Menu: Make the scrollbar not appear with too few entries.

This commit is contained in:
Marco Cawthorne 2020-04-01 12:24:07 +02:00
parent 94e4d80e39
commit cf13c4faf4
1 changed files with 11 additions and 0 deletions

View File

@ -81,6 +81,12 @@ void CScrollbar::Draw(void)
barheight = 20 /*m_theight * (m_theight / (m_max * m_itemheight))*/;
barstep = (m_scroll * m_itemheight) * (m_theight / (m_max * m_itemheight));
/* too few entries? don't even bother */
if (m_max * m_itemheight < m_height) {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y+16], [16,m_theight+20], [0.25,0.25,0.25], 1.0f);
return;
}
if (!m_hold) {
drawfill([g_menuofs[0]+m_x,g_menuofs[1]+m_y+16], [16,m_theight+20], [0.25,0.25,0.25], 1.0f);
if (!m_hover) {
@ -99,6 +105,11 @@ void CScrollbar::Input(float type, float x, float y, float devid)
int barheight = 0;
int barstep = 0;
/* too few entries? don't even bother */
if (m_max * m_itemheight < m_height) {
return;
}
/* Up Arrow */
if (Util_CheckMouse(m_x, m_y, 16, 16)) {
m_up_hover = TRUE;