Mercurial > hg > svgui
diff view/Pane.cpp @ 1449:ce5f80a7c697 single-point
Don't discard large wheel deltas; just clamp them
author | Chris Cannam |
---|---|
date | Wed, 01 May 2019 14:40:51 +0100 |
parents | c8a6fd3f9dff |
children | f9110e5afca1 |
line wrap: on
line diff
--- a/view/Pane.cpp Wed May 01 11:46:09 2019 +0100 +++ b/view/Pane.cpp Wed May 01 14:40:51 2019 +0100 @@ -2298,11 +2298,19 @@ // Coarse wheel information (or vertical zoom, which is // necessarily coarse itself) - // Sometimes on Linux we're seeing absurdly extreme angles on - // the first wheel event -- discard those entirely - if (abs(m_pendingWheelAngle) >= 600) { - m_pendingWheelAngle = 0; - return; + // Sometimes on Linux we're seeing very extreme angles on the + // first wheel event. They could be spurious, or they could be + // a result of the user frantically wheeling away while the + // pane was unresponsive for some reason. We don't want to + // discard them, as that makes the application feel even less + // responsive, but if we take them literally we risk changing + // the view so radically that the user won't recognise what + // has happened. Clamp them instead. + if (m_pendingWheelAngle > 600) { + m_pendingWheelAngle = 600; + } + if (m_pendingWheelAngle < -600) { + m_pendingWheelAngle = -600; } while (abs(m_pendingWheelAngle) >= 120) {