diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-09-28 17:30:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-09-28 17:30:10 +0200 |
commit | 2963a156abf75542a3171dad45ddc9bcce2eb37f (patch) | |
tree | 14f8e3f5c7ddb610b83a409b700cdd3da721ce03 /src/keyevents.c | |
parent | 4807123ba77c4018a1fcfa31cee04001c07ba4c5 (diff) |
Set max/min zoom for both key and mouse zooming
Diffstat (limited to 'src/keyevents.c')
-rw-r--r-- | src/keyevents.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/keyevents.c b/src/keyevents.c index 60663db..942a88b 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -561,6 +561,10 @@ void feh_event_handle_keypress(XEvent * ev) else if (feh_is_kp(&keys.zoom_in, keysym, state)) { winwid->old_zoom = winwid->zoom; winwid->zoom = winwid->zoom * 1.25; + + if (winwid->zoom > ZOOM_MAX) + winwid->zoom = ZOOM_MAX; + winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / winwid->old_zoom * winwid->zoom); winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / @@ -571,6 +575,10 @@ void feh_event_handle_keypress(XEvent * ev) else if (feh_is_kp(&keys.zoom_out, keysym, state)) { winwid->old_zoom = winwid->zoom; winwid->zoom = winwid->zoom * 0.80; + + if (winwid->zoom < ZOOM_MIN) + winwid->zoom = ZOOM_MIN; + winwid->im_x = (winwid->w / 2) - (((winwid->w / 2) - winwid->im_x) / winwid->old_zoom * winwid->zoom); winwid->im_y = (winwid->h / 2) - (((winwid->h / 2) - winwid->im_y) / |