From 350dd4bb0e30906387172c8fbc96940f251e1f0d Mon Sep 17 00:00:00 2001 From: caribaud Date: Sat, 27 May 2023 15:56:31 +0200 Subject: [PATCH] Fix width / height computation Closes #9 --- melpomene.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/melpomene.js b/melpomene.js index 1ca0744..a3a8e3c 100644 --- a/melpomene.js +++ b/melpomene.js @@ -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