From d3df082e3db96d097d83fea14594a99ff03711e4 Mon Sep 17 00:00:00 2001 From: Ilya Daynatovich Date: Fri, 4 Nov 2016 18:13:57 +0200 Subject: [PATCH] Fix thumbnail overflow --- css/_filmstrip.scss | 1 + modules/UI/util/UIUtil.js | 4 +--- modules/UI/videolayout/FilmStrip.js | 33 +++++++++++++++++++++++++---- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/css/_filmstrip.scss b/css/_filmstrip.scss index fbcee68fd..3fbbcd7f5 100644 --- a/css/_filmstrip.scss +++ b/css/_filmstrip.scss @@ -50,6 +50,7 @@ position:relative; height:196px; padding: 0; + padding-left: 17px; bottom: 0; width:auto; border: 2px solid transparent; diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js index 8e7d74fc5..38630f4c9 100644 --- a/modules/UI/util/UIUtil.js +++ b/modules/UI/util/UIUtil.js @@ -27,9 +27,7 @@ const TOOLTIP_POSITIONS = { * Returns the available video width. */ getAvailableVideoWidth: function () { - let rightPanelWidth = 0; - - return window.innerWidth - rightPanelWidth; + return window.innerWidth; }, /** diff --git a/modules/UI/videolayout/FilmStrip.js b/modules/UI/videolayout/FilmStrip.js index a1aadd613..3c6508882 100644 --- a/modules/UI/videolayout/FilmStrip.js +++ b/modules/UI/videolayout/FilmStrip.js @@ -12,6 +12,7 @@ const FilmStrip = { init (eventEmitter) { this.iconMenuDownClassName = 'icon-menu-down'; this.iconMenuUpClassName = 'icon-menu-up'; + this.filmStripContainerClassName = 'filmstrip'; this.filmStrip = $('#remoteVideos'); this.eventEmitter = eventEmitter; this._initFilmStripToolbar(); @@ -23,7 +24,8 @@ const FilmStrip = { */ _initFilmStripToolbar() { let toolbar = this._generateFilmStripToolbar(); - let container = document.querySelector('.filmstrip'); + let className = this.filmStripContainerClassName; + let container = document.querySelector(`.${className}`); UIUtil.prependChild(container, toolbar); @@ -203,6 +205,7 @@ const FilmStrip = { */ let videoAreaAvailableWidth = UIUtil.getAvailableVideoWidth() + - this.getFilmstripPanelsWidth() - UIUtil.parseCssInt(this.filmStrip.css('right'), 10) - UIUtil.parseCssInt(this.filmStrip.css('paddingLeft'), 10) - UIUtil.parseCssInt(this.filmStrip.css('paddingRight'), 10) @@ -265,12 +268,32 @@ const FilmStrip = { }, /** - * Calculate the thumbnail size in order to fit all the thumnails in passed + * + * Calculates width of all panels inside filmstrip + * @returns {number} width + */ + getFilmstripPanelsWidth() { + let filmstripPanelsWidth = 0; + let className = this.filmStripContainerClassName; + $(`.${className}`) + .children() + .each(function () { + if (this.id !== 'remoteVideos') { + filmstripPanelsWidth += $(this).outerWidth(); + } + }); + + return filmstripPanelsWidth; + }, + + /** + Calculate the thumbnail size in order to fit all the thumnails in passed * dimensions. * NOTE: Here we assume that the remote and local thumbnails are with the * same height. * @param {int} availableWidth the maximum width for all thumbnails * @param {int} availableHeight the maximum height for all thumbnails + * @returns {{localVideo, remoteVideo}} */ calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) { /** @@ -317,10 +340,12 @@ const FilmStrip = { (remoteLocalWidthRatio * numberRemoteThumbs + 1), availableHeight * interfaceConfig.LOCAL_THUMBNAIL_RATIO); const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO; - return { localVideo:{ + return { + localVideo:{ thumbWidth: lW, thumbHeight: h - }, remoteVideo: { + }, + remoteVideo: { thumbWidth: lW * remoteLocalWidthRatio, thumbHeight: h }