Skip to content

Commit

Permalink
complete unbound the zoom... previously allowed 10% - 1600%
Browse files Browse the repository at this point in the history
now it's limited to as small as possible and zoomed in as long as the image "rescaled" is < 65535 (internal limitation)

While not very useful for most people, for those using extremely large or small images, it gives them more options

Partially addresses #85
  • Loading branch information
sylikc committed Feb 18, 2023
1 parent 763f7ec commit f93e388
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JPEGView/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ namespace Helpers {
};

// Maximum and minimum allowed zoom factors for images
const double ZoomMax = 16.0;
const double ZoomMin = 0.1;
const double ZoomMax = DBL_MAX; // unbound the maximum zoom, previously set at 16.0 (1600%)
const double ZoomMin = DBL_MIN; // unbound the minimum zoom, previously set at 0.1 (10%)

// Round to integer
inline int RoundToInt(double d) {
Expand Down
8 changes: 8 additions & 0 deletions src/JPEGView/MainDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,14 @@ void CMainDlg::PerformZoom(double dValue, bool bExponent, bool bZoomToMouse, boo
nNewYSize = (int)(m_pCurrentImage->OrigHeight() * m_dZoom + 0.5);
}

// because we've increased the maximum zoom allowed, only actually perform the zoom if the old and new dimensions differ
// the float arithmetic doesn't always come up with the same answer
if (nOldXSize == nNewXSize && nOldYSize == nNewYSize) {
m_dZoom = dOldZoom; // restore previous zoom value, then do nothing
return;
}


if (bZoomToMouse) {
// zoom to mouse
int nCenterX = m_bZoomMode ? m_nCapturedX : m_nMouseX;
Expand Down

0 comments on commit f93e388

Please sign in to comment.