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.
This commit is contained in:
Calixte Denizet 2026-03-04 17:30:01 +01:00
parent c41be4fd88
commit 7f76a111c4
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F

View File

@ -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