瀏覽代碼

feat(tile-view) optimize for less margins

- Lower the inter-tile margin to 2px
- Remove the 100px top/bottom margin when the toolbar is hidden
master
Saúl Ibarra Corretgé 4 年之前
父節點
當前提交
4ca02c1ebf

+ 2
- 3
css/filmstrip/_tile_view.scss 查看文件

15
         box-sizing: border-box;
15
         box-sizing: border-box;
16
         display: flex;
16
         display: flex;
17
         flex-direction: column;
17
         flex-direction: column;
18
-        height: calc(100vh - 200px);
18
+        height: 100vh;
19
         width: 100vw;
19
         width: 100vw;
20
-        margin: 100px 0px;
21
     }
20
     }
22
 
21
 
23
     .filmstrip__videos .videocontainer {
22
     .filmstrip__videos .videocontainer {
95
             border: 0;
94
             border: 0;
96
             box-sizing: border-box;
95
             box-sizing: border-box;
97
             display: block;
96
             display: block;
98
-            margin: 5px;
97
+            margin: 2px;
99
         }
98
         }
100
 
99
 
101
         video {
100
         video {

+ 11
- 2
react/features/filmstrip/actions.web.js 查看文件

17
  * @param {Object} windowSize - The size of the window.
17
  * @param {Object} windowSize - The size of the window.
18
  * @param {boolean} isChatOpen - Whether the chat panel is displayed, in
18
  * @param {boolean} isChatOpen - Whether the chat panel is displayed, in
19
  * order to properly compute the tile view size.
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.
20
  * @returns {{
22
  * @returns {{
21
  *     type: SET_TILE_VIEW_DIMENSIONS,
23
  *     type: SET_TILE_VIEW_DIMENSIONS,
22
  *     dimensions: Object
24
  *     dimensions: Object
23
  * }}
25
  * }}
24
  */
26
  */
25
-export function setTileViewDimensions(dimensions: Object, windowSize: Object, isChatOpen: boolean) {
27
+export function setTileViewDimensions(
28
+        dimensions: Object, windowSize: Object, isChatOpen: boolean, isToolboxVisible: boolean) {
26
     const { clientWidth, clientHeight } = windowSize;
29
     const { clientWidth, clientHeight } = windowSize;
30
+    let heightToUse = clientHeight;
27
     let widthToUse = clientWidth;
31
     let widthToUse = clientWidth;
28
 
32
 
29
     if (isChatOpen) {
33
     if (isChatOpen) {
30
         widthToUse -= CHAT_SIZE;
34
         widthToUse -= CHAT_SIZE;
31
     }
35
     }
32
 
36
 
37
+    if (isToolboxVisible) {
38
+        // The distance from the top and bottom of the screen, to avoid overlapping UI elements.
39
+        heightToUse -= 150;
40
+    }
41
+
33
     const thumbnailSize = calculateThumbnailSizeForTileView({
42
     const thumbnailSize = calculateThumbnailSizeForTileView({
34
         ...dimensions,
43
         ...dimensions,
35
         clientWidth: widthToUse,
44
         clientWidth: widthToUse,
36
-        clientHeight
45
+        clientHeight: heightToUse
37
     });
46
     });
38
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
47
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
39
 
48
 

+ 1
- 5
react/features/filmstrip/functions.web.js 查看文件

94
     clientWidth,
94
     clientWidth,
95
     clientHeight
95
     clientHeight
96
 }: Object) {
96
 }: Object) {
97
-    // The distance from the top and bottom of the screen, as set by CSS, to
98
-    // avoid overlapping UI elements.
99
-    const topBottomPadding = 200;
100
-
101
     // Minimum space to keep between the sides of the tiles and the sides
97
     // Minimum space to keep between the sides of the tiles and the sides
102
     // of the window.
98
     // of the window.
103
     const sideMargins = 30 * 2;
99
     const sideMargins = 30 * 2;
104
 
100
 
105
     const verticalMargins = visibleRows * 10;
101
     const verticalMargins = visibleRows * 10;
106
     const viewWidth = clientWidth - sideMargins;
102
     const viewWidth = clientWidth - sideMargins;
107
-    const viewHeight = clientHeight - topBottomPadding - verticalMargins;
103
+    const viewHeight = clientHeight - verticalMargins;
108
     const initialWidth = viewWidth / columns;
104
     const initialWidth = viewWidth / columns;
109
     const aspectRatioHeight = initialWidth / TILE_ASPECT_RATIO;
105
     const aspectRatioHeight = initialWidth / TILE_ASPECT_RATIO;
110
     const height = Math.floor(Math.min(aspectRatioHeight, viewHeight / visibleRows));
106
     const height = Math.floor(Math.min(aspectRatioHeight, viewHeight / visibleRows));

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

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'];
32
             const { isOpen } = state['features/chat'];
33
+            const { visible } = state['features/toolbox'];
33
 
34
 
34
             store.dispatch(
35
             store.dispatch(
35
                 setTileViewDimensions(
36
                 setTileViewDimensions(
38
                         clientHeight,
39
                         clientHeight,
39
                         clientWidth
40
                         clientWidth
40
                     },
41
                     },
41
-                    isOpen
42
+                    isOpen,
43
+                    visible
42
                 )
44
                 )
43
             );
45
             );
