From fcdc015c699d1c409e501db5ce4fb4608aa31980 Mon Sep 17 00:00:00 2001 From: Sheepux Date: Sun, 28 Jun 2020 03:57:36 +0200 Subject: [PATCH] fixes magicScroll when no gap between images (#1957) --- src/web/lib/hakuneko/frontend@classic-dark/pages.html | 5 ++--- src/web/lib/hakuneko/frontend@classic-light/pages.html | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/web/lib/hakuneko/frontend@classic-dark/pages.html b/src/web/lib/hakuneko/frontend@classic-dark/pages.html index 8e403510a63..a82cc84d000 100644 --- a/src/web/lib/hakuneko/frontend@classic-dark/pages.html +++ b/src/web/lib/hakuneko/frontend@classic-dark/pages.html @@ -535,7 +535,7 @@ // Find current image within view let currentScrollImages = [...images].filter(image => { let rect = image.getBoundingClientRect(); - return (rect.top <= window.innerHeight && rect.bottom >=0); + return (rect.top <= window.innerHeight && rect.bottom >1); }); // If multiple images filtered, get the first one. If none scroll to the top image @@ -552,8 +552,7 @@ } else { // Find next image let nextScrollImage = currentScrollImage.nextElementSibling; - if (nextScrollImage) - { + if (nextScrollImage) { // Scroll to it nextScrollImage.scrollIntoView({ behavior: 'smooth' diff --git a/src/web/lib/hakuneko/frontend@classic-light/pages.html b/src/web/lib/hakuneko/frontend@classic-light/pages.html index 4ca51922e5c..67e7f7daa87 100644 --- a/src/web/lib/hakuneko/frontend@classic-light/pages.html +++ b/src/web/lib/hakuneko/frontend@classic-light/pages.html @@ -535,7 +535,7 @@ // Find current image within view let currentScrollImages = [...images].filter(image => { let rect = image.getBoundingClientRect(); - return (rect.top <= window.innerHeight && rect.bottom >=0); + return (rect.top <= window.innerHeight && rect.bottom >1); }); // If multiple images filtered, get the first one. If none scroll to the top image @@ -552,8 +552,7 @@ } else { // Find next image let nextScrollImage = currentScrollImage.nextElementSibling; - if (nextScrollImage) - { + if (nextScrollImage) { // Scroll to it nextScrollImage.scrollIntoView({ behavior: 'smooth'