diff --git a/source/gui/CDropDown.cpp b/source/gui/CDropDown.cpp index 95f9ee2c70..8fd393c8c3 100644 --- a/source/gui/CDropDown.cpp +++ b/source/gui/CDropDown.cpp @@ -113,8 +113,9 @@ void CDropDown::HandleMessage(SGUIMessage& Message) if (mouse.y >= rect.top + m_ItemsYPositions[i] && mouse.y < rect.top + m_ItemsYPositions[i+1] && // mouse is not over scroll-bar - !(mouse.x >= GetScrollBar(0).GetOuterRect().left && - mouse.x <= GetScrollBar(0).GetOuterRect().right)) + (m_HideScrollBar || + mouse.x < GetScrollBar(0).GetOuterRect().left || + mouse.x > GetScrollBar(0).GetOuterRect().right)) { set = i; } @@ -208,9 +209,10 @@ void CDropDown::HandleMessage(SGUIMessage& Message) return; // overshadow } - if (!(mouse.x >= GetScrollBar(0).GetOuterRect().left && - mouse.x <= GetScrollBar(0).GetOuterRect().right) && - mouse.y >= GetListRect().top) + if (m_HideScrollBar || + mouse.x < GetScrollBar(0).GetOuterRect().left || + mouse.x > GetScrollBar(0).GetOuterRect().right || + mouse.y < GetListRect().top) { m_Open = false; GetScrollBar(0).SetZ(GetBufferedZ()); diff --git a/source/gui/CGUIScrollBarVertical.cpp b/source/gui/CGUIScrollBarVertical.cpp index 0a08a5ed23..aea92eacfc 100644 --- a/source/gui/CGUIScrollBarVertical.cpp +++ b/source/gui/CGUIScrollBarVertical.cpp @@ -54,7 +54,7 @@ void CGUIScrollBarVertical::Draw() return; } - if (GetGUI() && GetMaxPos() != 1) + if (GetGUI() && IsVisible()) { CRect outline = GetOuterRect(); diff --git a/source/gui/CList.cpp b/source/gui/CList.cpp index 7f5af0ab45..017fe07a8f 100644 --- a/source/gui/CList.cpp +++ b/source/gui/CList.cpp @@ -200,8 +200,9 @@ void CList::HandleMessage(SGUIMessage& Message) if (mouse.y >= rect.top + m_ItemsYPositions[i] && mouse.y < rect.top + m_ItemsYPositions[i+1] && // mouse is not over scroll-bar - !(mouse.x >= GetScrollBar(0).GetOuterRect().left && - mouse.x <= GetScrollBar(0).GetOuterRect().right)) + (!scrollbar || !GetScrollBar(0).IsVisible() || + mouse.x < GetScrollBar(0).GetOuterRect().left || + mouse.x > GetScrollBar(0).GetOuterRect().right)) { set = i; } diff --git a/source/gui/IGUIScrollBar.h b/source/gui/IGUIScrollBar.h index d591878066..4e00d96838 100644 --- a/source/gui/IGUIScrollBar.h +++ b/source/gui/IGUIScrollBar.h @@ -209,6 +209,11 @@ public: */ float GetMaxPos() const { return std::max(1.f, m_ScrollRange - m_ScrollSpace); } + /** + * Get the value of m_Pos that corresponds to the bottom of the scrollable region + */ + float IsVisible() const { return GetMaxPos() != 1.f; } + /** * Increase scroll one step */