Commit e4b9924c authored by Ignas Anikevicius (gns_ank)'s avatar Ignas Anikevicius (gns_ank) Committed by Sebastian Ramacher

Fix BESTFIT to work well when pages-per-row > 1.

There are two causes of the problem:

    - page_ratio should be defined differently

        This is because the usefull page ratio is max_height/total_width
        or max_width/total_height. This then changes accordingly if
        pages_per_row != 1, otherwise, if the pages are of the same
        size, the page ratios will not change, which screws up the
        resizing.

    - Sometimes we need to do height or width division diferently.

        This is because not always total_height or total_width is
        meaningful in BESTFIT condition.

This commit also should fix the bug #0000226.
Signed-off-by: default avatarIgnas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 9c28be7c
......@@ -122,11 +122,11 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
}
unsigned int rotation = zathura_document_get_rotation(zathura->document);
double page_ratio = total_height / total_width;
double page_ratio = max_height / total_width;
double window_ratio = height / width;
if (rotation == 90 || rotation == 270) {
page_ratio = total_width / total_height;
page_ratio = max_width / total_height;
}
switch (argument->n) {
......@@ -142,13 +142,13 @@ sc_adjust_window(girara_session_t* session, girara_argument_t* argument,
if (page_ratio < window_ratio) {
zathura_document_set_scale(zathura->document, width / total_width);
} else {
zathura_document_set_scale(zathura->document, height / total_height);
zathura_document_set_scale(zathura->document, height / max_height);
}
} else {
if (page_ratio < window_ratio) {
zathura_document_set_scale(zathura->document, width / total_height);
} else {
zathura_document_set_scale(zathura->document, height / total_width);
zathura_document_set_scale(zathura->document, height / max_width);
}
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment