fix(filmstrip) Fix resizable filmstrip (#11025)
Re-calculate tile sizes after config loaded Make local tile always respect the ratio in interface_config Merge calculate size for vertical view functions into one function
This commit is contained in:
parent
936d9b41f1
commit
8bb5c114f8
|
@ -26,7 +26,6 @@ import {
|
||||||
calculateThumbnailSizeForHorizontalView,
|
calculateThumbnailSizeForHorizontalView,
|
||||||
calculateThumbnailSizeForTileView,
|
calculateThumbnailSizeForTileView,
|
||||||
calculateThumbnailSizeForVerticalView,
|
calculateThumbnailSizeForVerticalView,
|
||||||
calculateThumbnailSizeForResizableVerticalView,
|
|
||||||
isFilmstripResizable,
|
isFilmstripResizable,
|
||||||
showGridInVerticalView
|
showGridInVerticalView
|
||||||
} from './functions';
|
} from './functions';
|
||||||
|
@ -128,9 +127,7 @@ export function setVerticalViewDimensions() {
|
||||||
width: widthOfFilmstrip
|
width: widthOfFilmstrip
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
thumbnails = resizableFilmstrip
|
thumbnails = calculateThumbnailSizeForVerticalView(clientWidth, filmstripWidth.current, resizableFilmstrip);
|
||||||
? calculateThumbnailSizeForResizableVerticalView(clientWidth, filmstripWidth.current)
|
|
||||||
: calculateThumbnailSizeForVerticalView(clientWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -562,6 +562,7 @@ class Filmstrip extends PureComponent <Props, State> {
|
||||||
_filmstripHeight,
|
_filmstripHeight,
|
||||||
_filmstripWidth,
|
_filmstripWidth,
|
||||||
_remoteParticipantsLength,
|
_remoteParticipantsLength,
|
||||||
|
_resizableFilmstrip,
|
||||||
_rows,
|
_rows,
|
||||||
_thumbnailHeight,
|
_thumbnailHeight,
|
||||||
_thumbnailWidth,
|
_thumbnailWidth,
|
||||||
|
@ -599,7 +600,7 @@ class Filmstrip extends PureComponent <Props, State> {
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
itemCount: _remoteParticipantsLength,
|
itemCount: _remoteParticipantsLength,
|
||||||
className: 'filmstrip__videos remote-videos height-transition',
|
className: `filmstrip__videos remote-videos ${_resizableFilmstrip ? '' : 'height-transition'}`,
|
||||||
height: _filmstripHeight,
|
height: _filmstripHeight,
|
||||||
itemKey: this._listItemKey,
|
itemKey: this._listItemKey,
|
||||||
itemSize: 0,
|
itemSize: 0,
|
||||||
|
|
|
@ -256,6 +256,11 @@ export const INDICATORS_TOOLTIP_POSITION = {
|
||||||
*/
|
*/
|
||||||
export const DEFAULT_FILMSTRIP_WIDTH = 120;
|
export const DEFAULT_FILMSTRIP_WIDTH = 120;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default aspect ratio for the local tile.
|
||||||
|
*/
|
||||||
|
export const DEFAULT_LOCAL_TILE_ASPECT_RATIO = 16 / 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The width of the filmstrip at which it no longer goes above the stage view, but it pushes it.
|
* The width of the filmstrip at which it no longer goes above the stage view, but it pushes it.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { getCurrentLayout, LAYOUTS } from '../video-layout';
|
||||||
import {
|
import {
|
||||||
ASPECT_RATIO_BREAKPOINT,
|
ASPECT_RATIO_BREAKPOINT,
|
||||||
DEFAULT_FILMSTRIP_WIDTH,
|
DEFAULT_FILMSTRIP_WIDTH,
|
||||||
|
DEFAULT_LOCAL_TILE_ASPECT_RATIO,
|
||||||
DISPLAY_AVATAR,
|
DISPLAY_AVATAR,
|
||||||
DISPLAY_VIDEO,
|
DISPLAY_VIDEO,
|
||||||
FILMSTRIP_GRID_BREAKPOINT,
|
FILMSTRIP_GRID_BREAKPOINT,
|
||||||
|
@ -161,45 +162,26 @@ export function calculateThumbnailSizeForHorizontalView(clientHeight: number = 0
|
||||||
* Calculates the size for thumbnails when in vertical view layout.
|
* Calculates the size for thumbnails when in vertical view layout.
|
||||||
*
|
*
|
||||||
* @param {number} clientWidth - The height of the app window.
|
* @param {number} clientWidth - The height of the app window.
|
||||||
* @returns {{local: {height, width}, remote: {height, width}}}
|
|
||||||
*/
|
|
||||||
export function calculateThumbnailSizeForVerticalView(clientWidth: number = 0) {
|
|
||||||
const availableWidth = Math.min(
|
|
||||||
Math.max(clientWidth - VERTICAL_VIEW_HORIZONTAL_MARGIN, 0),
|
|
||||||
interfaceConfig.FILM_STRIP_MAX_HEIGHT || DEFAULT_FILMSTRIP_WIDTH);
|
|
||||||
|
|
||||||
return {
|
|
||||||
local: {
|
|
||||||
height: Math.floor(availableWidth / interfaceConfig.LOCAL_THUMBNAIL_RATIO),
|
|
||||||
width: availableWidth
|
|
||||||
},
|
|
||||||
remote: {
|
|
||||||
height: Math.floor(availableWidth / interfaceConfig.REMOTE_THUMBNAIL_RATIO),
|
|
||||||
width: availableWidth
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculates the size for thumbnails when in vertical view layout
|
|
||||||
* and the filmstrip is resizable.
|
|
||||||
*
|
|
||||||
* @param {number} clientWidth - The height of the app window.
|
|
||||||
* @param {number} filmstripWidth - The width of the filmstrip.
|
* @param {number} filmstripWidth - The width of the filmstrip.
|
||||||
|
* @param {boolean} isResizable - Whether the filmstrip is resizable or not.
|
||||||
* @returns {{local: {height, width}, remote: {height, width}}}
|
* @returns {{local: {height, width}, remote: {height, width}}}
|
||||||
*/
|
*/
|
||||||
export function calculateThumbnailSizeForResizableVerticalView(clientWidth: number = 0, filmstripWidth: number = 0) {
|
export function calculateThumbnailSizeForVerticalView(clientWidth: number = 0,
|
||||||
|
filmstripWidth: number = 0, isResizable = false) {
|
||||||
const availableWidth = Math.min(
|
const availableWidth = Math.min(
|
||||||
Math.max(clientWidth - VERTICAL_VIEW_HORIZONTAL_MARGIN, 0),
|
Math.max(clientWidth - VERTICAL_VIEW_HORIZONTAL_MARGIN, 0),
|
||||||
filmstripWidth || DEFAULT_FILMSTRIP_WIDTH);
|
(isResizable ? filmstripWidth : interfaceConfig.FILM_STRIP_MAX_HEIGHT) || DEFAULT_FILMSTRIP_WIDTH);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
local: {
|
local: {
|
||||||
height: DEFAULT_FILMSTRIP_WIDTH,
|
height: Math.floor(availableWidth
|
||||||
|
/ (interfaceConfig.LOCAL_THUMBNAIL_RATIO || DEFAULT_LOCAL_TILE_ASPECT_RATIO)),
|
||||||
width: availableWidth
|
width: availableWidth
|
||||||
},
|
},
|
||||||
remote: {
|
remote: {
|
||||||
height: DEFAULT_FILMSTRIP_WIDTH,
|
height: isResizable
|
||||||
|
? DEFAULT_FILMSTRIP_WIDTH
|
||||||
|
: Math.floor(availableWidth / interfaceConfig.REMOTE_THUMBNAIL_RATIO),
|
||||||
width: availableWidth
|
width: availableWidth
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -184,3 +184,12 @@ StateListenerRegistry.register(
|
||||||
/* listener */(_, store) => {
|
/* listener */(_, store) => {
|
||||||
store.dispatch(setVerticalViewDimensions());
|
store.dispatch(setVerticalViewDimensions());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listens for changes in the filmstrip config to determine the size of the tiles.
|
||||||
|
*/
|
||||||
|
StateListenerRegistry.register(
|
||||||
|
/* selector */ state => state['features/base/config'].filmstrip?.disableResizable,
|
||||||
|
/* listener */(_, store) => {
|
||||||
|
store.dispatch(setVerticalViewDimensions());
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue