fix: 쇼츠 마우스 끌기 기준을 화면 15%에서 30px로 — 조금만 끌어도 넘어가게

This commit is contained in:
minaChoi committed 2026-10-26 15:21:24 +09:00
1 parent c1d62653a9
commit 271e625767
1 file changed
+4 -2
+4 -2
View File
@@ -46,6 +46,8 @@ function command(frame: HTMLIFrameElement | null | undefined, func: Func, args:
}
const PLAYING = 1
// 마우스로 이만큼 끌면 다음·이전 영상으로 넘긴다
const SWIPE_PX = 30
/** 화면에 보이는 동안만 true */
function useVisible<T extends Element>(threshold = 0.5) {
@@ -247,11 +249,11 @@ function ShortsViewer({ items, start, onClose, onAt }: { items: ShortItem[]; sta
setDragging(false)
if (!d || !box) return
if (!d.moved) return togglePause()
// 한 화면의 15% 넘게 끌면 다음·이전 영상으로, 아니면 제자리로
// 30px 만 끌어도 다음·이전 영상으로, 그보다 덜 끌면 제자리로
const h = box.clientHeight
const dy = e.clientY - d.y
const base = Math.round(d.top / h)
const target = Math.min(items.length - 1, Math.max(0, base + (dy < -h * 0.15 ? 1 : dy > h * 0.15 ? -1 : 0)))
const target = Math.min(items.length - 1, Math.max(0, base + (dy < -SWIPE_PX ? 1 : dy > SWIPE_PX ? -1 : 0)))
box.scrollTo({ top: target * h, behavior: 'smooth' })
}