Bläddra i källkod

Fixes resizing problems introduced with previous resizing commit. Fixes side panel open/close code and resizing.

j8
yanas 9 år sedan
förälder
incheckning
ad44cc518a

+ 23
- 16
modules/UI/side_pannels/SidePanelToggler.js Visa fil

@@ -22,11 +22,16 @@ var currentlyOpen = null;
22 22
  * @param onOpenComplete function to be called when the panel is opened
23 23
  * @param onOpen function to be called if the window is going to be opened
24 24
  * @param onClose function to be called if the window is going to be closed
25
+ * @param onVideoResizeComplete function to be called after the video area
26
+ * is resized
25 27
  */
26
-function toggle (object, selector, onOpenComplete, onOpen, onClose) {
28
+function toggle (object, selector, onOpenComplete,
29
+                 onOpen, onClose, onVideoResizeComplete) {
30
+    let isSideBarVisible = object.isVisible();
31
+
27 32
     UIUtil.buttonClick(buttons[selector], "active");
28 33
 
29
-    if (object.isVisible()) {
34
+    if (isSideBarVisible) {
30 35
         $("#toast-container").animate({
31 36
             right: 5
32 37
         }, {
@@ -38,12 +43,17 @@ function toggle (object, selector, onOpenComplete, onOpen, onClose) {
38 43
             queue: false,
39 44
             duration: 500
40 45
         });
46
+
47
+        resizeVideoArea(isSideBarVisible, onVideoResizeComplete);
48
+
41 49
         if(typeof onClose === "function") {
42 50
             onClose();
43 51
         }
44 52
 
45 53
         currentlyOpen = null;
46 54
     } else {
55
+        resizeVideoArea(isSideBarVisible, onVideoResizeComplete);
56
+
47 57
         // Undock the toolbar when the chat is shown and if we're in a
48 58
         // video mode.
49 59
         if (VideoLayout.isLargeVideoVisible()) {
@@ -80,6 +90,13 @@ function toggle (object, selector, onOpenComplete, onOpen, onClose) {
80 90
     }
81 91
 }
82 92
 
93
+function resizeVideoArea(isSidePanelVisible, completeFunction) {
94
+    VideoLayout.resizeVideoArea(!isSidePanelVisible,
95
+        false,
96
+        true,
97
+        completeFunction);
98
+}
99
+
83 100
 /**
84 101
  * Toggler for the chat, contact list, settings menu, etc..
85 102
  */
@@ -96,11 +113,6 @@ var PanelToggler = {
96 113
                 $('#chatspace').trigger('shown');
97 114
             };
98 115
 
99
-        VideoLayout.resizeVideoArea(!Chat.isVisible(),
100
-                                    false,
101
-                                    true,
102
-                                    chatCompleteFunction);
103
-
104 116
         toggle(Chat, //Object
105 117
             '#chatspace', // Selector
106 118
             function () { //onOpenComplete
@@ -113,7 +125,8 @@ var PanelToggler = {
113 125
                 }
114 126
             },
115 127
             () => this.resizeChat(), //OnOpen
116
-            null); //OnClose
128
+            null,
129
+            chatCompleteFunction); //OnClose
117 130
     },
118 131
 
119 132
     resizeChat () {
@@ -130,11 +143,6 @@ var PanelToggler = {
130 143
             : function () {
131 144
                 $('#contactlist').trigger('shown');
132 145
             };
133
-        VideoLayout.resizeVideoArea(
134
-            !ContactList.isVisible(),
135
-            false,
136
-            true,
137
-            completeFunction);
138 146
 
139 147
         toggle(ContactList,
140 148
             '#contactlist',
@@ -142,15 +150,14 @@ var PanelToggler = {
142 150
             function() {
143 151
                 ContactList.setVisualNotification(false);
144 152
             },
145
-            null);
153
+            null,
154
+            completeFunction);
146 155
     },
147 156
 
148 157
     /**
149 158
      * Opens / closes the settings menu
150 159
      */
151 160
     toggleSettingsMenu () {
152
-        VideoLayout.resizeVideoArea(
153
-            !SettingsMenu.isVisible(), false, true, function (){});
154 161
         toggle(SettingsMenu,
155 162
             '#settingsmenu',
156 163
             null,

+ 6
- 8
modules/UI/videolayout/FilmStrip.js Visa fil

@@ -43,7 +43,7 @@ const FilmStrip = {
43 43
      * @param videoAreaAvailableWidth the currently available video area width
44 44
      * that we want to take into account when calculating the film strip width.
45 45
      */
46
-     calculateThumbnailSize (videoAreaAvailableWidth) {
46
+     calculateThumbnailSize (isSideBarVisible) {
47 47
         // Calculate the available height, which is the inner window height
48 48
         // minus 39px for the header minus 2px for the delimiter lines on the
49 49
         // top and bottom of the large video, minus the 36px space inside the
@@ -59,25 +59,23 @@ const FilmStrip = {
59 59
          * the filmStrip width, because we're probably in a state where the
60 60
          * film strip size hasn't been updated yet, but it will be.
61 61
          */
62
-        let filmStripWidth = videoAreaAvailableWidth
63
-            ? videoAreaAvailableWidth
62
+        let videoAreaAvailableWidth
63
+            = UIUtil.getAvailableVideoWidth(isSideBarVisible)
64 64
                 - parseInt(this.filmStrip.css('right'), 10)
65 65
                 - parseInt(this.filmStrip.css('paddingLeft'), 10)
66 66
                 - parseInt(this.filmStrip.css('paddingRight'), 10)
67 67
                 - parseInt(this.filmStrip.css('borderLeftWidth'), 10)
68
-                - parseInt(this.filmStrip.css('borderRightWidth'), 10)
69
-            : this.getFilmStripWidth();
70
-
68
+                - parseInt(this.filmStrip.css('borderRightWidth'), 10);
71 69
 
72 70
         let availableWidth = Math.floor(
73
-                (filmStripWidth - numvids * (
71
+                (videoAreaAvailableWidth - numvids * (
74 72
                 parseInt(localVideoContainer.css('borderLeftWidth'), 10)
75 73
                 + parseInt(localVideoContainer.css('borderRightWidth'), 10)
76 74
                 + parseInt(localVideoContainer.css('paddingLeft'), 10)
77 75
                 + parseInt(localVideoContainer.css('paddingRight'), 10)
78 76
                 + parseInt(localVideoContainer.css('marginLeft'), 10)
79 77
                 + parseInt(localVideoContainer.css('marginRight'), 10)))
80
-                / numvids) - numvids*10;
78
+                / numvids) - 20;
81 79
 
82 80
         let maxHeight
83 81
             // If the MAX_HEIGHT property hasn't been specified

+ 0
- 1
modules/UI/videolayout/RemoteVideo.js Visa fil

@@ -42,7 +42,6 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() {
42 42
  * @param id the id indicating the video for which we're adding a menu.
43 43
  * @param parentElement the parent element where this menu will be added
44 44
  */
45
-
46 45
 if (!interfaceConfig.filmStripOnly) {
47 46
     RemoteVideo.prototype.addRemoteVideoMenu = function () {
48 47
         var spanElement = document.createElement('span');

+ 13
- 5
modules/UI/videolayout/VideoLayout.js Visa fil

@@ -12,6 +12,7 @@ import RemoteVideo from "./RemoteVideo";
12 12
 import LargeVideoManager, {VideoContainerType} from "./LargeVideo";
13 13
 import {PreziContainerType} from '../prezi/Prezi';
14 14
 import LocalVideo from "./LocalVideo";
15
+import PanelToggler from "../side_pannels/SidePanelToggler";
15 16
 
16 17
 const RTCUIUtil = JitsiMeetJS.util.RTCUIHelper;
17 18
 
@@ -356,8 +357,8 @@ var VideoLayout = {
356 357
 
357 358
         console.info(resourceJid + " video is now active", videoelem);
358 359
 
359
-        $(videoelem).show();
360
-        VideoLayout.resizeThumbnails();
360
+        VideoLayout.resizeThumbnails(
361
+            false, false, false, function() {$(videoelem).show();});
361 362
 
362 363
         // Update the large video to the last added video only if there's no
363 364
         // current dominant, focused speaker or prezi playing or update it to
@@ -416,9 +417,14 @@ var VideoLayout = {
416 417
      */
417 418
     resizeThumbnails (  animate = false,
418 419
                         forceUpdate = false,
419
-                        videoAreaAvailableWidth = null) {
420
+                        isSideBarVisible = null,
421
+                        onComplete = null) {
422
+        isSideBarVisible
423
+            = (isSideBarVisible !== null)
424
+                ? isSideBarVisible : PanelToggler.isVisible();
425
+
420 426
         let {thumbWidth, thumbHeight}
421
-            = FilmStrip.calculateThumbnailSize(videoAreaAvailableWidth);
427
+            = FilmStrip.calculateThumbnailSize(isSideBarVisible);
422 428
 
423 429
         $('.userAvatar').css('left', (thumbWidth - thumbHeight) / 2);
424 430
 
@@ -427,6 +433,8 @@ var VideoLayout = {
427 433
             .then(function () {
428 434
                 BottomToolbar.resizeToolbar(thumbWidth, thumbHeight);
429 435
                 AudioLevels.updateCanvasSize(thumbWidth, thumbHeight);
436
+                if (onComplete && typeof onComplete === "function")
437
+                    onComplete();
430 438
         });
431 439
         return {thumbWidth, thumbHeight};
432 440
     },
@@ -815,7 +823,7 @@ var VideoLayout = {
815 823
         }
816 824
 
817 825
         // Resize the thumbnails first.
818
-        this.resizeThumbnails(false, forceUpdate, availableWidth);
826
+        this.resizeThumbnails(false, forceUpdate, isSideBarVisible);
819 827
 
820 828
         // Resize the video area element.
821 829
         $('#videospace').animate({

Laddar…
Avbryt
Spara