1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #9124 from Snuffleupagus/scrollThumbnailIntoView-multi-cols

Fix incorrect behaviour in `PDFThumbnailViewer.scrollThumbnailIntoView` for multiple columns of thumbnails
This commit is contained in:
Tim van der Meij 2017-11-12 11:41:44 +01:00 committed by GitHub
commit 36b83c14f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,20 @@ class PDFThumbnailViewer {
let first = visibleThumbs.first.id;
// Account for only one thumbnail being visible.
let last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
let shouldScroll = false;
if (page <= first || page >= last) {
shouldScroll = true;
} else {
visibleThumbs.views.some(function(view) {
if (view.id !== page) {
return false;
}
shouldScroll = view.percent < 100;
return true;
});
}
if (shouldScroll) {
scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN, });
}
}