aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2018-01-22 10:47:30 +0100
committerBert Münnich <ber.t@posteo.de>2018-01-22 10:48:56 +0100
commit6d1e00627b7392f2ac32cdcddc7345a57a48cd6f (patch)
treee6cb2cf0a09834e826f173a0fc7605ec9e867289
parent727939b3e6380e623540b4dfae497ead2c3c6e04 (diff)
Do not limit fit-to-win to smallest zoom level
Related to issue #303
-rw-r--r--image.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/image.c b/image.c
index 41d9b32..1230750 100644
--- a/image.c
+++ b/image.c
@@ -393,12 +393,11 @@ void img_check_pan(img_t *img, bool moved)
bool img_fit(img_t *img)
{
- float z, zmax, zw, zh;
+ float z, zw, zh;
if (img->scalemode == SCALE_ZOOM)
return false;
- zmax = img->scalemode == SCALE_DOWN ? 1.0 : zoom_max;
zw = (float) img->win->w / (float) img->w;
zh = (float) img->win->h / (float) img->h;
@@ -413,9 +412,7 @@ bool img_fit(img_t *img)
z = MIN(zw, zh);
break;
}
-
- z = MAX(z, zoom_min);
- z = MIN(z, zmax);
+ z = MIN(z, img->scalemode == SCALE_DOWN ? 1.0 : zoom_max);
if (zoomdiff(img, z) != 0) {
img->zoom = z;
@@ -563,7 +560,7 @@ bool img_zoom_in(img_t *img)
int i;
float z;
- for (i = 1; i < ARRLEN(zoom_levels); i++) {
+ for (i = 0; i < ARRLEN(zoom_levels); i++) {
z = zoom_levels[i] / 100.0;
if (zoomdiff(img, z) > 0)
return img_zoom(img, z);
@@ -576,7 +573,7 @@ bool img_zoom_out(img_t *img)
int i;
float z;
- for (i = ARRLEN(zoom_levels) - 2; i >= 0; i--) {
+ for (i = ARRLEN(zoom_levels) - 1; i >= 0; i--) {
z = zoom_levels[i] / 100.0;
if (zoomdiff(img, z) < 0)
return img_zoom(img, z);