ソースを参照

Add config flag for tile responsiveness

j8
Mihai-Andrei Uscat 4年前
コミット
8cf4e15b23

+ 3
- 0
config.js ファイルの表示

@@ -326,6 +326,9 @@ var config = {
326 326
     // UI
327 327
     //
328 328
 
329
+    // Disables responsive tiles.
330
+    // disableResponsiveTiles: false,
331
+
329 332
     // Hides lobby button
330 333
     // hideLobbyButton: false,
331 334
 

+ 1
- 0
react/features/base/config/configWhitelist.js ファイルの表示

@@ -89,6 +89,7 @@ export default [
89 89
     'disableProfile',
90 90
     'disableRemoteControl',
91 91
     'disableRemoteMute',
92
+    'disableResponsiveTiles',
92 93
     'disableRtx',
93 94
     'disableShortcuts',
94 95
     'disableSimulcast',

+ 10
- 7
react/features/filmstrip/actions.web.js ファイルの表示

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { toState } from '../base/redux';
3 4
 import { CHAT_SIZE } from '../chat/constants';
4 5
 
5 6
 import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
@@ -15,28 +16,30 @@ const TILE_VIEW_SIDE_MARGINS = 20;
15 16
  *
16 17
  * @param {Object} dimensions - Whether the filmstrip is visible.
17 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 21
  * @returns {{
23 22
  *     type: SET_TILE_VIEW_DIMENSIONS,
24 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 28
     const { clientWidth, clientHeight } = windowSize;
29 29
     const heightToUse = clientHeight;
30 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 35
         widthToUse -= CHAT_SIZE;
34 36
     }
35 37
 
36 38
     const thumbnailSize = calculateThumbnailSizeForTileView({
37 39
         ...dimensions,
38 40
         clientWidth: widthToUse,
39
-        clientHeight: heightToUse
41
+        clientHeight: heightToUse,
42
+        disableResponsiveTiles
40 43
     });
41 44
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
42 45
 

+ 8
- 2
react/features/filmstrip/functions.web.js ファイルの表示

@@ -140,9 +140,15 @@ export function calculateThumbnailSizeForTileView({
140 140
     columns,
141 141
     visibleRows,
142 142
     clientWidth,
143
-    clientHeight
143
+    clientHeight,
144
+    disableResponsiveTiles
144 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 152
     const viewWidth = clientWidth - TILE_VIEW_SIDE_MARGINS;
147 153
     const viewHeight = clientHeight - TILE_VIEW_SIDE_MARGINS;
148 154
     const initialWidth = viewWidth / columns;

+ 1
- 2
react/features/filmstrip/middleware.web.js ファイルの表示

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

+ 4
- 7
react/features/filmstrip/subscriber.web.js ファイルの表示

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

+ 26
- 22
react/features/video-layout/functions.js ファイルの表示

@@ -42,28 +42,32 @@ export function getCurrentLayout(state: Object) {
42 42
  */
43 43
 export function getMaxColumnCount(state: Object) {
44 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 73
     return Math.min(Math.max(configuredMax, 1), ABSOLUTE_MAX_COLUMNS);

読み込み中…
キャンセル
保存