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:
commit
36b83c14f9
1 changed files with 13 additions and 0 deletions
|
@ -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, });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue