Don't hide call controls when hovered

This commit is contained in:
Fedor Indutny 2021-08-24 11:38:03 -07:00 committed by GitHub
parent 9012091d21
commit fab883c2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,6 +122,16 @@ export const CallScreen: React.FC<PropsType> = ({
} }
}, [getPresentingSources, presentingSource, setPresenting]); }, [getPresentingSources, presentingSource, setPresenting]);
const [controlsHover, setControlsHover] = useState(false);
const onControlsMouseEnter = useCallback(() => {
setControlsHover(true);
}, [setControlsHover]);
const onControlsMouseLeave = useCallback(() => {
setControlsHover(false);
}, [setControlsHover]);
const [acceptedDuration, setAcceptedDuration] = useState<number | null>(null); const [acceptedDuration, setAcceptedDuration] = useState<number | null>(null);
const [showControls, setShowControls] = useState(true); const [showControls, setShowControls] = useState(true);
@ -146,14 +156,14 @@ export const CallScreen: React.FC<PropsType> = ({
}, [joinedAt]); }, [joinedAt]);
useEffect(() => { useEffect(() => {
if (!showControls || stickyControls) { if (!showControls || stickyControls || controlsHover) {
return noop; return noop;
} }
const timer = setTimeout(() => { const timer = setTimeout(() => {
setShowControls(false); setShowControls(false);
}, 5000); }, 5000);
return clearInterval.bind(null, timer); return clearInterval.bind(null, timer);
}, [showControls, stickyControls]); }, [showControls, stickyControls, controlsHover]);
useEffect(() => { useEffect(() => {
const handleKeyDown = (event: KeyboardEvent): void => { const handleKeyDown = (event: KeyboardEvent): void => {
@ -370,6 +380,8 @@ export const CallScreen: React.FC<PropsType> = ({
'module-ongoing-call__footer__actions', 'module-ongoing-call__footer__actions',
controlsFadeClass controlsFadeClass
)} )}
onMouseEnter={onControlsMouseEnter}
onMouseLeave={onControlsMouseLeave}
> >
<CallingButton <CallingButton
buttonType={presentingButtonType} buttonType={presentingButtonType}