From 267f8f9c4a1d26d2ad9bd8730a1f3ff897ffbb13 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Thu, 30 Jul 2026 13:12:18 +0300 Subject: [PATCH] fix: hard lock scroll at hero end via scroll position clamp --- components/sections/CloudRevealSection.tsx | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/components/sections/CloudRevealSection.tsx b/components/sections/CloudRevealSection.tsx index b026ef8..553543a 100644 --- a/components/sections/CloudRevealSection.tsx +++ b/components/sections/CloudRevealSection.tsx @@ -110,25 +110,20 @@ export default function CloudRevealSection() { } }) - // %100'de aşağı scroll'u kilitle + // Scroll pozisyonunu hero sonunda kilitle useEffect(() => { - const onWheel = (e: WheelEvent) => { - if (scrollYProgress.get() >= 0.99 && e.deltaY > 0) { - e.preventDefault() + const lockScroll = () => { + const section = sectionRef.current + if (!section) return + // Hero'nun scroll edebileceği maksimum pozisyon + const maxY = section.offsetTop + section.offsetHeight - window.innerHeight + if (window.scrollY > maxY) { + window.scrollTo({ top: maxY, behavior: 'instant' }) } } - const onTouchMove = (e: TouchEvent) => { - if (scrollYProgress.get() >= 0.99) { - e.preventDefault() - } - } - window.addEventListener('wheel', onWheel, { passive: false }) - window.addEventListener('touchmove', onTouchMove, { passive: false }) - return () => { - window.removeEventListener('wheel', onWheel) - window.removeEventListener('touchmove', onTouchMove) - } - }, [scrollYProgress]) + window.addEventListener('scroll', lockScroll, { passive: true }) + return () => window.removeEventListener('scroll', lockScroll) + }, []) useEffect(() => { const canvas = canvasRef.current