From 485e6c863a2f25737e75359da1f1c74f6f17e004 Mon Sep 17 00:00:00 2001 From: Bert Date: Mon, 16 May 2011 15:54:09 +0200 Subject: H/J/K/L mappings to pan to edges --- image.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'image.c') diff --git a/image.c b/image.c index 7368854..25e85b3 100644 --- a/image.c +++ b/image.c @@ -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; -- cgit v1.2.3