mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 09:05:50 +01:00
Evalute ZATHURA_LINK_DESTINATION_XYZ
This commit is contained in:
parent
7d2265c294
commit
dfbd39c59d
1 changed files with 24 additions and 3 deletions
27
links.c
27
links.c
|
@ -8,6 +8,7 @@
|
||||||
#include "links.h"
|
#include "links.h"
|
||||||
#include "zathura.h"
|
#include "zathura.h"
|
||||||
#include "document.h"
|
#include "document.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
struct zathura_link_s
|
struct zathura_link_s
|
||||||
{
|
{
|
||||||
|
@ -122,12 +123,32 @@ 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) {
|
switch (link->target.destination_type) {
|
||||||
case ZATHURA_LINK_DESTINATION_XYZ:
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue