summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2017-10-04 18:12:27 +0200
committerBert Münnich <ber.t@posteo.de>2017-10-04 18:22:43 +0200
commite310136e02ada4862c250280034d36fbfa24fc61 (patch)
tree496db891475c1b9670ab49e5f025012d05f4b37a /image.c
parent9b6acc781e3fc2994bde60db397cfd82e2e050d1 (diff)
downloadnsxiv-e310136e02ada4862c250280034d36fbfa24fc61.tar.zst
Mouse drag translates pointer position to image area
This makes mouse panning more direct and faster.
Diffstat (limited to 'image.c')
-rw-r--r--image.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/image.c b/image.c
index 36a232e..6ace9bd 100644
--- a/image.c
+++ b/image.c
@@ -567,15 +567,15 @@ bool img_zoom_out(img_t *img)
return false;
}
-bool img_move(img_t *img, float dx, float dy)
+bool img_pos(img_t *img, float x, float y)
{
float ox, oy;
ox = img->x;
oy = img->y;
- img->x += dx;
- img->y += dy;
+ img->x = x;
+ img->y = y;
img_check_pan(img, true);
@@ -587,6 +587,11 @@ bool img_move(img_t *img, float dx, float dy)
}
}
+bool img_move(img_t *img, float dx, float dy)
+{
+ return img_pos(img, img->x + dx, img->y + dy);
+}
+
bool img_pan(img_t *img, direction_t dir, int d)
{
/* d < 0: screen-wise