derf / feh

a fast and light image viewer
https://feh.finalrewind.org
Other
1.53k stars 159 forks source link

Improve zooming feature with logarithmic scale #677

Open myQwil opened 2 years ago

myQwil commented 2 years ago

Zoom-mode now zooms on a logarithmic scale, and the events for zooming in/out gravitate to powers of 2, such as 50%, 100%, 200%, etc.

The option --zoom-step has been changed to represent the number of zoom steps between powers of 2, with the default being 3 steps.

The number of zoom steps is optional, while the rate of zoom-mode uses a constant rate that is not affected by zoom steps.

Edit: You can also step between powers other than 2. For example, if you want 5 steps between powers of 3, you would enter the raw value of ln(2) / ln(3) * 5 which results in:

--zoom-step=3.154648768

pepa65 commented 2 years ago

Excellent idea! I would still like a separate slow-zoom mode, but this is great.

myQwil commented 2 years ago

Okay, so I've added another option called --zoom-rate, which allows for different zoom rates in zoom-mode.

While --zoom-steps is the number of button or key presses between powers of 2, --zoom-rate represents the number of pixels between powers of 2 that the user clicks and drags between, so if you added the arg --zoom-rate=1024, it would result in a very slow zoom-mode. The default is 128 pixels.

avlec commented 1 year ago

Thank you for making this better 😄