Merge pull request #1132 from jitsi/calculate-correct-size-for-thumbnails
Calculate correct size for thumbnails
This commit is contained in:
commit
45126d4f3d
|
@ -50,6 +50,7 @@
|
||||||
position:relative;
|
position:relative;
|
||||||
height:196px;
|
height:196px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
padding-left: 17px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width:auto;
|
width:auto;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
|
|
|
@ -27,9 +27,7 @@ const TOOLTIP_POSITIONS = {
|
||||||
* Returns the available video width.
|
* Returns the available video width.
|
||||||
*/
|
*/
|
||||||
getAvailableVideoWidth: function () {
|
getAvailableVideoWidth: function () {
|
||||||
let rightPanelWidth = 0;
|
return window.innerWidth;
|
||||||
|
|
||||||
return window.innerWidth - rightPanelWidth;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,6 +12,7 @@ const FilmStrip = {
|
||||||
init (eventEmitter) {
|
init (eventEmitter) {
|
||||||
this.iconMenuDownClassName = 'icon-menu-down';
|
this.iconMenuDownClassName = 'icon-menu-down';
|
||||||
this.iconMenuUpClassName = 'icon-menu-up';
|
this.iconMenuUpClassName = 'icon-menu-up';
|
||||||
|
this.filmStripContainerClassName = 'filmstrip';
|
||||||
this.filmStrip = $('#remoteVideos');
|
this.filmStrip = $('#remoteVideos');
|
||||||
this.eventEmitter = eventEmitter;
|
this.eventEmitter = eventEmitter;
|
||||||
this._initFilmStripToolbar();
|
this._initFilmStripToolbar();
|
||||||
|
@ -23,7 +24,8 @@ const FilmStrip = {
|
||||||
*/
|
*/
|
||||||
_initFilmStripToolbar() {
|
_initFilmStripToolbar() {
|
||||||
let toolbar = this._generateFilmStripToolbar();
|
let toolbar = this._generateFilmStripToolbar();
|
||||||
let container = document.querySelector('.filmstrip');
|
let className = this.filmStripContainerClassName;
|
||||||
|
let container = document.querySelector(`.${className}`);
|
||||||
|
|
||||||
UIUtil.prependChild(container, toolbar);
|
UIUtil.prependChild(container, toolbar);
|
||||||
|
|
||||||
|
@ -203,6 +205,7 @@ const FilmStrip = {
|
||||||
*/
|
*/
|
||||||
let videoAreaAvailableWidth
|
let videoAreaAvailableWidth
|
||||||
= UIUtil.getAvailableVideoWidth()
|
= UIUtil.getAvailableVideoWidth()
|
||||||
|
- this._getFilmstripExtraPanelsWidth()
|
||||||
- UIUtil.parseCssInt(this.filmStrip.css('right'), 10)
|
- UIUtil.parseCssInt(this.filmStrip.css('right'), 10)
|
||||||
- UIUtil.parseCssInt(this.filmStrip.css('paddingLeft'), 10)
|
- UIUtil.parseCssInt(this.filmStrip.css('paddingLeft'), 10)
|
||||||
- UIUtil.parseCssInt(this.filmStrip.css('paddingRight'), 10)
|
- UIUtil.parseCssInt(this.filmStrip.css('paddingRight'), 10)
|
||||||
|
@ -265,12 +268,35 @@ const FilmStrip = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the thumbnail size in order to fit all the thumnails in passed
|
* Traverse all elements inside the filmstrip
|
||||||
|
* and calculates the sum of all of them except
|
||||||
|
* remote videos element. Used for calculation of
|
||||||
|
* available width for video thumbnails.
|
||||||
|
*
|
||||||
|
* @returns {number} calculated width
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_getFilmstripExtraPanelsWidth() {
|
||||||
|
let className = this.filmStripContainerClassName;
|
||||||
|
let width = 0;
|
||||||
|
$(`.${className}`)
|
||||||
|
.children()
|
||||||
|
.each(function () {
|
||||||
|
if (this.id !== 'remoteVideos') {
|
||||||
|
width += $(this).outerWidth();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return width;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
Calculate the thumbnail size in order to fit all the thumnails in passed
|
||||||
* dimensions.
|
* dimensions.
|
||||||
* NOTE: Here we assume that the remote and local thumbnails are with the
|
* NOTE: Here we assume that the remote and local thumbnails are with the
|
||||||
* same height.
|
* same height.
|
||||||
* @param {int} availableWidth the maximum width for all thumbnails
|
* @param {int} availableWidth the maximum width for all thumbnails
|
||||||
* @param {int} availableHeight the maximum height for all thumbnails
|
* @param {int} availableHeight the maximum height for all thumbnails
|
||||||
|
* @returns {{localVideo, remoteVideo}}
|
||||||
*/
|
*/
|
||||||
calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) {
|
calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) {
|
||||||
/**
|
/**
|
||||||
|
@ -317,10 +343,12 @@ const FilmStrip = {
|
||||||
(remoteLocalWidthRatio * numberRemoteThumbs + 1), availableHeight *
|
(remoteLocalWidthRatio * numberRemoteThumbs + 1), availableHeight *
|
||||||
interfaceConfig.LOCAL_THUMBNAIL_RATIO);
|
interfaceConfig.LOCAL_THUMBNAIL_RATIO);
|
||||||
const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
|
const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
|
||||||
return { localVideo:{
|
return {
|
||||||
|
localVideo:{
|
||||||
thumbWidth: lW,
|
thumbWidth: lW,
|
||||||
thumbHeight: h
|
thumbHeight: h
|
||||||
}, remoteVideo: {
|
},
|
||||||
|
remoteVideo: {
|
||||||
thumbWidth: lW * remoteLocalWidthRatio,
|
thumbWidth: lW * remoteLocalWidthRatio,
|
||||||
thumbHeight: h
|
thumbHeight: h
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue