1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 07:58:05 +02:00

Bug 1810 - Vertical Zoom in by clicking in the vertical Scale, or context menu, in waveform views is inconsistent.

This commit is contained in:
James Crook 2018-03-16 20:42:48 +00:00
parent 2cb76e0820
commit a48eb4eec9

View File

@ -182,26 +182,19 @@ void WaveTrackVZoomHandle::DoZoom
break;
case kZoomIn:
{
// Zoom in centered on cursor
if (min < -1.0 || max > 1.0) {
min = -1.0;
max = 1.0;
}
else {
// Enforce maximum vertical zoom
const float oldRange = max - min;
const float l = std::max(ZOOMLIMIT, 0.5f * oldRange);
const float ratio = l / (max - min);
// Enforce maximum vertical zoom
const float oldRange = max - min;
const float l = std::max(ZOOMLIMIT, 0.5f * oldRange);
const float ratio = l / (max - min);
const float p1 = (zoomStart - ypos) / (float)height;
const float c = (max * (1.0 - p1) + min * p1);
if (fixedMousePoint)
min = c - ratio * (1.0f - p1) * oldRange,
max = c + ratio * p1 * oldRange;
else
min = c - 0.5 * l,
max = c + 0.5 * l;
}
const float p1 = (zoomStart - ypos) / (float)height;
float c = (max * (1.0 - p1) + min * p1);
if (fixedMousePoint)
min = c - ratio * (1.0f - p1) * oldRange,
max = c + ratio * p1 * oldRange;
else
min = c - 0.5 * l,
max = c + 0.5 * l;
}
break;
case kZoomOut:
@ -688,7 +681,7 @@ UIHandle::Result WaveTrackVZoomHandle::Release
const auto partner = static_cast<WaveTrack *>(pTrack->GetLink());
DoZoom(pProject, pTrack.get(), partner,
shiftDown ? (rightUp ? kZoom1to1 : kZoomOut) : kZoomIn,
mRect, mZoomStart, mZoomEnd, false);
mRect, mZoomStart, mZoomEnd, !shiftDown);
}
}