fix: hard lock scroll at hero end via scroll position clamp
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user