Fix mousewheel behaviour in textarea (#6641)
authorshivajiva101 <shivajiva101@hotmail.com>
Sat, 18 Nov 2017 13:58:08 +0000 (13:58 +0000)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Sat, 18 Nov 2017 13:58:08 +0000 (14:58 +0100)
Allowing scrolling with the mousewheel when the vertical scrollbar is
hidden, unnecessarily exposes oversized containers and newlines at the
end of the text. For example try scrolling over the textareas in the
pause menu. This PR addresses the issue by requiring the scrollbar to be
visible before allowing the scrolling with the mousewheel.

src/gui/intlGUIEditBox.cpp

index 279e7a48a205e1a022855b965de3ea5f2354b7db..c03256ede0b8204cf12b2add4690d9ffd20e9dca 100644 (file)
@@ -1087,7 +1087,7 @@ bool intlGUIEditBox::processMouse(const SEvent& event)
                }
                break;
        case EMIE_MOUSE_WHEEL:
-               if (m_vscrollbar) {
+               if (m_vscrollbar && m_vscrollbar->isVisible()) {
                        s32 pos = m_vscrollbar->getPos();
                        s32 step = m_vscrollbar->getSmallStep();
                        m_vscrollbar->setPos(pos - event.MouseInput.Wheel * step);