Video Player: Fix mouse leave (#5916)
This commit is contained in:
parent
b645f9460c
commit
42689c546b
@ -120,7 +120,8 @@ const VideoPlayer: FC<OwnProps> = ({
|
|||||||
const handleVideoLeave = useLastCallback((e) => {
|
const handleVideoLeave = useLastCallback((e) => {
|
||||||
const bounds = videoRef.current?.getBoundingClientRect();
|
const bounds = videoRef.current?.getBoundingClientRect();
|
||||||
if (!bounds) return;
|
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);
|
toggleControls(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -295,7 +296,7 @@ const VideoPlayer: FC<OwnProps> = ({
|
|||||||
<div
|
<div
|
||||||
className="VideoPlayer"
|
className="VideoPlayer"
|
||||||
onMouseMove={shouldToggleControls ? handleVideoMove : undefined}
|
onMouseMove={shouldToggleControls ? handleVideoMove : undefined}
|
||||||
onMouseOut={shouldToggleControls ? handleVideoLeave : undefined}
|
onMouseLeave={shouldToggleControls ? handleVideoLeave : undefined}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={wrapperStyle}
|
style={wrapperStyle}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user