mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 12:46:00 +01:00
Document nrow computation
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
d07dfe4876
commit
aaa5467305
1 changed files with 9 additions and 1 deletions
10
adjustment.c
10
adjustment.c
|
@ -63,9 +63,17 @@ position_to_page_number(zathura_document_t* document, double pos_x,
|
|||
unsigned int c0 = zathura_document_get_first_page_column(document);
|
||||
unsigned int npag = zathura_document_get_number_of_pages(document);
|
||||
unsigned int ncol = zathura_document_get_pages_per_row(document);
|
||||
unsigned int nrow = (npag + c0 - 1 + ncol - 1) / ncol; /* number of rows */
|
||||
unsigned int nrow = 0;
|
||||
unsigned int pad = zathura_document_get_page_padding(document);
|
||||
|
||||
if (c0 == 1) {
|
||||
/* There is no offset, so this is easy. */
|
||||
nrow = (npag + ncol - 1) / ncol;
|
||||
} else {
|
||||
/* If there is a offset, we handle the first row extra. */
|
||||
nrow = 1 + (npag - (ncol - c0 - 1) + (ncol - 1)) / ncol;
|
||||
}
|
||||
|
||||
unsigned int col = floor(pos_x * (double)doc_width / (double)(cell_width + pad));
|
||||
unsigned int row = floor(pos_y * (double)doc_height / (double)(cell_height + pad));
|
||||
|
||||
|
|
Loading…
Reference in a new issue