From 7f76a111c47437ed042dfa8e41e2076ee4b73283 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 4 Mar 2026 17:30:01 +0100 Subject: [PATCH] Fix the position of the thumbnails on the last line (bug 2016437) The original issue can only be reproduce when the thumbnails are on two lines. The fix is just a matter of computing the number of elements on the last line once we've finished the first line. --- web/pdf_thumbnail_viewer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/pdf_thumbnail_viewer.js b/web/pdf_thumbnail_viewer.js index bc8796c78..252d4fa92 100644 --- a/web/pdf_thumbnail_viewer.js +++ b/web/pdf_thumbnail_viewer.js @@ -898,11 +898,6 @@ class PDFThumbnailViewer { firstRightX ??= prevX + w; positionsX.push(prevX); } - if (reminder > 0 && i >= ii - reminder) { - const cx = x + w / 2; - positionsLastX.push(cx); - lastRightX ??= cx + w; - } if (y > prevY) { if (reminder === -1 && positionsX.length > 1) { reminder = ii % positionsX.length; @@ -911,6 +906,11 @@ class PDFThumbnailViewer { firstBottomY ??= prevY + h; positionsY.push(prevY); } + if (reminder > 0 && i >= ii - reminder) { + const cx = x + w / 2; + positionsLastX.push(cx); + lastRightX ??= cx + w; + } } const space = positionsX.length > 1