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