44
             break;
46
             break;

+ 39
- 5
react/features/filmstrip/subscriber.web.js 查看文件

18
         if (shouldDisplayTileView(state)) {
18
         if (shouldDisplayTileView(state)) {
19
             const gridDimensions = getTileViewGridDimensions(state);
19
             const gridDimensions = getTileViewGridDimensions(state);
20
             const oldGridDimensions = state['features/filmstrip'].tileViewDimensions.gridDimensions;
20
             const oldGridDimensions = state['features/filmstrip'].tileViewDimensions.gridDimensions;
21
-            const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
22
-            const { isOpen } = state['features/chat'];
23
 
21
 
24
             if (!equals(gridDimensions, oldGridDimensions)) {
22
             if (!equals(gridDimensions, oldGridDimensions)) {
23
+                const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
24
+                const { isOpen } = state['features/chat'];
25
+                const { visible } = state['features/toolbox'];
26
+
25
                 store.dispatch(
27
                 store.dispatch(
26
                     setTileViewDimensions(
28
                     setTileViewDimensions(
27
                         gridDimensions,
29
                         gridDimensions,
29
                             clientHeight,
31
                             clientHeight,
30
                             clientWidth
32
                             clientWidth
31
                         },
33
                         },
32
-                        isOpen
34
+                        isOpen,
35
+                        visible
33
                     )
36
                     )
34
                 );
37
                 );
35
             }
38
             }
48
         case LAYOUTS.TILE_VIEW: {
51
         case LAYOUTS.TILE_VIEW: {
49
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
52
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
50
             const { isOpen } = state['features/chat'];
53
             const { isOpen } = state['features/chat'];
54
+            const { visible } = state['features/toolbox'];
51
 
55
 
52
             store.dispatch(
56
             store.dispatch(
53
                 setTileViewDimensions(
57
                 setTileViewDimensions(
56
                         clientHeight,
60
                         clientHeight,
57
                         clientWidth
61
                         clientWidth
58
                     },
62
                     },
59
-                    isOpen
63
+                    isOpen,
64
+                    visible
60
                 )
65
                 )
61
             );
66
             );
62
             break;
67
             break;
109
         if (shouldDisplayTileView(state)) {
114
         if (shouldDisplayTileView(state)) {
110
             const gridDimensions = getTileViewGridDimensions(state);
115
             const gridDimensions = getTileViewGridDimensions(state);
111
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
116
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
117
+            const { visible } = state['features/toolbox'];
118
+
119
+            store.dispatch(
120
+                setTileViewDimensions(
121
+                    gridDimensions,
122
+                    {
123
+                        clientHeight,
124
+                        clientWidth
125
+                    },
126
+                    isChatOpen,
127
+                    visible
128
+                )
129
+            );
130
+        }
131
+    });
132
+
133
+/**
134
+ * Listens for changes in the chat state to calculate the dimensions of the tile view grid and the tiles.
135
+ */
136
+StateListenerRegistry.register(
137
+    /* selector */ state => state['features/toolbox'].visible,
138
+    /* listener */ (visible, store) => {
139
+        const state = store.getState();
140
+
141
+        if (shouldDisplayTileView(state)) {
142
+            const gridDimensions = getTileViewGridDimensions(state);
143
+            const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
144
+            const { isOpen } = state['features/chat'];
112
 
145
 
113
             store.dispatch(
146
             store.dispatch(
114
                 setTileViewDimensions(
147
                 setTileViewDimensions(
117
                         clientHeight,
150
                         clientHeight,
118
                         clientWidth
151
                         clientWidth
119
                     },
152
                     },
120
-                    isChatOpen
153
+                    isOpen,
154
+                    visible
121
                 )
155
                 )
122
             );
156
             );
123
         }
157
         }

Loading…
取消
儲存