viewer: adjust scrollIntoView values

pull/175/head
Varun Patil 2022-11-06 16:01:22 -08:00
parent da863078e9
commit 8896ffb29b
1 changed files with 2 additions and 2 deletions

View File

@ -429,9 +429,9 @@ export default class Viewer extends Mixins(GlobalMixin) {
// Scroll to keep the thumbnail in view // Scroll to keep the thumbnail in view
this.photoswipe.on("slideActivate", (e) => { this.photoswipe.on("slideActivate", (e) => {
const thumb = this.thumbElem(e.slide.data?.photo); const thumb = this.thumbElem(e.slide.data?.photo);
if (thumb) { if (thumb && this.fullyOpened) {
const rect = thumb.getBoundingClientRect(); const rect = thumb.getBoundingClientRect();
if (rect.top < 0 || rect.bottom > window.innerHeight) { if (rect.bottom < 50 || rect.top > window.innerHeight - 50) {
thumb.scrollIntoView({ thumb.scrollIntoView({
block: "center", block: "center",
}); });