mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
subtitles offset bind with core
This commit is contained in:
parent
4c805638b7
commit
365c5e43f4
2 changed files with 6 additions and 1 deletions
|
|
@ -50,6 +50,7 @@ const Player = ({ urlParams }) => {
|
|||
dispatch({ propName: 'subtitlesTextColor', propValue: subtitlesSettings.text_color });
|
||||
dispatch({ propName: 'subtitlesBackgroundColor', propValue: subtitlesSettings.background_color });
|
||||
dispatch({ propName: 'subtitlesOutlineColor', propValue: subtitlesSettings.outline_color });
|
||||
dispatch({ propName: 'subtitlesOffset', propValue: subtitlesSettings.offset });
|
||||
}, [subtitlesSettings.size, subtitlesSettings.text_color, subtitlesSettings.background_color, subtitlesSettings.outline_color]);
|
||||
const onPropChanged = React.useCallback((propName, propValue) => {
|
||||
setState({ [propName]: propValue });
|
||||
|
|
@ -88,7 +89,7 @@ const Player = ({ urlParams }) => {
|
|||
updateSubtitlesSettings({ subtitles_size: size });
|
||||
}, []);
|
||||
const onSubtitlesOffsetChanged = React.useCallback((offset) => {
|
||||
dispatch({ propName: 'subtitlesOffset', propValue: offset });
|
||||
updateSubtitlesSettings({ subtitles_offset: offset });
|
||||
}, []);
|
||||
const onContainerMouseDown = React.useCallback((event) => {
|
||||
if (!event.nativeEvent.subtitlesPickerClosePrevented) {
|
||||
|
|
@ -131,6 +132,9 @@ const Player = ({ urlParams }) => {
|
|||
React.useEffect(() => {
|
||||
dispatch({ propName: 'subtitlesOutlineColor', propValue: subtitlesSettings.outline_color });
|
||||
}, [subtitlesSettings.outline_color]);
|
||||
React.useEffect(() => {
|
||||
dispatch({ propName: 'subtitlesOffset', propValue: subtitlesSettings.offset });
|
||||
}, [subtitlesSettings.offset]);
|
||||
return (
|
||||
<div className={styles['player-container']} onMouseDown={onContainerMouseDown}>
|
||||
<Video
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const mapSubtitlesSettings = (ctx) => ({
|
|||
text_color: ctx.profile.settings.subtitles_text_color,
|
||||
background_color: ctx.profile.settings.subtitles_background_color,
|
||||
outline_color: ctx.profile.settings.subtitles_outline_color,
|
||||
offset: ctx.profile.settings.subtitles_offset
|
||||
});
|
||||
|
||||
const useSubtitlesSettings = () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue