Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(subtitles): Move with toolbar.

Hristo Terezovb747fd3483c6
diff --git a/react/features/display-name/components/web/StageParticipantNameLabel.tsx b/react/features/display-name/components/web/StageParticipantNameLabel.tsx
index 7a8e77416e..365c78be7d 100644
--- a/react/features/display-name/components/web/StageParticipantNameLabel.tsx
+++ b/react/features/display-name/components/web/StageParticipantNameLabel.tsx
@@ -12,7 +12,7 @@ import {
import { withPixelLineHeight } from '../../../base/styles/functions.web';
import { getVideospaceFloatingElementsBottomSpacing } from '../../../base/ui/functions.web';
import { getLargeVideoParticipant } from '../../../large-video/functions';
-import { isToolboxVisible } from '../../../toolbox/functions.web';
+import { getTransitionParamsForElementsAboveToolbox, isToolboxVisible } from '../../../toolbox/functions.web';
import { isLayoutTileView } from '../../../video-layout/functions.web';
import DisplayNameBadge from './DisplayNameBadge';
@@ -26,7 +26,7 @@ const useStyles = makeStyles()(theme => {
display: 'inline-flex',
justifyContent: 'center',
marginBottom: getVideospaceFloatingElementsBottomSpacing(theme, false),
- transition: 'margin-bottom 0.3s',
+ transition: `margin-bottom ${getTransitionParamsForElementsAboveToolbox(false)}`,
pointerEvents: 'none',
position: 'absolute',
bottom: 0,
@@ -35,7 +35,8 @@ const useStyles = makeStyles()(theme => {
zIndex: 1
},
containerElevated: {
- marginBottom: getVideospaceFloatingElementsBottomSpacing(theme, true)
+ marginBottom: getVideospaceFloatingElementsBottomSpacing(theme, true),
+ transition: `margin-bottom ${getTransitionParamsForElementsAboveToolbox(true)}`
}
};
});
diff --git a/react/features/subtitles/components/web/Captions.tsx b/react/features/subtitles/components/web/Captions.tsx
index 7a7d4b754a..670680e858 100644
--- a/react/features/subtitles/components/web/Captions.tsx
+++ b/react/features/subtitles/components/web/Captions.tsx
@@ -8,6 +8,7 @@ import { getLocalParticipant } from '../../../base/participants/functions';
import { getVideospaceFloatingElementsBottomSpacing } from '../../../base/ui/functions.web';
import { getStageParticipantNameLabelHeight } from '../../../display-name/components/web/styles';
import { getLargeVideoParticipant } from '../../../large-video/functions';
+import { getTransitionParamsForElementsAboveToolbox, isToolboxVisible } from '../../../toolbox/functions.web';
import { isLayoutTileView } from '../../../video-layout/functions.web';
import { calculateSubtitlesFontSize } from '../../functions.web';
import {
@@ -28,6 +29,11 @@ interface IProps extends IAbstractCaptionsProps {
*/
_isLifted: boolean | undefined;
+ /**
+ * Whether the toolbox is visible or not.
+ */
+ _toolboxVisible: boolean;
+
/**
* An object containing the CSS classes.
*/
@@ -36,12 +42,12 @@ interface IProps extends IAbstractCaptionsProps {
const styles = (theme: Theme, props: IProps) => {
- const { _isLifted = false, _clientHeight } = props;
+ const { _isLifted = false, _clientHeight, _toolboxVisible = false } = props;
const fontSize = calculateSubtitlesFontSize(_clientHeight);
const padding = Math.ceil(0.2 * fontSize);
// Currently the subtitles position are not affected by the toolbar visibility.
- let bottom = getVideospaceFloatingElementsBottomSpacing(theme, true);
+ let bottom = getVideospaceFloatingElementsBottomSpacing(theme, _toolboxVisible);
// This is the case where we display the onstage participant display name
// below the subtitles.
@@ -53,7 +59,7 @@ const styles = (theme: Theme, props: IProps) => {
return {
transcriptionSubtitles: {
- bottom,
+ bottom: `${bottom}px`,
fontSize: `${fontSize}px`,
left: '50%',
maxWidth: '50vw',
@@ -68,6 +74,7 @@ const styles = (theme: Theme, props: IProps) => {
transform: 'translateX(-50%)',
zIndex: 7, // The popups are with z-index 8. This z-index has to be lower.
lineHeight: 1.2,
+ transition: `bottom ${getTransitionParamsForElementsAboveToolbox(_toolboxVisible)}`,
span: {
color: '#fff',
@@ -140,7 +147,8 @@ function mapStateToProps(state: IReduxState) {
return {
..._abstractMapStateToProps(state),
_isLifted: Boolean(largeVideoParticipant && largeVideoParticipant?.id !== localParticipant?.id && !isTileView),
- _clientHeight: clientHeight
+ _clientHeight: clientHeight,
+ _toolboxVisible: isToolboxVisible(state)
};
}
diff --git a/react/features/toolbox/functions.web.ts b/react/features/toolbox/functions.web.ts
index cb6ee90d3a..4c7187284f 100644
--- a/react/features/toolbox/functions.web.ts
+++ b/react/features/toolbox/functions.web.ts
@@ -249,3 +249,17 @@ export function getVisibleButtons({
export function getParticipantMenuButtonsWithNotifyClick(state: IReduxState): Map<string, NOTIFY_CLICK_MODE> {
return state['features/toolbox'].participantMenuButtonsWithNotifyClick;
}
+
+
+/**
+ * Returns the time, timing function and delay for elements that are position above the toolbar and need to move along
+ * with the toolbar.
+ *
+ * @param {boolean} isToolbarVisible - Whether the toolbar is visible or not.
+ * @returns {string}
+ */
+export function getTransitionParamsForElementsAboveToolbox(isToolbarVisible: boolean) {
+ // The transistion time and delay is different to account for the time when the toolbar is about to hide/show but
+ // the elements don't have to move.
+ return isToolbarVisible ? '0.15s ease-in 0.15s' : '0.24s ease-in 0s';
+}