comparison view/Pane.cpp @ 1402:b0eeec95ab5b

Handle integer pixel scaling as well
author Chris Cannam
date Thu, 15 Nov 2018 14:18:26 +0000
parents 28075cc658c9
children a33d38247631
comparison
equal deleted inserted replaced
1401:28075cc658c9 1402:b0eeec95ab5b
1171 { 1171 {
1172 closeToLeftEdge = closeToRightEdge = false; 1172 closeToLeftEdge = closeToRightEdge = false;
1173 1173
1174 if (!m_manager) return Selection(); 1174 if (!m_manager) return Selection();
1175 1175
1176 sv_frame_t testFrame = getFrameForX(x - scaleSize(5)); 1176 sv_frame_t testFrame = getFrameForX(x - scalePixelSize(5));
1177 if (testFrame < 0) { 1177 if (testFrame < 0) {
1178 testFrame = getFrameForX(x); 1178 testFrame = getFrameForX(x);
1179 if (testFrame < 0) return Selection(); 1179 if (testFrame < 0) return Selection();
1180 } 1180 }
1181 1181
1183 if (selection.isEmpty()) return selection; 1183 if (selection.isEmpty()) return selection;
1184 1184
1185 int lx = getXForFrame(selection.getStartFrame()); 1185 int lx = getXForFrame(selection.getStartFrame());
1186 int rx = getXForFrame(selection.getEndFrame()); 1186 int rx = getXForFrame(selection.getEndFrame());
1187 1187
1188 int fuzz = scaleSize(2); 1188 int fuzz = scalePixelSize(2);
1189 if (x < lx - fuzz || x > rx + fuzz) return Selection(); 1189 if (x < lx - fuzz || x > rx + fuzz) return Selection();
1190 1190
1191 int width = rx - lx; 1191 int width = rx - lx;
1192 fuzz = scaleSize(3); 1192 fuzz = scalePixelSize(3);
1193 if (width < 12) fuzz = width / 4; 1193 if (width < 12) fuzz = width / 4;
1194 if (fuzz < scaleSize(1)) { 1194 if (fuzz < scalePixelSize(1)) {
1195 fuzz = scaleSize(1); 1195 fuzz = scalePixelSize(1);
1196 } 1196 }
1197 1197
1198 if (x < lx + fuzz) closeToLeftEdge = true; 1198 if (x < lx + fuzz) closeToLeftEdge = true;
1199 if (x > rx - fuzz) closeToRightEdge = true; 1199 if (x > rx - fuzz) closeToRightEdge = true;
1200 1200