소스 검색

Adds a property to hide display name and disable update view.

Adds a property to hide display name and disable update view in SmallVideo. Localvideo hides displayName and disabled update view while users is editing its name and resumes normal behaviour when editing finishes.
master
damencho 8 년 전
부모
커밋
510c650b7b
2개의 변경된 파일21개의 추가작업 그리고 4개의 파일을 삭제
  1. 13
    3
      modules/UI/videolayout/LocalVideo.js
  2. 8
    1
      modules/UI/videolayout/SmallVideo.js

+ 13
- 3
modules/UI/videolayout/LocalVideo.js 파일 보기

@@ -110,11 +110,17 @@ LocalVideo.prototype.setDisplayName = function(displayName) {
110 110
         $('#localVideoContainer .displayname')
111 111
             .bind("click", function (e) {
112 112
                 let $editDisplayName = $('#editDisplayName');
113
-                let $localDisplayName = $('#localDisplayName');
114 113
 
115 114
                 e.preventDefault();
116 115
                 e.stopPropagation();
117
-                UIUtil.setVisibility($localDisplayName, false);
116
+                // we set display to be hidden
117
+                self.hideDisplayName = true;
118
+                // update the small video vide to hide the display name
119
+                self.updateView();
120
+                // disables further updates in the thumbnail to stay in the
121
+                // edit mode
122
+                self.disableUpdateView = true;
123
+
118 124
                 $editDisplayName.show();
119 125
                 $editDisplayName.focus();
120 126
                 $editDisplayName.select();
@@ -122,7 +128,11 @@ LocalVideo.prototype.setDisplayName = function(displayName) {
122 128
                 $editDisplayName.one("focusout", function () {
123 129
                     self.emitter.emit(UIEvents.NICKNAME_CHANGED, this.value);
124 130
                     $editDisplayName.hide();
125
-                    UIUtil.setVisibility($localDisplayName, true);
131
+                    // stop editing, display displayName and resume updating
132
+                    // the thumbnail
133
+                    self.hideDisplayName = false;
134
+                    self.disableUpdateView = false;
135
+                    self.updateView();
126 136
                 });
127 137
 
128 138
                 $editDisplayName.on('keydown', function (e) {

+ 8
- 1
modules/UI/videolayout/SmallVideo.js 파일 보기

@@ -51,6 +51,9 @@ function SmallVideo(VideoLayout) {
51 51
     this.audioStream = null;
52 52
     this.VideoLayout = VideoLayout;
53 53
     this.videoIsHovered = false;
54
+    this.hideDisplayName = false;
55
+    // we can stop updating the thumbnail
56
+    this.disableUpdateView = false;
54 57
 }
55 58
 
56 59
 /**
@@ -484,6 +487,9 @@ SmallVideo.prototype._isHovered = function () {
484 487
  * video because there is no dominant speaker and no focused speaker
485 488
  */
486 489
 SmallVideo.prototype.updateView = function () {
490
+    if (this.disableUpdateView)
491
+        return;
492
+
487 493
     if (!this.hasAvatar) {
488 494
         if (this.id) {
489 495
             // Init avatar
@@ -506,7 +512,8 @@ SmallVideo.prototype.updateView = function () {
506 512
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
507 513
     // Show/hide the display name.
508 514
     UIUtil.setVisibility(   this.$displayName(),
509
-                            (displayMode === DISPLAY_BLACKNESS_WITH_NAME
515
+                            !this.hideDisplayName
516
+                            && (displayMode === DISPLAY_BLACKNESS_WITH_NAME
510 517
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME
511 518
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
512 519
     // show hide overlay when there is a video or avatar under

Loading…
취소
저장