diff --git a/css/_mixins.scss b/css/_mixins.scss index c8914a8db3..acf7c96793 100644 --- a/css/_mixins.scss +++ b/css/_mixins.scss @@ -63,7 +63,7 @@ top: 50%; left: 50%; position: absolute; - @include transform(translate(-50%, -50%)) + @include transform(translate(-50%, -50%)); } /** diff --git a/css/_variables.scss b/css/_variables.scss index 054e596b1f..c4ecdc37ef 100644 --- a/css/_variables.scss +++ b/css/_variables.scss @@ -14,8 +14,8 @@ $defaultToolbarSize: 50px; // Video layout. $thumbnailToolbarHeight: 22px; -$thumbnailIndicatorBorder: 0px; -$thumbnailIndicatorSize: $thumbnailToolbarHeight; +$thumbnailIndicatorBorder: 0; +$thumbnailIndicatorSize: 3em; $thumbnailVideoMargin: 2px; $thumbnailsBorder: 2px; $thumbnailVideoBorder: 2px; diff --git a/css/_videolayout_default.scss b/css/_videolayout_default.scss index dbc9afb475..a8679b5dc1 100644 --- a/css/_videolayout_default.scss +++ b/css/_videolayout_default.scss @@ -22,41 +22,97 @@ height: 100%; background-color: black; } -} -/** - * The toolbar of the video thumbnail. - */ -.videocontainer__toolbar, -.videocontainer__toptoolbar { - position: absolute; - left: 0; - z-index: 3; - width: 100%; - box-sizing: border-box; // Includes the padding in the 100% width. -} + /** + * The toolbar of the video thumbnail. + */ + &__toolbar, + &__toptoolbar { + position: absolute; + left: 0; + z-index: 3; + width: 100%; + box-sizing: border-box; // Includes the padding in the 100% width. + } -.videocontainer__toolbar { - bottom: 0; - padding: 0 5px 0 5px; - height: $thumbnailToolbarHeight; -} + &__toolbar { + bottom: 0; + padding: 0 5px 0 5px; + height: $thumbnailToolbarHeight; + } -.videocontainer__toptoolbar { - $toolbarPadding: 5px; - top: 0; - padding: $toolbarPadding; - padding-bottom: 0; - height: $thumbnailIndicatorSize + $toolbarPadding; -} + &__toptoolbar { + $toolbarPadding: 5px; + top: 0; + padding: $toolbarPadding; + padding-bottom: 0; + + span.indicator { + position: relative; + font-size: 8px; + text-align: center; + line-height: $thumbnailIndicatorSize; + display: none; + padding: 0; + margin-right: em(5, 8); + float: left; + @include circle($thumbnailIndicatorSize); + box-sizing: border-box; + z-index: 3; + background: $dominantSpeakerBg; + color: $thumbnailPictogramColor; + border: $thumbnailIndicatorBorder solid $thumbnailPictogramColor; + + &:last-child { + margin-right: 0; + } + + .indicatoricon { + @include absoluteAligning(); + } + + .connection { + position: relative; + display: inline-block; + margin: 0 auto; + left: 0; + @include transform(translate(0, -50%)); + + &_empty + { + color: #8B8B8B;/*#FFFFFF*/ + overflow: hidden; + } + + &_lost + { + color: #8B8B8B; + overflow: visible; + } + + &_full + { + @include topLeft(); + color: #FFFFFF;/*#15A1ED*/ + overflow: hidden; + } + } + + .icon-connection, + .icon-connection-lost { + font-size: 1em; + } + } + } -.videocontainer__hoverOverlay { - position: relative; - width: 100%; - height: 100%; - visibility: hidden; - background: rgba(0,0,0,.6); - z-index: 2; + &__hoverOverlay { + position: relative; + width: 100%; + height: 100%; + visibility: hidden; + background: rgba(0,0,0,.6); + z-index: 2; + } } #localVideoWrapper { @@ -217,72 +273,6 @@ background: $connectionIndicatorBg; } -.videocontainer__toptoolbar span.indicator { - position: relative; - font-size: 8pt; - text-align: center; - line-height: $thumbnailToolbarHeight; - display: none; - padding: 0; - margin-right: 5px; - float: left; - @include circle($thumbnailIndicatorSize); - box-sizing: border-box; - z-index: 3; - background: $dominantSpeakerBg; - color: $thumbnailPictogramColor; - border: $thumbnailIndicatorBorder solid $thumbnailPictogramColor; - - .indicatoricon { - position: absolute; - top: 50%; - left: 0; - @include transform(translateY(-50%)); - width: $thumbnailIndicatorSize - 2 * $thumbnailIndicatorBorder; - height: $thumbnailIndicatorSize - 2 * $thumbnailIndicatorBorder; - line-height: $thumbnailIndicatorSize - 2 * $thumbnailIndicatorBorder; - } - - .connection { - position: relative; - margin: 0 auto; - width: 12px; - height: 8px; - - &_empty - { - @include topLeft(); - max-width: 12px; - width: 12px; - color: #8B8B8B;/*#FFFFFF*/ - overflow: hidden; - } - - &_lost - { - @include topLeft(); - max-width: 12px; - width: 12px; - color: #8B8B8B; - overflow: visible; - } - - &_full - { - @include topLeft(); - max-width: 12px; - width: 12px; - color: #FFFFFF;/*#15A1ED*/ - overflow: hidden; - } - } - - .icon-connection, - .icon-connection-lost { - font-size: 6pt; - } -} - .remotevideomenu { display: inline-block; @@ -400,8 +390,10 @@ .userAvatar { @include maxSize(60px); - @include circle(50%); @include absoluteAligning(); + border-radius: 50%; + height: 50%; + width: auto; } .sharedVideoAvatar { diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js index 64dacaa0c2..c35a17b965 100644 --- a/modules/UI/util/UIUtil.js +++ b/modules/UI/util/UIUtil.js @@ -27,6 +27,25 @@ const SHOW_CLASSES = { 'list-item': 'show-list-item' }; +/** + * Contains sizes of thumbnails + * @type {{SMALL: number, MEDIUM: number}} + */ +const ThumbnailSizes = { + SMALL: 60, + MEDIUM: 80 +}; + +/** + * Contains font sizes for thumbnail indicators + * @type {{SMALL: number, MEDIUM: number}} + */ +const IndicatorFontSizes = { + SMALL: 5, + MEDIUM: 6, + NORMAL: 8 +}; + /** * Created by hristo on 12/22/14. */ @@ -463,6 +482,7 @@ const SHOW_CLASSES = { if (indicators.length <= 0) { indicatorSpan = document.createElement('span'); + indicatorSpan.className = 'indicator'; indicatorSpan.id = indicatorId; @@ -475,6 +495,8 @@ const SHOW_CLASSES = { APP.translation.translateElement($(indicatorSpan)); } + this._resizeIndicator(indicatorSpan); + document.getElementById(videoSpanId) .querySelector('.videocontainer__toptoolbar') .appendChild(indicatorSpan); @@ -483,6 +505,37 @@ const SHOW_CLASSES = { } return indicatorSpan; + }, + + /** + * Resizing indicator element passing via argument + * according to the current thumbnail size + * @param {HTMLElement} indicator - indicator element + * @private + */ + _resizeIndicator(indicator) { + let height = $('#localVideoContainer').height(); + let fontSize = this.getIndicatorFontSize(height); + $(indicator).css('font-size', fontSize); + }, + + /** + * Returns font size for indicators according to current + * height of thumbnail + * @param {Number} - height - current height of thumbnail + * @returns {Number} - font size for current height + */ + getIndicatorFontSize(height) { + const { SMALL, MEDIUM } = ThumbnailSizes; + let fontSize = IndicatorFontSizes.NORMAL; + + if (height <= SMALL) { + fontSize = IndicatorFontSizes.SMALL; + } else if (height > SMALL && height <= MEDIUM) { + fontSize = IndicatorFontSizes.MEDIUM; + } + + return fontSize; } }; diff --git a/modules/UI/videolayout/FilmStrip.js b/modules/UI/videolayout/FilmStrip.js index 2f0a243000..b1515f8857 100644 --- a/modules/UI/videolayout/FilmStrip.js +++ b/modules/UI/videolayout/FilmStrip.js @@ -368,39 +368,63 @@ const FilmStrip = { return new Promise(resolve => { let thumbs = this.getThumbs(!forceUpdate); - if(thumbs.localThumb) - thumbs.localThumb.animate({ - height: local.thumbHeight, - width: local.thumbWidth - }, { - queue: false, - duration: animate ? 500 : 0, - complete: resolve - }); - if(thumbs.remoteThumbs) - thumbs.remoteThumbs.animate({ - height: remote.thumbHeight, - width: remote.thumbWidth - }, { - queue: false, - duration: animate ? 500 : 0, - complete: resolve - }); - - this.filmStrip.animate({ - // adds 2 px because of small video 1px border - height: remote.thumbHeight + 2 - }, { - queue: false, - duration: animate ? 500 : 0 - }); + let promises = []; + + if(thumbs.localThumb) { + promises.push(new Promise((resolve) => { + thumbs.localThumb.animate({ + height: local.thumbHeight, + width: local.thumbWidth + }, this._getAnimateOptions(animate, resolve)); + })); + } + if(thumbs.remoteThumbs) { + promises.push(new Promise((resolve) => { + thumbs.remoteThumbs.animate({ + height: remote.thumbHeight, + width: remote.thumbWidth + }, this._getAnimateOptions(animate, resolve)); + })); + } + promises.push(new Promise((resolve) => { + this.filmStrip.animate({ + // adds 2 px because of small video 1px border + height: remote.thumbHeight + 2 + }, this._getAnimateOptions(animate, resolve)); + })); + + promises.push(new Promise(() => { + let { localThumb } = this.getThumbs(); + let height = localThumb.height(); + let fontSize = UIUtil.getIndicatorFontSize(height); + this.filmStrip.find('.indicator').animate({ + fontSize + }, this._getAnimateOptions(animate, resolve)); + })); if (!animate) { resolve(); } + + Promise.all(promises).then(resolve); }); }, + /** + * Helper method. Returns options for jQuery animation + * @param animate {Boolean} - animation flag + * @param cb {Function} - complete callback + * @returns {Object} - animation options object + * @private + */ + _getAnimateOptions(animate, cb = $.noop) { + return { + queue: false, + duration: animate ? 500 : 0, + complete: cb + }; + }, + /** * Returns thumbnails of the filmstrip * @param only_visible