diff --git a/src/Menus.cpp b/src/Menus.cpp index 787cf192c..139374e6b 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -5682,15 +5682,12 @@ void AudacityProject::OnZoomThousandthSecond() void AudacityProject::OnZoomPreset(double newZoom) { - double currentZoom = mViewInfo.GetZoom(); + double zoomFactor = newZoom * mViewInfo.OffsetTimeByPixels(0.0, 1); - if (currentZoom != 0.0) { - double ratio = newZoom/currentZoom; - if (ratio > 1.0 ) - ZoomInByFactor(ratio); - else if (ratio < 1.0) - ZoomOutByFactor(ratio); - } + if (zoomFactor > 1.0 ) + ZoomInByFactor(zoomFactor); + else if (zoomFactor < 1.0) + ZoomOutByFactor(zoomFactor); } void AudacityProject::OnZoomFit() diff --git a/src/ViewInfo.h b/src/ViewInfo.h index 0bf7bc2fc..2bffb400f 100644 --- a/src/ViewInfo.h +++ b/src/ViewInfo.h @@ -86,9 +86,6 @@ public: // There is NO GetZoom()! // Use TimeToPosition and PositionToTime and OffsetTimeByPixels! - // DB added GetZoom() - needed for zoom presets. - - double GetZoom() const {return zoom; } // Limits zoom to certain bounds void SetZoom(double pixelsPerSecond);