ref(toolbar): remove all jquery filmstrip animations

The animate flag is always being passed in as false, so
essentially the animation isn't needed, unless a setTimeout 0
behavior is for some reason required...
This commit is contained in:
Leonard Kim 2018-04-10 13:01:12 -07:00 committed by Дамян Минков
parent f8537dde6b
commit 8363f3cfeb
2 changed files with 42 additions and 71 deletions

View File

@ -442,81 +442,53 @@ const Filmstrip = {
* @param forceUpdate
* @returns {Promise}
*/
// eslint-disable-next-line max-params
// eslint-disable-next-line max-params, no-unused-vars
resizeThumbnails(local, remote, animate = false, forceUpdate = false) {
return new Promise(resolve => {
const thumbs = this.getThumbs(!forceUpdate);
const promises = [];
const thumbs = this.getThumbs(!forceUpdate);
if (thumbs.localThumb) {
// eslint-disable-next-line no-shadow
thumbs.localThumb.css({
display: 'inline-block',
height: `${local.thumbHeight}px`,
'min-height': `${local.thumbHeight}px`,
'min-width': `${local.thumbWidth}px`,
width: `${local.thumbWidth}px`
});
}
if (thumbs.remoteThumbs) {
thumbs.remoteThumbs.css({
display: 'inline-block',
height: `${remote.thumbHeight}px`,
'min-height': `${remote.thumbHeight}px`,
'min-width': `${remote.thumbWidth}px`,
width: `${remote.thumbWidth}px`
});
}
if (thumbs.localThumb) {
// eslint-disable-next-line no-shadow
promises.push(new Promise(resolve => {
// Let CSS take care of height in vertical filmstrip mode.
if (interfaceConfig.VERTICAL_FILMSTRIP) {
$('#filmstripLocalVideo').animate({
// adds 4 px because of small video 2px border
width: local.thumbWidth + 4
}, this._getAnimateOptions(animate, resolve));
} else {
this.filmstrip.animate({
// adds 4 px because of small video 2px border
height: remote.thumbHeight + 4
}, this._getAnimateOptions(animate, resolve));
}
}));
thumbs.localThumb.css({
display: 'inline-block',
height: `${local.thumbHeight}px`,
'min-height': `${local.thumbHeight}px`,
'min-width': `${local.thumbWidth}px`,
width: `${local.thumbWidth}px`
});
}
promises.push(new Promise(() => {
const { localThumb } = this.getThumbs();
const height = localThumb ? localThumb.height() : 0;
const fontSize = UIUtil.getIndicatorFontSize(height);
if (thumbs.remoteThumbs) {
thumbs.remoteThumbs.css({
display: 'inline-block',
height: `${remote.thumbHeight}px`,
'min-height': `${remote.thumbHeight}px`,
'min-width': `${remote.thumbWidth}px`,
width: `${remote.thumbWidth}px`
});
}
this.filmstrip.find('.indicator').animate({
fontSize
}, this._getAnimateOptions(animate, resolve));
}));
// Let CSS take care of height in vertical filmstrip mode.
if (interfaceConfig.VERTICAL_FILMSTRIP) {
$('#filmstripLocalVideo').css({
// adds 4 px because of small video 2px border
width: `${local.thumbWidth + 4}px`
});
} else {
this.filmstrip.css({
// adds 4 px because of small video 2px border
height: `${remote.thumbHeight + 4}px`
});
}
if (!animate) {
resolve();
}
const { localThumb } = this.getThumbs();
const height = localThumb ? localThumb.height() : 0;
const fontSize = UIUtil.getIndicatorFontSize(height);
Promise.all(promises).then(resolve);
this.filmstrip.find('.indicator').css({
'font-size': `${fontSize}px`
});
},
/**
* 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 onlyVisible

View File

@ -582,12 +582,11 @@ const VideoLayout = {
= Filmstrip.calculateThumbnailSize();
Filmstrip.resizeThumbnails(localVideo, remoteVideo,
animate, forceUpdate)
.then(() => {
if (onComplete && typeof onComplete === 'function') {
onComplete();
}
});
animate, forceUpdate);
if (onComplete && typeof onComplete === 'function') {
onComplete();
}
return { localVideo,
remoteVideo };