Pārlūkot izejas kodu

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 gadus atpakaļ
vecāks
revīzija
510c650b7b

+ 13
- 3
modules/UI/videolayout/LocalVideo.js Parādīt failu

110
         $('#localVideoContainer .displayname')
110
         $('#localVideoContainer .displayname')
111
             .bind("click", function (e) {
111
             .bind("click", function (e) {
112
                 let $editDisplayName = $('#editDisplayName');
112
                 let $editDisplayName = $('#editDisplayName');
113
-                let $localDisplayName = $('#localDisplayName');
114
 
113
 
115
                 e.preventDefault();
114
                 e.preventDefault();
116
                 e.stopPropagation();
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
                 $editDisplayName.show();
124
                 $editDisplayName.show();
119
                 $editDisplayName.focus();
125
                 $editDisplayName.focus();
120
                 $editDisplayName.select();
126
                 $editDisplayName.select();
122
                 $editDisplayName.one("focusout", function () {
128
                 $editDisplayName.one("focusout", function () {
123
                     self.emitter.emit(UIEvents.NICKNAME_CHANGED, this.value);
129
                     self.emitter.emit(UIEvents.NICKNAME_CHANGED, this.value);
124
                     $editDisplayName.hide();
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
                 $editDisplayName.on('keydown', function (e) {
138
                 $editDisplayName.on('keydown', function (e) {

+ 8
- 1
modules/UI/videolayout/SmallVideo.js Parādīt failu

51
     this.audioStream = null;
51
     this.audioStream = null;
52
     this.VideoLayout = VideoLayout;
52
     this.VideoLayout = VideoLayout;
53
     this.videoIsHovered = false;
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
  * video because there is no dominant speaker and no focused speaker
487
  * video because there is no dominant speaker and no focused speaker
485
  */
488
  */
486
 SmallVideo.prototype.updateView = function () {
489
 SmallVideo.prototype.updateView = function () {
490
+    if (this.disableUpdateView)
491
+        return;
492
+
487
     if (!this.hasAvatar) {
493
     if (!this.hasAvatar) {
488
         if (this.id) {
494
         if (this.id) {
489
             // Init avatar
495
             // Init avatar
506
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
512
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
507
     // Show/hide the display name.
513
     // Show/hide the display name.
508
     UIUtil.setVisibility(   this.$displayName(),
514
     UIUtil.setVisibility(   this.$displayName(),
509
-                            (displayMode === DISPLAY_BLACKNESS_WITH_NAME
515
+                            !this.hideDisplayName
516
+                            && (displayMode === DISPLAY_BLACKNESS_WITH_NAME
510
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME
517
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME
511
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
518
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
512
     // show hide overlay when there is a video or avatar under
519
     // show hide overlay when there is a video or avatar under

Notiek ielāde…
Atcelt
Saglabāt