瀏覽代碼

Add config flag for tile responsiveness

j8
Mihai-Andrei Uscat 4 年之前
父節點
當前提交
8cf4e15b23

+ 3
- 0
config.js 查看文件

326
     // UI
326
     // UI
327
     //
327
     //
328
 
328
 
329
+    // Disables responsive tiles.
330
+    // disableResponsiveTiles: false,
331
+
329
     // Hides lobby button
332
     // Hides lobby button
330
     // hideLobbyButton: false,
333
     // hideLobbyButton: false,
331
 
334
 

+ 1
- 0
react/features/base/config/configWhitelist.js 查看文件

89
     'disableProfile',
89
     'disableProfile',
90
     'disableRemoteControl',
90
     'disableRemoteControl',
91
     'disableRemoteMute',
91
     'disableRemoteMute',
92
+    'disableResponsiveTiles',
92
     'disableRtx',
93
     'disableRtx',
93
     'disableShortcuts',
94
     'disableShortcuts',
94
     'disableSimulcast',
95
     'disableSimulcast',

+ 10
- 7
react/features/filmstrip/actions.web.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
+import { toState } from '../base/redux';
3
 import { CHAT_SIZE } from '../chat/constants';
4
 import { CHAT_SIZE } from '../chat/constants';
4
 
5
 
5
 import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
6
 import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
15
  *
16
  *
16
  * @param {Object} dimensions - Whether the filmstrip is visible.
17
  * @param {Object} dimensions - Whether the filmstrip is visible.
17
  * @param {Object} windowSize - The size of the window.
18
  * @param {Object} windowSize - The size of the window.
18
- * @param {boolean} isChatOpen - Whether the chat panel is displayed, in
19
- * order to properly compute the tile view size.
20
- * @param {boolean} isToolboxVisible - Whether the toolbox is visible, in order
21
- * to adjust the available size.
19
+ * @param {Object | Function} stateful - An object or function that can be
20
+ * resolved to Redux state using the {@code toState} function.
22
  * @returns {{
21
  * @returns {{
23
  *     type: SET_TILE_VIEW_DIMENSIONS,
22
  *     type: SET_TILE_VIEW_DIMENSIONS,
24
  *     dimensions: Object
23
  *     dimensions: Object
25
  * }}
24
  * }}
26
  */
25
  */
27
-export function setTileViewDimensions(dimensions: Object, windowSize: Object, isChatOpen: boolean) {
26
+export function setTileViewDimensions(dimensions: Object, windowSize: Object, stateful: Object | Function) {
27
+    const state = toState(stateful);
28
     const { clientWidth, clientHeight } = windowSize;
28
     const { clientWidth, clientHeight } = windowSize;
29
     const heightToUse = clientHeight;
29
     const heightToUse = clientHeight;
30
     let widthToUse = clientWidth;
30
     let widthToUse = clientWidth;
31
+    const { isOpen } = state['features/chat'];
32
+    const { disableResponsiveTiles } = state['features/base/config'];
31
 
33
 
32
-    if (isChatOpen) {
34
+    if (isOpen) {
33
         widthToUse -= CHAT_SIZE;
35
         widthToUse -= CHAT_SIZE;
34
     }
36
     }
35
 
37
 
36
     const thumbnailSize = calculateThumbnailSizeForTileView({
38
     const thumbnailSize = calculateThumbnailSizeForTileView({
37
         ...dimensions,
39
         ...dimensions,
38
         clientWidth: widthToUse,
40
         clientWidth: widthToUse,
39
-        clientHeight: heightToUse
41
+        clientHeight: heightToUse,
42
+        disableResponsiveTiles
40
     });
43
     });
41
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
44
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
42
 
45
 

+ 8
- 2
react/features/filmstrip/functions.web.js 查看文件

140
     columns,
140
     columns,
141
     visibleRows,
141
     visibleRows,
142
     clientWidth,
142
     clientWidth,
143
-    clientHeight
143
+    clientHeight,
144
+    disableResponsiveTiles
144
 }: Object) {
145
 }: Object) {
145
-    const aspectRatio = clientWidth < ASPECT_RATIO_BREAKPOINT ? SQUARE_TILE_ASPECT_RATIO : TILE_ASPECT_RATIO;
146
+    let aspectRatio = TILE_ASPECT_RATIO;
147
+
148
+    if (!disableResponsiveTiles && clientWidth < ASPECT_RATIO_BREAKPOINT) {
149
+        aspectRatio = SQUARE_TILE_ASPECT_RATIO;
150
+    }
151
+
146
     const viewWidth = clientWidth - TILE_VIEW_SIDE_MARGINS;
152
     const viewWidth = clientWidth - TILE_VIEW_SIDE_MARGINS;
147
     const viewHeight = clientHeight - TILE_VIEW_SIDE_MARGINS;
153
     const viewHeight = clientHeight - TILE_VIEW_SIDE_MARGINS;
148
     const initialWidth = viewWidth / columns;
154
     const initialWidth = viewWidth / columns;

+ 1
- 2
react/features/filmstrip/middleware.web.js 查看文件

29
         case LAYOUTS.TILE_VIEW: {
29
         case LAYOUTS.TILE_VIEW: {
30
             const { gridDimensions } = state['features/filmstrip'].tileViewDimensions;
30
             const { gridDimensions } = state['features/filmstrip'].tileViewDimensions;
31
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
31
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
32
-            const { isOpen } = state['features/chat'];
33
 
32
 
34
             store.dispatch(
33
             store.dispatch(
35
                 setTileViewDimensions(
34
                 setTileViewDimensions(
38
                         clientHeight,
37
                         clientHeight,
39
                         clientWidth
38
                         clientWidth
40
                     },
39
                     },
41
-                    isOpen
40
+                    store
42
                 )
41
                 )
43
             );
42
             );
44
             break;
43
             break;

+ 4
- 7
react/features/filmstrip/subscriber.web.js 查看文件

29
 
29
 
30
             if (!equals(gridDimensions, oldGridDimensions)) {
30
             if (!equals(gridDimensions, oldGridDimensions)) {
31
                 const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
31
                 const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
32
-                const { isOpen } = state['features/chat'];
33
 
32
 
34
                 store.dispatch(
33
                 store.dispatch(
35
                     setTileViewDimensions(
34
                     setTileViewDimensions(
38
                             clientHeight,
37
                             clientHeight,
39
                             clientWidth
38
                             clientWidth
40
                         },
39
                         },
41
-                        isOpen
40
+                        store
42
                     )
41
                     )
43
                 );
42
                 );
44
             }
