mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-04 16:47:40 +01:00
fix(player): fix dismissal of UI after only 1 mousemove event
This commit is contained in:
parent
fa985fc2c2
commit
0c2df2cd3c
1 changed files with 3 additions and 5 deletions
|
@ -24,18 +24,16 @@ export function BackdropAction(props: BackdropActionProps) {
|
||||||
const handleMouseMove = useCallback(() => {
|
const handleMouseMove = useCallback(() => {
|
||||||
if (!moved) {
|
if (!moved) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
// If NOT a touch, set moved to true
|
||||||
const isTouch = Date.now() - lastTouchEnd.current < 200;
|
const isTouch = Date.now() - lastTouchEnd.current < 200;
|
||||||
if (!isTouch) {
|
if (!isTouch) setMoved(true);
|
||||||
setMoved(true);
|
|
||||||
}
|
|
||||||
}, 20);
|
}, 20);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove after all
|
// remove after all
|
||||||
if (timeout.current) clearTimeout(timeout.current);
|
if (timeout.current) clearTimeout(timeout.current);
|
||||||
timeout.current = setTimeout(() => {
|
timeout.current = setTimeout(() => {
|
||||||
if (moved) setMoved(false);
|
setMoved(false);
|
||||||
timeout.current = null;
|
timeout.current = null;
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}, [setMoved, moved]);
|
}, [setMoved, moved]);
|
||||||
|
|
Loading…
Reference in a new issue