Skip to content

Commit

Permalink
Win: Make the zoom-out behavior more intuitive
Browse files Browse the repository at this point in the history
If the current scaling factor is between two of the normal zoom stops
(10-100% in increments of 10%, 100-200% in increments of 25%, and
200-400% in increments of 50%), then zoom out to the nearest stop.  If
the current scaling factor is above 400%, then zoom out to 400% rather
than stopping at the nearest increment of 50% above 400%.
  • Loading branch information
dcommander committed Nov 3, 2021
1 parent 02c4fdd commit d813d05
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions win/vncviewer/ClientConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2436,12 +2436,13 @@ LRESULT CALLBACK ClientConnection::WndProc1(HWND hwnd, UINT iMsg,
int sf = (_this->m_opts.m_scale_num * 100) /
_this->m_opts.m_scale_den;
if (sf <= 100)
sf = ((sf / 10) - 1) * 10;
sf = (((sf + 9) / 10) - 1) * 10;
else if (sf >= 100 && sf <= 200)
sf = ((sf / 25) - 1) * 25;
sf = (((sf + 24) / 25) - 1) * 25;
else
sf = ((sf / 50) - 1) * 50;
sf = (((sf + 49) / 50) - 1) * 50;
if (sf < 10) sf = 10;
if (sf > 400) sf = 400;
_this->m_opts.m_scale_num = sf;
_this->m_opts.m_scale_den = 100;
_this->m_opts.m_scaling = (sf != 100);
Expand Down

0 comments on commit d813d05

Please sign in to comment.