diff options
author | Bert <ber.t@gmx.com> | 2011-05-16 15:54:09 +0200 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-05-16 15:54:09 +0200 |
commit | 485e6c863a2f25737e75359da1f1c74f6f17e004 (patch) | |
tree | ee55279d24897d3dd012f5b5cd18116e6296bb1b /image.c | |
parent | 1763e9f2537d4ca3cf8a614fad8a606db69da6ea (diff) |
H/J/K/L mappings to pan to edges
Diffstat (limited to 'image.c')
-rw-r--r-- | image.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -293,6 +293,35 @@ int img_pan(img_t *img, win_t *win, pandir_t dir) { return 0; } +int img_pan_edge(img_t *img, win_t *win, pandir_t dir) { + int ox, oy; + + if (!img || !img->im || !win) + return 0; + + ox = img->x; + oy = img->y; + + switch (dir) { + case PAN_LEFT: + img->x = 0; + break; + case PAN_RIGHT: + img->x = win->w - img->w * img->zoom; + break; + case PAN_UP: + img->y = 0; + break; + case PAN_DOWN: + img->y = win->h - img->h * img->zoom; + break; + } + + img_check_pan(img, win); + + return ox != img->x || oy != img->y; +} + void img_rotate(img_t *img, win_t *win, int d) { int ox, oy, tmp; |