aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-11 19:44:30 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-11 19:44:30 +0000
commit6adc823b4ecd0bd95d56479188665b92d7e07fbf (patch)
treea5e381a46ebca9b919b74eefe61e7e0517d71ff0 /src
parent2df8dcd7b1362456c13ec62798c0538e42e79ca0 (diff)
downloadimv-6adc823b4ecd0bd95d56479188665b92d7e07fbf.tar.gz
Tweak scaling
Diffstat (limited to 'src')
-rw-r--r--src/viewport.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/viewport.c b/src/viewport.c
index 5a7621b..5a1d44d 100644
--- a/src/viewport.c
+++ b/src/viewport.c
@@ -94,11 +94,13 @@ void imv_viewport_zoom(struct imv_viewport *view, const struct imv_image *img, e
const int wc_x = ww/2;
const int wc_y = wh/2;
- view->scale += amount * 0.1;
- if(view->scale > 100)
- view->scale = 10;
- else if (view->scale < 0.01)
- view->scale = 0.1;
+ view->scale += (view->scale / img->width) * amount * 20;
+ const int min_scale = 0.01;
+ const int max_scale = 100;
+ if(view->scale > max_scale)
+ view->scale = max_scale;
+ else if (view->scale < min_scale)
+ view->scale = min_scale;
if(view->scale < prevScale) {
if(scaledWidth < ww) {