Make pan fraction configurable

This commit is contained in:
jcalve 2017-07-23 02:15:47 +02:00 committed by Bert Münnich
parent 30e9ec8970
commit ec545a6b6c
2 changed files with 6 additions and 3 deletions

View file

@ -40,6 +40,9 @@ enum { SLIDESHOW_DELAY = 5 };
static const double GAMMA_MAX = 10.0; static const double GAMMA_MAX = 10.0;
static const int GAMMA_RANGE = 32; static const int GAMMA_RANGE = 32;
/* command i_scroll pans image 1/PAN_FRACTION of screen width/height */
static const int PAN_FRACTION = 5;
/* if false, pixelate images at zoom level != 100%, /* if false, pixelate images at zoom level != 100%,
* toggled with 'a' key binding * toggled with 'a' key binding
*/ */

View file

@ -590,7 +590,7 @@ bool img_move(img_t *img, float dx, float dy)
bool img_pan(img_t *img, direction_t dir, int d) bool img_pan(img_t *img, direction_t dir, int d)
{ {
/* d < 0: screen-wise /* d < 0: screen-wise
* d = 0: 1/5 of screen * d = 0: 1/PAN_FRACTION of screen
* d > 0: num of pixels * d > 0: num of pixels
*/ */
float x, y; float x, y;
@ -598,8 +598,8 @@ bool img_pan(img_t *img, direction_t dir, int d)
if (d > 0) { if (d > 0) {
x = y = MAX(1, (float) d * img->zoom); x = y = MAX(1, (float) d * img->zoom);
} else { } else {
x = img->win->w / (d < 0 ? 1 : 5); x = img->win->w / (d < 0 ? 1 : PAN_FRACTION);
y = img->win->h / (d < 0 ? 1 : 5); y = img->win->h / (d < 0 ? 1 : PAN_FRACTION);
} }
switch (dir) { switch (dir) {