Add bunch of JSDocs

This commit is contained in:
Ilya Daynatovich 2016-11-03 15:12:45 +02:00
parent 1328870a2b
commit 69e4f49e74
1 changed files with 41 additions and 0 deletions

View File

@ -117,6 +117,10 @@ const FilmStrip = {
} }
}, },
/**
* Shows if filmstrip is visible
* @returns {boolean}
*/
isFilmStripVisible() { isFilmStripVisible() {
return !this.filmStrip.hasClass('hidden'); return !this.filmStrip.hasClass('hidden');
}, },
@ -128,6 +132,10 @@ const FilmStrip = {
}); });
}, },
/**
* Returns the height of filmstrip
* @returns {number} height
*/
getFilmStripHeight() { getFilmStripHeight() {
if (this.isFilmStripVisible()) { if (this.isFilmStripVisible()) {
return this.filmStrip.outerHeight(); return this.filmStrip.outerHeight();
@ -136,12 +144,20 @@ const FilmStrip = {
} }
}, },
/**
* Returns the width of filmstip
* @returns {number} width
*/
getFilmStripWidth() { getFilmStripWidth() {
return this.filmStrip.innerWidth() return this.filmStrip.innerWidth()
- parseInt(this.filmStrip.css('paddingLeft'), 10) - parseInt(this.filmStrip.css('paddingLeft'), 10)
- parseInt(this.filmStrip.css('paddingRight'), 10); - parseInt(this.filmStrip.css('paddingRight'), 10);
}, },
/**
* Calculates the size for thumbnails: local and remote one
* @returns {*|{localVideo, remoteVideo}}
*/
calculateThumbnailSize() { calculateThumbnailSize() {
let availableSizes = this.calculateAvailableSize(); let availableSizes = this.calculateAvailableSize();
let width = availableSizes.availableWidth; let width = availableSizes.availableWidth;
@ -184,6 +200,11 @@ const FilmStrip = {
return { localRatio, remoteRatio }; return { localRatio, remoteRatio };
}, },
/**
* Calculates available size for one thumbnail according to
* the current window size
* @returns {{availableWidth: number, availableHeight: number}}
*/
calculateAvailableSize() { calculateAvailableSize() {
let availableHeight = interfaceConfig.FILM_STRIP_MAX_HEIGHT; let availableHeight = interfaceConfig.FILM_STRIP_MAX_HEIGHT;
let thumbs = this.getThumbs(true); let thumbs = this.getThumbs(true);
@ -259,6 +280,13 @@ const FilmStrip = {
return { availableWidth, availableHeight }; return { availableWidth, availableHeight };
}, },
/**
* Takes the available size for thumbnail and calculates
* final size of thumbnails
* @param availableWidth
* @param availableHeight
* @returns {{localVideo, remoteVideo}}
*/
calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) { calculateThumbnailSizeFromAvailable(availableWidth, availableHeight) {
let { localRatio, remoteRatio } = this.normalizeThumbnailRatio(); let { localRatio, remoteRatio } = this.normalizeThumbnailRatio();
let { remoteThumbs } = this.getThumbs(true); let { remoteThumbs } = this.getThumbs(true);
@ -289,6 +317,14 @@ const FilmStrip = {
}; };
}, },
/**
* Resizes thumbnails
* @param local
* @param remote
* @param animate
* @param forceUpdate
* @returns {Promise}
*/
resizeThumbnails(local, remote, resizeThumbnails(local, remote,
animate = false, forceUpdate = false) { animate = false, forceUpdate = false) {
@ -327,6 +363,11 @@ const FilmStrip = {
}); });
}, },
/**
* Returns thumbnails of the filmstrip
* @param only_visible
* @returns {object} thumbnails
*/
getThumbs(only_visible = false) { getThumbs(only_visible = false) {
let selector = 'span'; let selector = 'span';
if (only_visible) { if (only_visible) {