mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-08-08 20:17:31 +00:00
refactor: logic
This commit is contained in:
parent
a0796371de
commit
abe42467ad
1 changed files with 7 additions and 4 deletions
|
|
@ -462,13 +462,16 @@ const Player = ({ urlParams, queryParams }) => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const controlBarLayerHeight = Math.round((controlBarRef?.current?.offsetHeight / window?.innerHeight) * 100);
|
let controlBarLayerHeight = Math.round((controlBarRef?.current?.offsetHeight / window?.innerHeight) * 100);
|
||||||
if(controlBarRef.current !== null && video.state.subtitlesOffset < controlBarLayerHeight && controlBarLayerHeight !== null) {
|
|
||||||
|
if(video.state.subtitlesOffset < controlBarLayerHeight / 2) {
|
||||||
|
if (immersed) controlBarLayerHeight = 0;
|
||||||
updateSettings({ subtitlesOffset: video.state.subtitlesOffset + controlBarLayerHeight });
|
updateSettings({ subtitlesOffset: video.state.subtitlesOffset + controlBarLayerHeight });
|
||||||
} else if (controlBarRef.current.offsetHeight === null || controlBarRef.current.offsetHeight === 0) {
|
} else {
|
||||||
|
controlBarLayerHeight = Math.round((controlBarRef?.current?.offsetHeight / window?.innerHeight) * 100);
|
||||||
updateSettings({ subtitlesOffset: video.state.subtitlesOffset - controlBarLayerHeight });
|
updateSettings({ subtitlesOffset: video.state.subtitlesOffset - controlBarLayerHeight });
|
||||||
}
|
}
|
||||||
}, [controlBarRef, video.state.subtitlesOffset]);
|
}, [immersed]);
|
||||||
|
|
||||||
React.useLayoutEffect(() => {
|
React.useLayoutEffect(() => {
|
||||||
const onKeyDown = (event) => {
|
const onKeyDown = (event) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue