mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 23:30:07 +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:
parent
68cbd4fbfe
commit
4b028995cb
@ -4441,18 +4441,16 @@ void TrackPanel::HandleZoomClick(wxMouseEvent & event)
|
|||||||
/// Zoom drag
|
/// Zoom drag
|
||||||
void TrackPanel::HandleZoomDrag(wxMouseEvent & event)
|
void TrackPanel::HandleZoomDrag(wxMouseEvent & event)
|
||||||
{
|
{
|
||||||
int left, width, height;
|
const int left = GetLeftOffset();
|
||||||
|
const int right = GetSize().x - kRightMargin - 1;
|
||||||
left = GetLeftOffset();
|
|
||||||
GetTracksUsableArea(&width, &height);
|
|
||||||
|
|
||||||
mZoomEnd = event.m_x;
|
mZoomEnd = event.m_x;
|
||||||
|
|
||||||
if (event.m_x < left) {
|
if (event.m_x < left) {
|
||||||
mZoomEnd = left;
|
mZoomEnd = left;
|
||||||
}
|
}
|
||||||
else if (event.m_x >= left + width - 1) {
|
else if (event.m_x > right) {
|
||||||
mZoomEnd = left + width - 1;
|
mZoomEnd = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDragZooming()) {
|
if (IsDragZooming()) {
|
||||||
@ -7633,17 +7631,18 @@ void TrackPanel::DrawZooming(wxDC * dc, const wxRect & clip)
|
|||||||
|
|
||||||
if (mMouseCapture==IsVZooming) {
|
if (mMouseCapture==IsVZooming) {
|
||||||
int width, height;
|
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.x = GetVRulerOffset();
|
||||||
rect.width = width + GetVRulerWidth() + 1; //+1 extends into border rect
|
rect.SetRight(GetSize().x - kRightMargin); // extends into border rect
|
||||||
rect.height = mZoomEnd - mZoomStart;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rect.x = mZoomStart;
|
rect.x = std::min(mZoomStart, mZoomEnd);
|
||||||
|
rect.width = 1 + abs(mZoomEnd - mZoomStart);
|
||||||
|
|
||||||
rect.y = -1;
|
rect.y = -1;
|
||||||
rect.width = mZoomEnd - mZoomStart;
|
|
||||||
rect.height = clip.height + 2;
|
rect.height = clip.height + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user