X-Git-Url: https://git.cworth.org/git?p=acre;a=blobdiff_plain;f=acre-x.c;fp=acre-x.c;h=e89c7fcf285f556d1b402a245cd3f43f42f57f1a;hp=c1f7c414f42ef26b74cdb563d8ace4aba7e9dd67;hb=12b6b0f6a439c7838daac5e2a1e5764bd0218936;hpb=1a4594b5739b8448bf711a30b1c8bf23c0cd1912 diff --git a/acre-x.c b/acre-x.c index c1f7c41..e89c7fc 100644 --- a/acre-x.c +++ b/acre-x.c @@ -120,6 +120,8 @@ handle_events(Display *dpy, Window window, Visual *visual, draw (dpy, window, visual, acre, width, height, x_min, x_max); +#define PAN 0.05 +#define ZOOM PAN XNextEvent (dpy, &xev); switch (xev.type) { case KeyPress: @@ -130,26 +132,26 @@ handle_events(Display *dpy, Window window, Visual *visual, } else if (keycode == left_code) { - shift = 0.25 * (x_max - x_min); + shift = PAN * (x_max - x_min); x_min += shift; x_max += shift; } else if (keycode == right_code) { - shift = 0.25 * (x_max - x_min); + shift = PAN * (x_max - x_min); x_min -= shift; x_max -= shift; } else if (keycode == plus_code || keycode == equal_code) { - shift = 0.25 * (x_max - x_min); + shift = ZOOM * (x_max - x_min); x_min += shift; x_max -= shift; } else if (keycode == minus_code) { - shift = 0.5 * (x_max - x_min); + shift = (1- 2*ZOOM) * (x_max - x_min); x_min -= shift; x_max += shift; }