From 0c2df2cd3cbb866e92a8fdb500ef10818b932c59 Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Thu, 20 Apr 2023 19:50:57 +0200 Subject: [PATCH] fix(player): fix dismissal of UI after only 1 mousemove event --- src/video/components/actions/BackdropAction.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/video/components/actions/BackdropAction.tsx b/src/video/components/actions/BackdropAction.tsx index d7e75605..e0a1f9eb 100644 --- a/src/video/components/actions/BackdropAction.tsx +++ b/src/video/components/actions/BackdropAction.tsx @@ -24,18 +24,16 @@ export function BackdropAction(props: BackdropActionProps) { const handleMouseMove = useCallback(() => { if (!moved) { setTimeout(() => { + // If NOT a touch, set moved to true const isTouch = Date.now() - lastTouchEnd.current < 200; - if (!isTouch) { - setMoved(true); - } + if (!isTouch) setMoved(true); }, 20); - return; } // remove after all if (timeout.current) clearTimeout(timeout.current); timeout.current = setTimeout(() => { - if (moved) setMoved(false); + setMoved(false); timeout.current = null; }, 3000); }, [setMoved, moved]);