@ -39,13 +39,18 @@ export function getMaxColumnCount() {
* equal count of tiles for height and width , until maxColumn is reached in
* which rows will be added but no more columns .
*
* @ param { number } numberOfParticipants - The number of participants including the fake participants .
* @ param { Object } state - The redux store state .
* @ param { number } maxColumns - The maximum number of columns that can be
* displayed .
* @ returns { Object } An object is return with the desired number of columns ,
* rows , and visible rows ( the rest should overflow ) for the tile view layout .
* /
export function getTileViewGridDimensions ( numberOfParticipants : number , maxColumns : number = getMaxColumnCount ( ) ) {
export function getTileViewGridDimensions ( state : Object , maxColumns : number = getMaxColumnCount ( ) ) {
// When in tile view mode, we must discount ourselves (the local participant) because our
// tile is not visible.
const { iAmRecorder } = state [ 'features/base/config' ] ;
const numberOfParticipants = state [ 'features/base/participants' ] . length - ( iAmRecorder ? 1 : 0 ) ;
const columnsToMaintainASquare = Math . ceil ( Math . sqrt ( numberOfParticipants ) ) ;
const columns = Math . min ( columnsToMaintainASquare , maxColumns ) ;
const rows = Math . ceil ( numberOfParticipants / columns ) ;