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
@ -84,7 +84,20 @@ class PDFThumbnailViewer {
|
|||||||
let first = visibleThumbs.first.id;
|
let first = visibleThumbs.first.id;
|
||||||
// Account for only one thumbnail being visible.
|
// Account for only one thumbnail being visible.
|
||||||
let last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
|
let last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
|
||||||
|
|
||||||
|
let shouldScroll = false;
|
||||||
if (page <= first || page >= last) {
|
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, });
|
scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN, });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user