1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Fix off-by-ones in drawing of zoom rectangles...

... If one dashed boundary goes through the click point, the other should go
through the drag point, not one next to it.

This applies to zoom in the vertical ruler, and to horizontal zoom with the
magnifier.
This commit is contained in:
Paul Licameli 2015-08-21 11:32:53 -04:00
parent 68cbd4fbfe
commit 4b028995cb

View File

@ -4441,18 +4441,16 @@ void TrackPanel::HandleZoomClick(wxMouseEvent & event)
/// Zoom drag
void TrackPanel::HandleZoomDrag(wxMouseEvent & event)
{
int left, width, height;
left = GetLeftOffset();
GetTracksUsableArea(&width, &height);
const int left = GetLeftOffset();
const int right = GetSize().x - kRightMargin - 1;
mZoomEnd = event.m_x;
if (event.m_x < left) {
mZoomEnd = left;
}
else if (event.m_x >= left + width - 1) {
mZoomEnd = left + width - 1;
else if (event.m_x > right) {
mZoomEnd = right;
}
if (IsDragZooming()) {
@ -7633,17 +7631,18 @@ void TrackPanel::DrawZooming(wxDC * dc, const wxRect & clip)
if (mMouseCapture==IsVZooming) {
int width, height;
GetTracksUsableArea(&width, &height);
rect.y = mZoomStart;
rect.y = std::min(mZoomStart, mZoomEnd);
rect.height = 1 + abs(mZoomEnd - mZoomStart);
rect.x = GetVRulerOffset();
rect.width = width + GetVRulerWidth() + 1; //+1 extends into border rect
rect.height = mZoomEnd - mZoomStart;
rect.SetRight(GetSize().x - kRightMargin); // extends into border rect
}
else {
rect.x = mZoomStart;
rect.x = std::min(mZoomStart, mZoomEnd);
rect.width = 1 + abs(mZoomEnd - mZoomStart);
rect.y = -1;
rect.width = mZoomEnd - mZoomStart;
rect.height = clip.height + 2;
}