From 85d7dc98e2cc17a125db7c02d7b75d4ff052e9a6 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 16 Aug 2020 01:31:49 +0200 Subject: [PATCH] Menu: Fixed scrollbar not showing, using a wrong max-item value for reference --- src/menu-fn/w_scrollbar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/menu-fn/w_scrollbar.cpp b/src/menu-fn/w_scrollbar.cpp index d539b47c..f50adb3d 100644 --- a/src/menu-fn/w_scrollbar.cpp +++ b/src/menu-fn/w_scrollbar.cpp @@ -24,7 +24,8 @@ class CScrollbar:CWidget int m_scroll; int m_minus; int m_max; - float m_itemheight; + int m_maxtotal; + int m_itemheight; virtual void(int) m_changed = 0; int m_up_hover; @@ -84,7 +85,7 @@ CScrollbar::Draw(void) 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) { + if (m_maxtotal * 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; } @@ -109,7 +110,7 @@ CScrollbar::Input(float type, float x, float y, float devid) int barstep = 0; /* too few entries? don't even bother */ - if (m_max * m_itemheight < m_height) { + if (m_maxtotal * m_itemheight < m_height) { return; } @@ -193,6 +194,7 @@ CScrollbar::SetMax(int val) { m_minus = (m_height + 20) / m_itemheight; m_max = val - m_minus; + m_maxtotal = val; } void