Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2013-10-30 03:35:56 +01:00
parent e99be0fcce
commit f10d847a95
3 changed files with 14 additions and 7 deletions

View File

@ -119,8 +119,9 @@ cmd_bookmark_open(girara_session_t* session, girara_list_t* argument_list)
zathura_jumplist_add(zathura);
page_set(zathura, bookmark->page - 1);
if (bookmark->x != DBL_MIN && bookmark->y != DBL_MIN)
if (bookmark->x != DBL_MIN && bookmark->y != DBL_MIN) {
position_set(zathura, bookmark->x, bookmark->y);
}
zathura_jumplist_add(zathura);
return true;

View File

@ -143,16 +143,19 @@ zathura_link_evaluate(zathura_t* zathura, zathura_link_t* link)
/* compute the position with the page aligned to the top and left
of the viewport */
double pos_x=0, pos_y=0;
double pos_x = 0;
double pos_y = 0;
page_number_to_position(zathura->document, link->target.page_number,
0.0, 0.0, &pos_x, &pos_y);
/* correct to place the target position at the top of the viewport */
/* NOTE: link->target is in page units, needs to be scaled and rotated */
unsigned int cell_height=0, cell_width=0;
unsigned int cell_height = 0;
unsigned int cell_width = 0;
zathura_document_get_cell_size(zathura->document, &cell_height, &cell_width);
unsigned int doc_height=0, doc_width=0;
unsigned int doc_height = 0;
unsigned int doc_width = 0;
zathura_document_get_document_size(zathura->document, &doc_height, &doc_width);
bool link_hadjust = true;

View File

@ -916,16 +916,19 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
girara_setting_get(session, "search-hadjust", &search_hadjust);
/* compute the position of the center of the page */
double pos_x=0, pos_y=0;
double pos_x = 0;
double pos_y = 0;
page_number_to_position(zathura->document, zathura_page_get_index(target_page),
0.5, 0.5, &pos_x, &pos_y);
/* correction to center the current result */
/* NOTE: rectangle is in viewport units, already scaled and rotated */
unsigned int cell_height=0, cell_width=0;
unsigned int cell_height = 0;
unsigned int cell_width = 0;
zathura_document_get_cell_size(zathura->document, &cell_height, &cell_width);
unsigned int doc_height=0, doc_width=0;
unsigned int doc_height = 0;
unsigned int doc_width = 0;
zathura_document_get_document_size(zathura->document, &doc_height, &doc_width);
pos_y += (rectangle.y1 - (double)cell_height/2) / (double)doc_height;