Mercurial > hg > svgui
diff view/Pane.cpp @ 967:faa8532e4f02
Fix arithmetic precedence misreading goof which led to scrolling the wrong way when dragging past the right edge
author | Chris Cannam |
---|---|
date | Thu, 21 May 2015 14:41:28 +0100 |
parents | e297b7d752f2 |
children | f2c63ec85901 c02c51ae5238 |
line wrap: on
line diff
--- a/view/Pane.cpp Thu May 21 14:06:20 2015 +0100 +++ b/view/Pane.cpp Thu May 21 14:41:28 2015 +0100 @@ -2152,11 +2152,12 @@ sv_frame_t offset = mouseFrame - getStartFrame(); sv_frame_t available = getEndFrame() - getStartFrame(); sv_frame_t move = 0; - if (offset >= double(available) * 0.95) { - move = sv_frame_t(double(offset - available) * 0.95) + 1; - } else if (offset <= double(available) * 0.10) { - move = sv_frame_t(double(available) * 0.10 - double(offset)) + 1; - move = -move; + sv_frame_t rightEdge = available - (available / 20); + sv_frame_t leftEdge = (available / 10); + if (offset >= rightEdge) { + move = offset - rightEdge + 1; + } else if (offset <= leftEdge) { + move = offset - leftEdge - 1; } if (move != 0) { setCentreFrame(m_centreFrame + move);