Skip to content

app: Smoother zooming while dragging with the mouse

woob requested to merge thetoastcaper/gimp:smooth-drag-zoom into master

This commit makes zooming using Ctrl + (Middle Click / Spacebar) work much more smoothly compared to previous behavior. Whereas previously, the canvas would simply zoom based only on how many mouse movement events you trigger, this new method factors in the actual distance moved. The use of an exponential function to calculate the scaling factor means that this can be done without having to track anything like the total distance moved or the initial canvas scale.

Per commit message:

Changes the behavior of gimp_display_shell_scale_drag() to factor in the distance dragged, rather than just scaling a flat +/- 10% for each detected movement event. The factor by which to change the scaling is also altered from 10% at each movement event, to 1% compounded for each pixel of distance dragged.
This makes zooming via Ctrl + Middle Click or Ctrl + Spacebar behave more consistently and less jittery versus the previous method, while offering more fine grained control.

Note: I don't have access to anything other than my own display to check this on, so it would probably be good to make sure that this works just as well on high DPI setups before merging.

Merge request reports