mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-11 00:43:45 +01:00
align highlighted rectangles correctly
Align center of the rectangle with the center of the viewport, vor both keyword searches and synctex forward search. Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
1a8e211a3b
commit
633889f291
@ -193,8 +193,13 @@ highlight_rects(zathura_t* zathura, unsigned int 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;
|
||||
/* compute the center of the rectangle, which will be aligned to the center
|
||||
of the viewport */
|
||||
double center_x = (rectangle.x1 + rectangle.x2) / 2;
|
||||
double center_y = (rectangle.y1 + rectangle.y2) / 2;
|
||||
|
||||
pos_y += (center_y - (double)cell_height/2) / (double)doc_height;
|
||||
pos_x += (center_x - (double)cell_width/2) / (double)doc_width;
|
||||
|
||||
/* move to position */
|
||||
zathura_jumplist_add(zathura);
|
||||
|
@ -940,10 +940,14 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
|
||||
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;
|
||||
/* compute the center of the rectangle, which will be aligned to the center
|
||||
of the viewport */
|
||||
double center_x = (rectangle.x1 + rectangle.x2) / 2;
|
||||
double center_y = (rectangle.y1 + rectangle.y2) / 2;
|
||||
|
||||
pos_y += (center_y - (double)cell_height/2) / (double)doc_height;
|
||||
if (search_hadjust == true) {
|
||||
pos_x += (rectangle.x1 - (double)cell_width/2) / (double)doc_width;
|
||||
pos_x += (center_x - (double)cell_width/2) / (double)doc_width;
|
||||
}
|
||||
|
||||
/* move to position */
|
||||
|
Loading…
Reference in New Issue
Block a user