43
             }
56
         switch (layout) {
55
         switch (layout) {
57
         case LAYOUTS.TILE_VIEW: {
56
         case LAYOUTS.TILE_VIEW: {
58
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
57
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
59
-            const { isOpen } = state['features/chat'];
60
 
58
 
61
             store.dispatch(
59
             store.dispatch(
62
                 setTileViewDimensions(
60
                 setTileViewDimensions(
65
                         clientHeight,
63
                         clientHeight,
66
                         clientWidth
64
                         clientWidth
67
                     },
65
                     },
68
-                    isOpen
66
+                    store
69
                 )
67
                 )
70
             );
68
             );
71
             break;
69
             break;
126
                         clientHeight,
124
                         clientHeight,
127
                         clientWidth
125
                         clientWidth
128
                     },
126
                     },
129
-                    isChatOpen
127
+                    store
130
                 )
128
                 )
131
             );
129
             );
132
         }
130
         }
190
         if (shouldDisplayTileView(state)) {
188
         if (shouldDisplayTileView(state)) {
191
             const gridDimensions = getTileViewGridDimensions(state);
189
             const gridDimensions = getTileViewGridDimensions(state);
192
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
190
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
193
-            const { isOpen } = state['features/chat'];
194
 
191
 
195
             store.dispatch(
192
             store.dispatch(
196
                 setTileViewDimensions(
193
                 setTileViewDimensions(
199
                         clientHeight,
196
                         clientHeight,
200
                         clientWidth
197
                         clientWidth
201
                     },
198
                     },
202
-                    isOpen
199
+                    store
203
                 )
200
                 )
204
             );
201
             );
205
         }
202
         }

+ 26
- 22
react/features/video-layout/functions.js 查看文件

42
  */
42
  */
43
 export function getMaxColumnCount(state: Object) {
43
 export function getMaxColumnCount(state: Object) {
44
     const configuredMax = interfaceConfig.TILE_VIEW_MAX_COLUMNS || DEFAULT_MAX_COLUMNS;
44
     const configuredMax = interfaceConfig.TILE_VIEW_MAX_COLUMNS || DEFAULT_MAX_COLUMNS;
45
-    const { clientWidth } = state['features/base/responsive-ui'];
46
-    let availableWidth = clientWidth;
47
-    const participantCount = getParticipantCount(state);
48
-    const { isOpen } = state['features/chat'];
49
-
50
-    if (isOpen) {
51
-        availableWidth -= CHAT_SIZE;
52
-    }
53
-
54
-    // If there are just two participants in a conference, enforce single-column view for mobile size.
55
-    if (participantCount === 2 && availableWidth < ASPECT_RATIO_BREAKPOINT) {
56
-        return Math.min(1, Math.max(configuredMax, 1));
57
-    }
58
-
59
-    // Enforce single column view at very small screen widths.
60
-    if (availableWidth < SINGLE_COLUMN_BREAKPOINT) {
61
-        return Math.min(1, Math.max(configuredMax, 1));
62
-    }
63
-
64
-    // Enforce two column view below breakpoint.
65
-    if (availableWidth < TWO_COLUMN_BREAKPOINT) {
66
-        return Math.min(2, Math.max(configuredMax, 1));
45
+    const { disableResponsiveTiles } = state['features/base/config'];
46
+
47
+    if (!disableResponsiveTiles) {
48
+        const { clientWidth } = state['features/base/responsive-ui'];
49
+        let availableWidth = clientWidth;
50
+        const participantCount = getParticipantCount(state);
51
+        const { isOpen } = state['features/chat'];
52
+
53
+        if (isOpen) {
54
+            availableWidth -= CHAT_SIZE;
55
+        }
56
+
57
+        // If there are just two participants in a conference, enforce single-column view for mobile size.
58
+        if (participantCount === 2 && availableWidth < ASPECT_RATIO_BREAKPOINT) {
59
+            return Math.min(1, Math.max(configuredMax, 1));
60
+        }
61
+
62
+        // Enforce single column view at very small screen widths.
63
+        if (availableWidth < SINGLE_COLUMN_BREAKPOINT) {
64
+            return Math.min(1, Math.max(configuredMax, 1));
65
+        }
66
+
67
+        // Enforce two column view below breakpoint.
68
+        if (availableWidth < TWO_COLUMN_BREAKPOINT) {
69
+            return Math.min(2, Math.max(configuredMax, 1));
70
+        }
67
     }
71
     }
68
 
72
 
69
     return Math.min(Math.max(configuredMax, 1), ABSOLUTE_MAX_COLUMNS);
73
     return Math.min(Math.max(configuredMax, 1), ABSOLUTE_MAX_COLUMNS);

Loading…
取消
儲存