From e7a381124546ec7fa7cfb30924fb890e682a44d5 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 12 Sep 2023 16:27:53 +0800 Subject: [PATCH] Fix touch scroll bug --- src/components/Home.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Home.tsx b/src/components/Home.tsx index f87b8bf..420ebf0 100644 --- a/src/components/Home.tsx +++ b/src/components/Home.tsx @@ -61,6 +61,9 @@ const Home: React.FC = () => { } const handleScrollUp = () => { + if (currentContent <= 0) { + return + } handleScrollToContent(currentContent - 1)() clearTimeout(scrollTimeout.current) scrollTimeout.current = setTimeout(() => { @@ -69,6 +72,9 @@ const Home: React.FC = () => { } const handleScrollDown = () => { + if (currentContent >= content.length) { + return + } handleScrollToContent(currentContent + 1)() clearTimeout(scrollTimeout.current) scrollTimeout.current = setTimeout(() => { @@ -82,14 +88,8 @@ const Home: React.FC = () => { } if (event.deltaY > 0) { - if (currentContent >= content.length) { - return - } handleScrollDown() } else { - if (currentContent <= 0) { - return - } handleScrollUp() } } -- 2.49.1