]> git.cworth.org Git - acre/commitdiff
acre-x: Fix zooming so that zoom-in and zoom-out use the same amounts
authorCarl Worth <cworth@cworth.org>
Thu, 7 Nov 2013 21:14:56 +0000 (13:14 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 7 Nov 2013 21:14:56 +0000 (13:14 -0800)
The intent was always that one zoom-in followed by one zoom-out, (or
vice versa) would lead to the original zoom level. But the zoom-out
code had some incorrect arithmetic in it such that zooming out was
much faster than zooming in.

acre-x.c

index 194926a0ae7e8502d1a75f2903698950c74e486e..c375c36efddee95a1d7afd4e74262a3d740f4cbd 100644 (file)
--- a/acre-x.c
+++ b/acre-x.c
@@ -154,7 +154,7 @@ handle_events(Display *dpy, Window window, Visual *visual,
                        }
                        else if (keycode == minus_code)
                        {
-                               shift = (1- 2*ZOOM) * (x_max - x_min);
+                               shift = (ZOOM/(1 - 2 * ZOOM)) * (x_max - x_min);
                                x_min -= shift;
                                x_max += shift;
                        }