mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 17:13:48 +01:00
Evalute ZATHURA_LINK_DESTINATION_XYZ
This commit is contained in:
parent
7d2265c294
commit
dfbd39c59d
27
links.c
27
links.c
@ -8,6 +8,7 @@
|
||||
#include "links.h"
|
||||
#include "zathura.h"
|
||||
#include "document.h"
|
||||
#include "utils.h"
|
||||
|
||||
struct zathura_link_s
|
||||
{
|
||||
@ -122,12 +123,32 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
|
||||
switch (link->type) {
|
||||
case ZATHURA_LINK_GOTO_DEST:
|
||||
switch (link->target.destination_type) {
|
||||
case ZATHURA_LINK_DESTINATION_XYZ:
|
||||
if (link->target.scale == 0) {
|
||||
case ZATHURA_LINK_DESTINATION_XYZ: {
|
||||
if (link->target.scale != 0) {
|
||||
zathura_document_set_scale(zathura->document, link->target.scale);
|
||||
}
|
||||
|
||||
page_set_delayed(zathura, link->target.page_number);
|
||||
/* get page */
|
||||
zathura_page_t* page = zathura_document_get_page(zathura->document,
|
||||
link->target.page_number);
|
||||
if (page == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* get page offset */
|
||||
page_offset_t offset;
|
||||
page_calculate_offset(zathura, page, &offset);
|
||||
|
||||
if (link->target.left != -1) {
|
||||
offset.x += link->target.left * zathura_document_get_scale(zathura->document);
|
||||
}
|
||||
|
||||
if (link->target.top != -1) {
|
||||
offset.y += link->target.top * zathura_document_get_scale(zathura->document);
|
||||
}
|
||||
|
||||
position_set_delayed(zathura, offset.x, offset.y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user