diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/viewport.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/viewport.c b/src/viewport.c index dd289d3..e42c729 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -2,6 +2,7 @@ #include <stdbool.h> #include <stdlib.h> +#include <math.h> struct imv_viewport { double scale; @@ -159,8 +160,8 @@ void imv_viewport_zoom(struct imv_viewport *view, const struct imv_image *image, const int wc_x = view->buffer.width/2; const int wc_y = view->buffer.height/2; - double delta_scale = 0.04 * view->buffer.width * amount / image_width; - view->scale += delta_scale; + const double scale_factor = exp(0.04 * view->buffer.width * amount / image_width); + view->scale *= scale_factor; const double min_scale = 0.1; const double max_scale = 100; |