瀏覽代碼

fix bug with F shortcut

j8
Ilya Daynatovich 8 年之前
父節點
當前提交
1328870a2b
共有 1 個文件被更改,包括 20 次插入14 次删除
  1. 20
    14
      modules/UI/videolayout/FilmStrip.js

+ 20
- 14
modules/UI/videolayout/FilmStrip.js 查看文件

@@ -14,7 +14,6 @@ const FilmStrip = {
14 14
         this.iconMenuUpClassName = 'icon-menu-up';
15 15
         this.filmStrip = $('#remoteVideos');
16 16
         this.eventEmitter = eventEmitter;
17
-        this.filmStripIsVisible = true;
18 17
         this._initFilmStripToolbar();
19 18
         this.registerListeners();
20 19
     },
@@ -39,11 +38,12 @@ const FilmStrip = {
39 38
      */
40 39
     _generateFilmStripToolbar() {
41 40
         let container = document.createElement('div');
41
+        let isVisible = this.isFilmStripVisible();
42 42
         container.className = 'filmstripToolbar';
43 43
 
44 44
         container.innerHTML = `
45 45
             <button id="hideVideoToolbar">
46
-                <i class="icon-menu-${this.filmStripIsVisible ? 'down' : 'up'}">
46
+                <i class="icon-menu-${isVisible ? 'down' : 'up'}">
47 47
                 </i>
48 48
             </button>
49 49
         `;
@@ -55,17 +55,15 @@ const FilmStrip = {
55 55
      * Attach 'click' listener to "hide filmstrip" button
56 56
      */
57 57
     registerListeners() {
58
-        $('#videospace').on('click', '#hideVideoToolbar', () => {
58
+        let toggleFilmstripMethod = this.toggleFilmStrip.bind(this);
59
+        let selector = '#hideVideoToolbar';
60
+        $('#videospace').on('click', selector, toggleFilmstripMethod);
59 61
 
60
-            this.filmStripIsVisible = !this.filmStripIsVisible;
61
-            this.toggleFilmStrip(this.filmStripIsVisible);
62
-
63
-            if (this.filmStripIsVisible) {
64
-                this.showMenuDownIcon();
65
-            } else {
66
-                this.showMenuUpIcon();
67
-            }
68
-        });
62
+        let eventEmitter = this.eventEmitter;
63
+        let event = UIEvents.TOGGLE_FILM_STRIP;
64
+        if (eventEmitter) {
65
+            eventEmitter.addListener(event, toggleFilmstripMethod);
66
+        }
69 67
     },
70 68
 
71 69
     /**
@@ -95,13 +93,21 @@ const FilmStrip = {
95 93
      * value.
96 94
      */
97 95
     toggleFilmStrip(visible) {
98
-        if (typeof visible === 'boolean'
99
-            && this.isFilmStripVisible() == visible) {
96
+        let isVisibleDefined = typeof visible === 'boolean';
97
+        if (!isVisibleDefined) {
98
+            visible = this.isFilmStripVisible();
99
+        } else if (this.isFilmStripVisible() === visible) {
100 100
             return;
101 101
         }
102 102
 
103 103
         this.filmStrip.toggleClass("hidden");
104 104
 
105
+        if (!visible) {
106
+            this.showMenuDownIcon();
107
+        } else {
108
+            this.showMenuUpIcon();
109
+        }
110
+
105 111
         // Emit/fire UIEvents.TOGGLED_FILM_STRIP.
106 112
         var eventEmitter = this.eventEmitter;
107 113
         if (eventEmitter) {

Loading…
取消
儲存