Browse Source

Move the display name to the center

j8
yanas 8 years ago
parent
commit
3fe43abdea

+ 4
- 3
css/_videolayout_default.scss View File

67
     box-sizing: border-box; // Includes the padding in the 100% width.
67
     box-sizing: border-box; // Includes the padding in the 100% width.
68
     height: $thumbnailToolbarHeight;
68
     height: $thumbnailToolbarHeight;
69
     max-height: 100%;
69
     max-height: 100%;
70
-    background-color: rgba(0, 0, 0, 0.5);
71
     padding: 0 5px 0 5px;
70
     padding: 0 5px 0 5px;
72
 }
71
 }
73
 
72
 
176
 .videocontainer .editdisplayname {
175
 .videocontainer .editdisplayname {
177
     display: inline-block;
176
     display: inline-block;
178
     position: absolute;
177
     position: absolute;
179
-    left: 30%;
180
-    width: 40%;
178
+    left: 10%;
179
+    width: 80%;
180
+    top: 50%;
181
+    margin-top: -12px;
181
     color: $participantNameColor;
182
     color: $participantNameColor;
182
     text-align: center;
183
     text-align: center;
183
     text-overflow: ellipsis;
184
     text-overflow: ellipsis;

+ 12
- 0
modules/UI/util/UIUtil.js View File

237
         $("#"+id).addClass("hide");
237
         $("#"+id).addClass("hide");
238
     },
238
     },
239
 
239
 
240
+    /**
241
+     * Shows / hides the element with the given jQuery selector.
242
+     *
243
+     * @param {jQuery} selector the jQuery selector of the element to show/hide
244
+     * @param {boolean} isVisible
245
+     */
246
+    setVisibility(selector, isVisible) {
247
+        if (selector && selector.length > 0) {
248
+            selector.css("visibility", isVisible ? "visible" : "hidden");
249
+        }
250
+    },
251
+
240
     hideDisabledButtons: function (mappings) {
252
     hideDisabledButtons: function (mappings) {
241
         var selector = Object.keys(mappings)
253
         var selector = Object.keys(mappings)
242
           .map(function (buttonName) {
254
           .map(function (buttonName) {

+ 0
- 1
modules/UI/videolayout/LocalVideo.js View File

70
         nameSpan = document.createElement('span');
70
         nameSpan = document.createElement('span');
71
         nameSpan.className = 'displayname';
71
         nameSpan.className = 'displayname';
72
         document.getElementById(this.videoSpanId)
72
         document.getElementById(this.videoSpanId)
73
-            .querySelector('.videocontainer__toolbar')
74
             .appendChild(nameSpan);
73
             .appendChild(nameSpan);
75
 
74
 
76
 
75
 

+ 3
- 7
modules/UI/videolayout/RemoteVideo.js View File

512
 
512
 
513
 /**
513
 /**
514
  * Sets the display name for the given video span id.
514
  * Sets the display name for the given video span id.
515
+ *
516
+ * @param displayName the display name to set
515
  */
517
  */
516
-RemoteVideo.prototype.setDisplayName = function(displayName, key) {
517
-
518
+RemoteVideo.prototype.setDisplayName = function(displayName) {
518
     if (!this.container) {
519
     if (!this.container) {
519
         console.warn( "Unable to set displayName - " + this.videoSpanId +
520
         console.warn( "Unable to set displayName - " + this.videoSpanId +
520
                 " does not exist");
521
                 " does not exist");
530
             if (displaynameSpan.text() !== displayName)
531
             if (displaynameSpan.text() !== displayName)
531
                 displaynameSpan.text(displayName);
532
                 displaynameSpan.text(displayName);
532
         }
533
         }
533
-        else if (key && key.length > 0) {
534
-            var nameHtml = APP.translation.generateTranslationHTML(key);
535
-            $('#' + this.videoSpanId + '_name').html(nameHtml);
536
-        }
537
         else
534
         else
538
             $('#' + this.videoSpanId + '_name').text(
535
             $('#' + this.videoSpanId + '_name').text(
539
                 interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME);
536
                 interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME);
541
         nameSpan = document.createElement('span');
538
         nameSpan = document.createElement('span');
542
         nameSpan.className = 'displayname';
539
         nameSpan.className = 'displayname';
543
         $('#' + this.videoSpanId)[0]
540
         $('#' + this.videoSpanId)[0]
544
-            .querySelector('.videocontainer__toolbar')
545
             .appendChild(nameSpan);
541
             .appendChild(nameSpan);
546
 
542
 
547
         if (displayName && displayName.length > 0) {
543
         if (displayName && displayName.length > 0) {

+ 19
- 10
modules/UI/videolayout/SmallVideo.js View File

36
     this.VideoLayout = VideoLayout;
36
     this.VideoLayout = VideoLayout;
37
 }
37
 }
38
 
38
 
39
-function setVisibility(selector, show) {
40
-    if (selector && selector.length > 0) {
41
-        selector.css("visibility", show ? "visible" : "hidden");
42
-    }
43
-}
44
-
45
 /**
39
 /**
46
  * Returns the identifier of this small video.
40
  * Returns the identifier of this small video.
47
  *
41
  *
395
     return $('#' + this.videoSpanId + ' .userAvatar');
389
     return $('#' + this.videoSpanId + ' .userAvatar');
396
 };
390
 };
397
 
391
 
392
+/**
393
+ * Returns the display name element, which appears on the video thumbnail.
394
+ *
395
+ * @return {jQuery} a jQuery selector pointing to the display name element of
396
+ * the video thumbnail
397
+ */
398
+SmallVideo.prototype.$displayName = function () {
399
+    return $('#' + this.videoSpanId + ' .displayname');
400
+};
401
+
398
 /**
402
 /**
399
  * Enables / disables the css responsible for focusing/pinning a video
403
  * Enables / disables the css responsible for focusing/pinning a video
400
  * thumbnail.
404
  * thumbnail.
479
 
483
 
480
     // Determine whether video, avatar or blackness should be displayed
484
     // Determine whether video, avatar or blackness should be displayed
481
     let displayMode = this.selectDisplayMode();
485
     let displayMode = this.selectDisplayMode();
482
-    // Show/hide video
483
-    setVisibility(this.selectVideoElement(), displayMode === DISPLAY_VIDEO);
484
-    // Show/hide the avatar
485
-    setVisibility(this.$avatar(), displayMode === DISPLAY_AVATAR);
486
+    // Show/hide video.
487
+    UIUtil.setVisibility(   this.selectVideoElement(),
488
+                            displayMode === DISPLAY_VIDEO);
489
+    // Show/hide the avatar.
490
+    UIUtil.setVisibility(   this.$avatar(),
491
+                            displayMode === DISPLAY_AVATAR);
492
+    // Show/hide the display name.
493
+    UIUtil.setVisibility(   this.$displayName(),
494
+                            displayMode === DISPLAY_BLACKNESS);
486
 };
495
 };
487
 
496
 
488
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
497
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {

Loading…
Cancel
Save