Fix width / height computation

Closes #9
This commit is contained in:
caribaud 2023-05-27 15:56:31 +02:00
parent c1df87582d
commit 350dd4bb0e
1 changed files with 6 additions and 6 deletions

View File

@ -180,11 +180,11 @@ function getPagesCount() {
}
function pageOriginalHeight(pageNumber) {
return READER_PAGES.children[pageNumber - 1].height
return READER_PAGES.children[pageNumber - 1].naturalHeight
}
function pageOriginalWidth(pageNumber) {
return READER_PAGES.children[pageNumber - 1].width
return READER_PAGES.children[pageNumber - 1].naturalWidth
}
function readerFrameRatio() {
@ -192,15 +192,15 @@ function readerFrameRatio() {
}
function pageRatio(pageNumber) {
return READER_PAGES.children[pageNumber - 1].width / READER_PAGES.children[pageNumber - 1].height
return READER_PAGES.children[pageNumber - 1].naturalWidth / READER_PAGES.children[pageNumber - 1].naturalHeight
}
function pageMaxHeight(){
let max_height = 0
for (var i = 0; i < READER_PAGES.children.length; i++) {
if(READER_PAGES.children[i].height > max_height){
max_height = READER_PAGES.children[i].height
if(READER_PAGES.children[i].naturalHeight > max_height){
max_height = READER_PAGES.children[i].naturalHeight
}
}
@ -217,7 +217,7 @@ function previousPagesWidth(pageNumber) {
let totalWidth = 0
for (let idx = 0; idx < pageNumber - 1; idx++){
totalWidth = totalWidth + READER_PAGES.children[idx].width
totalWidth = totalWidth + READER_PAGES.children[idx].naturalWidth
}
return totalWidth