Video Player: Fix mouse leave (#5916)

This commit is contained in:
Alexander Zinchuk 2025-05-14 19:02:12 +03:00
parent b645f9460c
commit 42689c546b

View File

@ -120,7 +120,8 @@ const VideoPlayer: FC<OwnProps> = ({
const handleVideoLeave = useLastCallback((e) => {
const bounds = videoRef.current?.getBoundingClientRect();
if (!bounds) return;
if (e.clientX < bounds.left || e.clientX > bounds.right || e.clientY < bounds.top || e.clientY > bounds.bottom) {
if (e.clientX <= bounds.left || e.clientX >= bounds.right
|| e.clientY <= bounds.top || e.clientY >= bounds.bottom) {
toggleControls(false);
}
});
@ -295,7 +296,7 @@ const VideoPlayer: FC<OwnProps> = ({
<div
className="VideoPlayer"
onMouseMove={shouldToggleControls ? handleVideoMove : undefined}
onMouseOut={shouldToggleControls ? handleVideoLeave : undefined}
onMouseLeave={shouldToggleControls ? handleVideoLeave : undefined}
>
<div
style={wrapperStyle}