mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-22 22:43:01 +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:
@@ -182,26 +182,19 @@ void WaveTrackVZoomHandle::DoZoom
|
|||||||
break;
|
break;
|
||||||
case kZoomIn:
|
case kZoomIn:
|
||||||
{
|
{
|
||||||
// Zoom in centered on cursor
|
// Enforce maximum vertical zoom
|
||||||
if (min < -1.0 || max > 1.0) {
|
const float oldRange = max - min;
|
||||||
min = -1.0;
|
const float l = std::max(ZOOMLIMIT, 0.5f * oldRange);
|
||||||
max = 1.0;
|
const float ratio = l / (max - min);
|
||||||
}
|
|
||||||
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);
|
|
||||||
|
|
||||||
const float p1 = (zoomStart - ypos) / (float)height;
|
const float p1 = (zoomStart - ypos) / (float)height;
|
||||||
const float c = (max * (1.0 - p1) + min * p1);
|
float c = (max * (1.0 - p1) + min * p1);
|
||||||
if (fixedMousePoint)
|
if (fixedMousePoint)
|
||||||
min = c - ratio * (1.0f - p1) * oldRange,
|
min = c - ratio * (1.0f - p1) * oldRange,
|
||||||
max = c + ratio * p1 * oldRange;
|
max = c + ratio * p1 * oldRange;
|
||||||
else
|
else
|
||||||
min = c - 0.5 * l,
|
min = c - 0.5 * l,
|
||||||
max = c + 0.5 * l;
|
max = c + 0.5 * l;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kZoomOut:
|
case kZoomOut:
|
||||||
@@ -688,7 +681,7 @@ UIHandle::Result WaveTrackVZoomHandle::Release
|
|||||||
const auto partner = static_cast<WaveTrack *>(pTrack->GetLink());
|
const auto partner = static_cast<WaveTrack *>(pTrack->GetLink());
|
||||||
DoZoom(pProject, pTrack.get(), partner,
|
DoZoom(pProject, pTrack.get(), partner,
|
||||||
shiftDown ? (rightUp ? kZoom1to1 : kZoomOut) : kZoomIn,
|
shiftDown ? (rightUp ? kZoom1to1 : kZoomOut) : kZoomIn,
|
||||||
mRect, mZoomStart, mZoomEnd, false);
|
mRect, mZoomStart, mZoomEnd, !shiftDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user