Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
966:e297b7d752f2 | 967:faa8532e4f02 |
---|---|
2150 | 2150 |
2151 if (doScroll) { | 2151 if (doScroll) { |
2152 sv_frame_t offset = mouseFrame - getStartFrame(); | 2152 sv_frame_t offset = mouseFrame - getStartFrame(); |
2153 sv_frame_t available = getEndFrame() - getStartFrame(); | 2153 sv_frame_t available = getEndFrame() - getStartFrame(); |
2154 sv_frame_t move = 0; | 2154 sv_frame_t move = 0; |
2155 if (offset >= double(available) * 0.95) { | 2155 sv_frame_t rightEdge = available - (available / 20); |
2156 move = sv_frame_t(double(offset - available) * 0.95) + 1; | 2156 sv_frame_t leftEdge = (available / 10); |
2157 } else if (offset <= double(available) * 0.10) { | 2157 if (offset >= rightEdge) { |
2158 move = sv_frame_t(double(available) * 0.10 - double(offset)) + 1; | 2158 move = offset - rightEdge + 1; |
2159 move = -move; | 2159 } else if (offset <= leftEdge) { |
2160 move = offset - leftEdge - 1; | |
2160 } | 2161 } |
2161 if (move != 0) { | 2162 if (move != 0) { |
2162 setCentreFrame(m_centreFrame + move); | 2163 setCentreFrame(m_centreFrame + move); |
2163 update(); | 2164 update(); |
2164 } | 2165 } |