summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-05-16 15:54:09 +0200
committerBert <ber.t@gmx.com>2011-05-16 15:54:09 +0200
commit485e6c863a2f25737e75359da1f1c74f6f17e004 (patch)
treeee55279d24897d3dd012f5b5cd18116e6296bb1b /image.c
parent1763e9f2537d4ca3cf8a614fad8a606db69da6ea (diff)
downloadnsxiv-485e6c863a2f25737e75359da1f1c74f6f17e004.tar.zst
H/J/K/L mappings to pan to edges
Diffstat (limited to 'image.c')
-rw-r--r--image.c29
1 files changed, 29 insertions, 0 deletions
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;