summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@gmx.com>2011-10-16 18:31:01 +0200
committerBert Münnich <ber.t@gmx.com>2011-10-16 18:31:01 +0200
commit8dcb54705aed7175c91d991486552d497a2e861e (patch)
treeffc66af93d600b6e29b1be18a978cf4f90009e4a /image.c
parent4f5ce2e8282d3f317449dc8854397c042644e134 (diff)
downloadnsxiv-8dcb54705aed7175c91d991486552d497a2e861e.tar.zst
Fixed pixel-wise panning by chaning x, y vars to float
Diffstat (limited to 'image.c')
-rw-r--r--image.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/image.c b/image.c
index ffed8f4..8df02ec 100644
--- a/image.c
+++ b/image.c
@@ -554,8 +554,8 @@ bool img_zoom_out(img_t *img) {
return false;
}
-bool img_move(img_t *img, int dx, int dy) {
- int ox, oy;
+bool img_move(img_t *img, float dx, float dy) {
+ float ox, oy;
if (img == NULL || img->im == NULL)
return false;
@@ -581,13 +581,13 @@ bool img_pan(img_t *img, direction_t dir, int d) {
* d = 0: 1/5 of screen
* d > 0: num of pixels
*/
- int x, y;
+ float x, y;
if (img == NULL || img->im == NULL || img->win == NULL)
return false;
if (d > 0) {
- x = y = MAX(1, d * img->zoom);
+ x = y = MAX(1, (float) d * img->zoom);
} else {
x = img->win->w / (d < 0 ? 1 : 5);
y = img->win->h / (d < 0 ? 1 : 5);
@@ -595,13 +595,13 @@ bool img_pan(img_t *img, direction_t dir, int d) {
switch (dir) {
case DIR_LEFT:
- return img_move(img, x, 0);
+ return img_move(img, x, 0.0);
case DIR_RIGHT:
- return img_move(img, -x, 0);
+ return img_move(img, -x, 0.0);
case DIR_UP:
- return img_move(img, 0, y);
+ return img_move(img, 0.0, y);
case DIR_DOWN:
- return img_move(img, 0, -y);
+ return img_move(img, 0.0, -y);
}
return false;
}