Skip to content

Commit

Permalink
returning without zooming with the new 65535 check for zooming actual…
Browse files Browse the repository at this point in the history
…ly caused inconsistent zoom behavior at the max zoom on some images,

so, undo the change so it only checks when the sizes are the same
  • Loading branch information
sylikc committed Mar 4, 2023
1 parent d92d5ce commit e1100ad
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/JPEGView/MainDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,14 +2654,7 @@ void CMainDlg::PerformZoom(double dValue, bool bExponent, bool bZoomToMouse, boo
#endif

// because we've increased/decreased to the maximum zoom allowed,
// only actually perform the zoom if the old and new dimensions differ,
// or at the edge of allowable max dimension (maximum 65535 pixels)
if (nNewXSize == 65535 || nNewYSize == 65535) {
// zooming in does not require restoring the previous zoom value
// because the code which checks the 65535 will re-scale the zoom factor to ensure it never exceeds 65535
return;
}

// only actually perform the zoom if the old and new dimensions differ
// the float arithmetic doesn't always come up with the same answer, but the new sizes can be directly compared
if (nNewXSize == nOldXSize && nNewYSize == nOldYSize) {
// because there's rounding errors, it is possible to get stuck zooming out from fractional zoom,
Expand All @@ -2675,6 +2668,8 @@ void CMainDlg::PerformZoom(double dValue, bool bExponent, bool bZoomToMouse, boo
// NOTE: this gets triggered on pauseAtZoom
m_dZoom = dOldZoom; // restore previous zoom value
}
// zooming in does not require restoring the previous zoom value
// because the code which checks the 65535 will re-scale the zoom factor to ensure it never exceeds 65535

return; // then do nothing
}
Expand Down

0 comments on commit e1100ad

Please sign in to comment.