Bläddra i källkod

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 år sedan
förälder
incheckning
4ca02c1ebf

+ 2
- 3
css/filmstrip/_tile_view.scss Visa fil

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

+ 11
- 2
react/features/filmstrip/actions.web.js Visa fil

@@ -17,23 +17,32 @@ const TILE_VIEW_SIDE_MARGINS = 10 * 2;
17 17
  * @param {Object} windowSize - The size of the window.
18 18
  * @param {boolean} isChatOpen - Whether the chat panel is displayed, in
19 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 22
  * @returns {{
21 23
  *     type: SET_TILE_VIEW_DIMENSIONS,
22 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 29
     const { clientWidth, clientHeight } = windowSize;
30
+    let heightToUse = clientHeight;
27 31
     let widthToUse = clientWidth;
28 32
 
29 33
     if (isChatOpen) {
30 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 42
     const thumbnailSize = calculateThumbnailSizeForTileView({
34 43
         ...dimensions,
35 44
         clientWidth: widthToUse,
36
-        clientHeight
45
+        clientHeight: heightToUse
37 46
     });
38 47
     const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
39 48
 

+ 1
- 5
react/features/filmstrip/functions.web.js Visa fil

@@ -94,17 +94,13 @@ export function calculateThumbnailSizeForTileView({
94 94
     clientWidth,
95 95
     clientHeight
96 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 97
     // Minimum space to keep between the sides of the tiles and the sides
102 98
     // of the window.
103 99
     const sideMargins = 30 * 2;
104 100
 
105 101
     const verticalMargins = visibleRows * 10;
106 102
     const viewWidth = clientWidth - sideMargins;
107
-    const viewHeight = clientHeight - topBottomPadding - verticalMargins;
103
+    const viewHeight = clientHeight - verticalMargins;
108 104
     const initialWidth = viewWidth / columns;
109 105
     const aspectRatioHeight = initialWidth / TILE_ASPECT_RATIO;
110 106
     const height = Math.floor(Math.min(aspectRatioHeight, viewHeight / visibleRows));

+ 3
- 1
react/features/filmstrip/middleware.web.js Visa fil

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

+ 39
- 5
react/features/filmstrip/subscriber.web.js Visa fil

@@ -18,10 +18,12 @@ StateListenerRegistry.register(
18 18
         if (shouldDisplayTileView(state)) {
19 19
             const gridDimensions = getTileViewGridDimensions(state);
20 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 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 27
                 store.dispatch(
26 28
                     setTileViewDimensions(
27 29
                         gridDimensions,
@@ -29,7 +31,8 @@ StateListenerRegistry.register(
29 31
                             clientHeight,
30 32
                             clientWidth
31 33
                         },
32
-                        isOpen
34
+                        isOpen,
35
+                        visible
33 36
                     )
34 37
                 );
35 38
             }
@@ -48,6 +51,7 @@ StateListenerRegistry.register(
48 51
         case LAYOUTS.TILE_VIEW: {
49 52
             const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
50 53
             const { isOpen } = state['features/chat'];
54
+            const { visible } = state['features/toolbox'];
51 55
 
52 56
             store.dispatch(
53 57
                 setTileViewDimensions(
@@ -56,7 +60,8 @@ StateListenerRegistry.register(
56 60
                         clientHeight,
57 61
                         clientWidth
58 62
                     },
59
-                    isOpen
63
+                    isOpen,
64
+                    visible
60 65
                 )
61 66
             );
62 67
             break;
@@ -109,6 +114,34 @@ StateListenerRegistry.register(
109 114
         if (shouldDisplayTileView(state)) {
110 115
             const gridDimensions = getTileViewGridDimensions(state);
111 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 146
             store.dispatch(
114 147
                 setTileViewDimensions(
@@ -117,7 +150,8 @@ StateListenerRegistry.register(
117 150
                         clientHeight,
118 151
                         clientWidth
119 152
                     },
120
-                    isChatOpen
153
+                    isOpen,
154
+                    visible
121 155
                 )
122 156
             );
123 157
         }

Laddar…
Avbryt
Spara