properly scale and rotate rectangle

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Abdo Roig-Maranges 2014-01-17 13:35:11 +01:00 committed by Sebastian Ramacher
parent ad4f5f5f79
commit 1a8e211a3b
2 changed files with 8 additions and 3 deletions

View file

@ -188,9 +188,13 @@ highlight_rects(zathura_t* zathura, unsigned int page,
unsigned int doc_width = 0;
zathura_document_get_document_size(zathura->document, &doc_height, &doc_width);
zathura_rectangle_t* rectangle = girara_list_nth(rectangles[page], 0);
pos_y += (rectangle->y1 - (double)cell_height/2) / (double)doc_height;
pos_x += (rectangle->x1 - (double)cell_width/2) / (double)doc_width;
/* Need to adjust rectangle to page scale and orientation */
zathura_page_t* doc_page = zathura_document_get_page(zathura->document, page);
zathura_rectangle_t* rect = girara_list_nth(rectangles[page], 0);
zathura_rectangle_t rectangle = recalc_rectangle(doc_page, *rect);
pos_y += (rectangle.y1 - (double)cell_height/2) / (double)doc_height;
pos_x += (rectangle.x1 - (double)cell_width/2) / (double)doc_width;
/* move to position */
zathura_jumplist_add(zathura);

View file

@ -917,6 +917,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
g_object_set(page_widget, "search-current", target_idx, NULL);
g_object_get(page_widget, "search-results", &results, NULL);
/* Need to adjust rectangle to page scale and orientation */
zathura_rectangle_t* rect = girara_list_nth(results, target_idx);
zathura_rectangle_t rectangle = recalc_rectangle(target_page, *rect);