+ if (ctx->zooms != last_zoom) {
+ int dx, dy;
+
+ dx = ctx->mx - ctx->screen->w / 2;
+ dy = ctx->my - ctx->screen->h / 2;
+
+ if (ctx->zooms > last_zoom) {
+ ctx->zoom *= ZOOM_FACTOR;
+ ctx->origo_x += dx / ctx->zoom /
+ (long double) ctx->screen->w;
+ ctx->origo_y += dy / ctx->zoom /
+ (long double) ctx->screen->h;
+ } else {
+ ctx->origo_x -= dx / ctx->zoom /
+ (long double) ctx->screen->w;
+ ctx->origo_y -= dy / ctx->zoom /
+ (long double) ctx->screen->h;
+ ctx->zoom /= ZOOM_FACTOR;
+ }
+
+ last_zoom = ctx->zooms;
+ }
+