From b02bbba47c520cd304223082f3515925ce69d603 Mon Sep 17 00:00:00 2001 From: Mustafa Date: Thu, 30 Jul 2026 13:10:20 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20lock=20scroll=20at=20hero=20100%=20?= =?UTF-8?q?=E2=80=94=20prevent=20scrolling=20past=20hero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/sections/CloudRevealSection.tsx | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/components/sections/CloudRevealSection.tsx b/components/sections/CloudRevealSection.tsx index 39435bd..b026ef8 100644 --- a/components/sections/CloudRevealSection.tsx +++ b/components/sections/CloudRevealSection.tsx @@ -103,27 +103,32 @@ export default function CloudRevealSection() { useMotionValueEvent(scrollYProgress, 'change', (progress) => { if (!loaded) return - - // Frame güncelle const frameIndex = Math.min(Math.floor(progress * (TOTAL_FRAMES - 1)), TOTAL_FRAMES - 1) if (frameIndex !== currentFrameRef.current) { currentFrameRef.current = frameIndex drawFrame(frameIndex) } + }) - // %100'de bir sonraki bölüme snap et - if (progress >= 0.99 && !hasSnapped.current) { - hasSnapped.current = true - const next = document.getElementById('proje') - if (next) { - next.scrollIntoView({ behavior: 'smooth' }) + // %100'de aşağı scroll'u kilitle + useEffect(() => { + const onWheel = (e: WheelEvent) => { + if (scrollYProgress.get() >= 0.99 && e.deltaY > 0) { + e.preventDefault() } } - // Geri scroll yapılırsa snap'i sıfırla - if (progress < 0.9) { - hasSnapped.current = false + 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]) useEffect(() => { const canvas = canvasRef.current