use exponential increments for zooming
This commit is contained in:
parent
2c0f10a91b
commit
8e46aa0238
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue