mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 11:26:01 +01:00
Update link evaluation
This commit is contained in:
parent
f69bfcb5c1
commit
11bf7ba2c8
1 changed files with 18 additions and 22 deletions
40
links.c
40
links.c
|
@ -121,25 +121,25 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
|
||||||
|
|
||||||
switch (link->type) {
|
switch (link->type) {
|
||||||
case ZATHURA_LINK_GOTO_DEST:
|
case ZATHURA_LINK_GOTO_DEST:
|
||||||
switch (link->target.destination_type) {
|
if (link->target.destination_type != ZATHURA_LINK_DESTINATION_UNKNOWN) {
|
||||||
case ZATHURA_LINK_DESTINATION_XYZ: {
|
if (link->target.scale != 0) {
|
||||||
if (link->target.scale != 0) {
|
zathura_document_set_scale(zathura->document, link->target.scale);
|
||||||
zathura_document_set_scale(zathura->document, link->target.scale);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* get page */
|
/* get page */
|
||||||
zathura_page_t* page = zathura_document_get_page(zathura->document,
|
zathura_page_t* page = zathura_document_get_page(zathura->document,
|
||||||
link->target.page_number);
|
link->target.page_number);
|
||||||
if (page == NULL) {
|
if (page == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zathura_document_set_current_page_number(zathura->document, link->target.page_number);
|
zathura_document_set_current_page_number(zathura->document, link->target.page_number);
|
||||||
|
|
||||||
/* get page offset */
|
/* get page offset */
|
||||||
page_offset_t offset;
|
page_offset_t offset;
|
||||||
page_calculate_offset(zathura, page, &offset);
|
page_calculate_offset(zathura, page, &offset);
|
||||||
|
|
||||||
|
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ) {
|
||||||
if (link->target.left != -1) {
|
if (link->target.left != -1) {
|
||||||
offset.x += link->target.left * zathura_document_get_scale(zathura->document);
|
offset.x += link->target.left * zathura_document_get_scale(zathura->document);
|
||||||
}
|
}
|
||||||
|
@ -147,14 +147,10 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
|
||||||
if (link->target.top != -1) {
|
if (link->target.top != -1) {
|
||||||
offset.y += link->target.top * zathura_document_get_scale(zathura->document);
|
offset.y += link->target.top * zathura_document_get_scale(zathura->document);
|
||||||
}
|
}
|
||||||
|
|
||||||
position_set_delayed(zathura, offset.x, offset.y);
|
|
||||||
statusbar_page_number_update(zathura);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
position_set_delayed(zathura, offset.x, offset.y);
|
||||||
break;
|
statusbar_page_number_update(zathura);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ZATHURA_LINK_GOTO_REMOTE:
|
case ZATHURA_LINK_GOTO_REMOTE:
|
||||||
|
|
Loading…
Reference in a new issue