From 62303209f8b7ea975ac4cf4bbdc29cdf5f83dc83 Mon Sep 17 00:00:00 2001 From: caribaud Date: Thu, 25 May 2023 20:33:07 +0200 Subject: [PATCH] Set images size directly in HTML --- demos/pepper_and_carrot_e35_highres.html | 26 +++++++++---------- ...epper_and_carrot_e35_highres_htmldata.html | 26 +++++++++---------- demos/pepper_and_carrot_e35_lowres.html | 26 +++++++++---------- melpomene.js | 8 ++---- 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/demos/pepper_and_carrot_e35_highres.html b/demos/pepper_and_carrot_e35_highres.html index d2b5845..c6949ea 100644 --- a/demos/pepper_and_carrot_e35_highres.html +++ b/demos/pepper_and_carrot_e35_highres.html @@ -16,18 +16,18 @@
@@ -66,4 +66,4 @@ - \ No newline at end of file + diff --git a/demos/pepper_and_carrot_e35_highres_htmldata.html b/demos/pepper_and_carrot_e35_highres_htmldata.html index b83695d..84881c6 100644 --- a/demos/pepper_and_carrot_e35_highres_htmldata.html +++ b/demos/pepper_and_carrot_e35_highres_htmldata.html @@ -16,18 +16,18 @@
@@ -66,4 +66,4 @@ - \ No newline at end of file + diff --git a/demos/pepper_and_carrot_e35_lowres.html b/demos/pepper_and_carrot_e35_lowres.html index fdd239b..011ea93 100644 --- a/demos/pepper_and_carrot_e35_lowres.html +++ b/demos/pepper_and_carrot_e35_lowres.html @@ -19,18 +19,18 @@
@@ -74,4 +74,4 @@ - \ No newline at end of file + diff --git a/melpomene.js b/melpomene.js index 324d9d5..1501b23 100644 --- a/melpomene.js +++ b/melpomene.js @@ -205,7 +205,6 @@ function initReader(){ for (var i = 0; i < READER_PAGES.children.length; i++) { let img = READER_PAGES.children[i]; - img.style.width = 100 / getPagesCount() + "%" visibilityObserver.observe(img) PROGRESS_BAR_PAGES.appendChild(document.createElement("div")) @@ -226,11 +225,8 @@ function initReader(){ function moveReaderDisplayToArea(pageNumber, width, height, posx, posy){ - // First, scale so the page is at scale 1 compared to the frame - READER_PAGES.style.transform = "scale(" + totalPagesWidth() / READER_CONTENT_FRAME.clientWidth + ")" - - // Then, move to the correct page - READER_PAGES.style.transform = "translateX(" + (- pageOriginalWidth() * (pageNumber - 1)) + "px )" + READER_PAGES.style.transform + // Move to the correct page + READER_PAGES.style.transform = "translateX(" + (- pageOriginalWidth() * (pageNumber - 1)) + "px )" // Then move so the top-left point of the zoom match the frame top-left READER_PAGES.style.transform = "translate(" + (- posx) + "px, " + (-posy) + "px )" + READER_PAGES.style.transform