1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

fix(player): fix dismissal of UI after only 1 mousemove event

This commit is contained in:
Jip Fr 2023-04-20 19:50:57 +02:00
parent fa985fc2c2
commit 0c2df2cd3c

View file

@ -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]);