Fix links that target a location within a page

Before, clicking on a link would always jump to the beginning of the
linked-to page, even when the link targets a specific point within the
page.
This commit is contained in:
Reto Schnyder 2021-08-05 16:57:41 +02:00 committed by Sebastian Ramacher
parent 0ea99dff36
commit 242329b534

View File

@ -172,14 +172,14 @@ link_goto_dest(zathura_t* zathura, const zathura_link_t* link)
/* shift the position or set to auto */ /* shift the position or set to auto */
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ && if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
link->target.left != -1 && link_hadjust == true) { link->target.left != -1 && link_hadjust == true) {
pos_x += shiftx / doc_width; pos_x += shiftx * cell_width / doc_width;
} else { } else {
pos_x = -1; /* -1 means automatic */ pos_x = -1; /* -1 means automatic */
} }
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ && if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
link->target.top != -1) { link->target.top != -1) {
pos_y += shifty / doc_height; pos_y += shifty * cell_height / doc_height;
} else { } else {
pos_y = -1; /* -1 means automatic */ pos_y = -1; /* -1 means automatic */
} }