From 3fe43abdea5407d8fc2c0e3a1a714ecddbccb56c Mon Sep 17 00:00:00 2001 From: yanas Date: Thu, 20 Oct 2016 14:28:10 -0500 Subject: [PATCH] Move the display name to the center --- css/_videolayout_default.scss | 7 ++++--- modules/UI/util/UIUtil.js | 12 +++++++++++ modules/UI/videolayout/LocalVideo.js | 1 - modules/UI/videolayout/RemoteVideo.js | 10 +++------ modules/UI/videolayout/SmallVideo.js | 29 ++++++++++++++++++--------- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/css/_videolayout_default.scss b/css/_videolayout_default.scss index 9333db78c..7c31960ba 100644 --- a/css/_videolayout_default.scss +++ b/css/_videolayout_default.scss @@ -67,7 +67,6 @@ box-sizing: border-box; // Includes the padding in the 100% width. height: $thumbnailToolbarHeight; max-height: 100%; - background-color: rgba(0, 0, 0, 0.5); padding: 0 5px 0 5px; } @@ -176,8 +175,10 @@ .videocontainer .editdisplayname { display: inline-block; position: absolute; - left: 30%; - width: 40%; + left: 10%; + width: 80%; + top: 50%; + margin-top: -12px; color: $participantNameColor; text-align: center; text-overflow: ellipsis; diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js index fe4d1f739..eaf7226b8 100644 --- a/modules/UI/util/UIUtil.js +++ b/modules/UI/util/UIUtil.js @@ -237,6 +237,18 @@ const TOOLTIP_POSITIONS = { $("#"+id).addClass("hide"); }, + /** + * Shows / hides the element with the given jQuery selector. + * + * @param {jQuery} selector the jQuery selector of the element to show/hide + * @param {boolean} isVisible + */ + setVisibility(selector, isVisible) { + if (selector && selector.length > 0) { + selector.css("visibility", isVisible ? "visible" : "hidden"); + } + }, + hideDisabledButtons: function (mappings) { var selector = Object.keys(mappings) .map(function (buttonName) { diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js index 0aadf0e81..4c9a44651 100644 --- a/modules/UI/videolayout/LocalVideo.js +++ b/modules/UI/videolayout/LocalVideo.js @@ -70,7 +70,6 @@ LocalVideo.prototype.setDisplayName = function(displayName) { nameSpan = document.createElement('span'); nameSpan.className = 'displayname'; document.getElementById(this.videoSpanId) - .querySelector('.videocontainer__toolbar') .appendChild(nameSpan); diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 359d191d3..7620e93bc 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -512,9 +512,10 @@ RemoteVideo.prototype.hideConnectionIndicator = function () { /** * Sets the display name for the given video span id. + * + * @param displayName the display name to set */ -RemoteVideo.prototype.setDisplayName = function(displayName, key) { - +RemoteVideo.prototype.setDisplayName = function(displayName) { if (!this.container) { console.warn( "Unable to set displayName - " + this.videoSpanId + " does not exist"); @@ -530,10 +531,6 @@ RemoteVideo.prototype.setDisplayName = function(displayName, key) { if (displaynameSpan.text() !== displayName) displaynameSpan.text(displayName); } - else if (key && key.length > 0) { - var nameHtml = APP.translation.generateTranslationHTML(key); - $('#' + this.videoSpanId + '_name').html(nameHtml); - } else $('#' + this.videoSpanId + '_name').text( interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME); @@ -541,7 +538,6 @@ RemoteVideo.prototype.setDisplayName = function(displayName, key) { nameSpan = document.createElement('span'); nameSpan.className = 'displayname'; $('#' + this.videoSpanId)[0] - .querySelector('.videocontainer__toolbar') .appendChild(nameSpan); if (displayName && displayName.length > 0) { diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index eb19178b2..1d57ebdf2 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -36,12 +36,6 @@ function SmallVideo(VideoLayout) { this.VideoLayout = VideoLayout; } -function setVisibility(selector, show) { - if (selector && selector.length > 0) { - selector.css("visibility", show ? "visible" : "hidden"); - } -} - /** * Returns the identifier of this small video. * @@ -395,6 +389,16 @@ SmallVideo.prototype.$avatar = function () { return $('#' + this.videoSpanId + ' .userAvatar'); }; +/** + * Returns the display name element, which appears on the video thumbnail. + * + * @return {jQuery} a jQuery selector pointing to the display name element of + * the video thumbnail + */ +SmallVideo.prototype.$displayName = function () { + return $('#' + this.videoSpanId + ' .displayname'); +}; + /** * Enables / disables the css responsible for focusing/pinning a video * thumbnail. @@ -479,10 +483,15 @@ SmallVideo.prototype.updateView = function () { // Determine whether video, avatar or blackness should be displayed let displayMode = this.selectDisplayMode(); - // Show/hide video - setVisibility(this.selectVideoElement(), displayMode === DISPLAY_VIDEO); - // Show/hide the avatar - setVisibility(this.$avatar(), displayMode === DISPLAY_AVATAR); + // Show/hide video. + UIUtil.setVisibility( this.selectVideoElement(), + displayMode === DISPLAY_VIDEO); + // Show/hide the avatar. + UIUtil.setVisibility( this.$avatar(), + displayMode === DISPLAY_AVATAR); + // Show/hide the display name. + UIUtil.setVisibility( this.$displayName(), + displayMode === DISPLAY_BLACKNESS); }; SmallVideo.prototype.avatarChanged = function (avatarUrl) {