diff --git a/packages/kits/default/src/video.tsx b/packages/kits/default/src/video.tsx index 475f6c7..286e434 100644 --- a/packages/kits/default/src/video.tsx +++ b/packages/kits/default/src/video.tsx @@ -38,23 +38,16 @@ export const Video: (props: VideoProperties & RefAttributes) => const moving = useMemo(() => signal(false), []) const handlers = useMemo(() => { let timeoutRef: NodeJS.Timeout | undefined - const cancelTimeout = () => { - if (timeoutRef == null) { - return + const onInteract = () => { + moving.value = true + if (timeoutRef != null) { + clearTimeout(timeoutRef) } - clearTimeout(timeoutRef) - timeoutRef = undefined + timeoutRef = setTimeout(() => (moving.value = false), 2000) } return { - onPointerMove: () => { - moving.value = true - cancelTimeout() - timeoutRef = setTimeout(() => (moving.value = false), 2000) - }, - onPointerOut: () => { - moving.value = false - cancelTimeout - }, + onPointerMove: onInteract, + onPointerDown: onInteract, } }, [moving]) return (