Преглед изворни кода

fix(recorder): tile view

In the case of the recorder we were not taking into account that the
local thumbnail is not visible. This was braking the rendering  and
positioning of the thumbnails in tile view.
master
Hristo Terezov пре 4 година
родитељ
комит
e791c4f70c

+ 19
- 7
react/features/filmstrip/components/web/Filmstrip.js Прегледај датотеку

64
      */
64
      */
65
     _filmstripHeight: number,
65
     _filmstripHeight: number,
66
 
66
 
67
+    /**
68
+     * Whether this is a recorder or not.
69
+     */
70
+    _iAmRecorder: boolean,
71
+
67
     /**
72
     /**
68
      * Whether the filmstrip button is enabled.
73
      * Whether the filmstrip button is enabled.
69
      */
74
      */
235
      * @returns {Object}
240
      * @returns {Object}
236
      */
241
      */
237
     _calculateIndices(startIndex, stopIndex) {
242
     _calculateIndices(startIndex, stopIndex) {
238
-        const { _currentLayout, _thumbnailsReordered } = this.props;
243
+        const { _currentLayout, _iAmRecorder, _thumbnailsReordered } = this.props;
239
         let start = startIndex;
244
         let start = startIndex;
240
         let stop = stopIndex;
245
         let stop = stopIndex;
241
 
246
 
242
         if (_thumbnailsReordered) {
247
         if (_thumbnailsReordered) {
243
             // In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local
248
             // In tile view, the indices needs to be offset by 1 because the first thumbnail is that of the local
244
             // endpoint. The remote participants start from index 1.
249
             // endpoint. The remote participants start from index 1.
245
-            if (_currentLayout === LAYOUTS.TILE_VIEW) {
250
+            if (!_iAmRecorder && _currentLayout === LAYOUTS.TILE_VIEW) {
246
                 start = Math.max(startIndex - 1, 0);
251
                 start = Math.max(startIndex - 1, 0);
247
                 stop = stopIndex - 1;
252
                 stop = stopIndex - 1;
248
             }
253
             }
294
      * @returns {string} - The key.
299
      * @returns {string} - The key.
295
      */
300
      */
296
     _gridItemKey({ columnIndex, rowIndex }) {
301
     _gridItemKey({ columnIndex, rowIndex }) {
297
-        const { _columns, _remoteParticipants, _remoteParticipantsLength, _thumbnailsReordered } = this.props;
302
+        const {
303
+            _columns,
304
+            _iAmRecorder,
305
+            _remoteParticipants,
306
+            _remoteParticipantsLength,
307
+            _thumbnailsReordered
308
+        } = this.props;
298
         const index = (rowIndex * _columns) + columnIndex;
309
         const index = (rowIndex * _columns) + columnIndex;
299
 
310
 
300
         // When the thumbnails are reordered, local participant is inserted at index 0.
311
         // When the thumbnails are reordered, local participant is inserted at index 0.
301
         const localIndex = _thumbnailsReordered ? 0 : _remoteParticipantsLength;
312
         const localIndex = _thumbnailsReordered ? 0 : _remoteParticipantsLength;
302
-        const remoteIndex = _thumbnailsReordered ? index - 1 : index;
313
+        const remoteIndex = _thumbnailsReordered && !_iAmRecorder ? index - 1 : index;
303
 
314
 
304
-        if (index > _remoteParticipantsLength) {
315
+        if (index > _remoteParticipantsLength - (_iAmRecorder ? 1 : 0)) {
305
             return `empty-${index}`;
316
             return `empty-${index}`;
306
         }
317
         }
307
 
318
 
308
-        if (index === localIndex) {
319
+        if (!_iAmRecorder && index === localIndex) {
309
             return 'local';
320
             return 'local';
310
         }
321
         }
311
 
322
 
528
  */
539
  */
529
 function _mapStateToProps(state) {
540
 function _mapStateToProps(state) {
530
     const toolbarButtons = getToolbarButtons(state);
541
     const toolbarButtons = getToolbarButtons(state);
531
-    const { testing = {} } = state['features/base/config'];
542
+    const { testing = {}, iAmRecorder } = state['features/base/config'];
532
     const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
543
     const enableThumbnailReordering = testing.enableThumbnailReordering ?? true;
533
     const { visible, remoteParticipants } = state['features/filmstrip'];
544
     const { visible, remoteParticipants } = state['features/filmstrip'];
534
     const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
545
     const reduceHeight = state['features/toolbox'].visible && toolbarButtons.length;
596
         _currentLayout,
607
         _currentLayout,
597
         _filmstripHeight: remoteFilmstripHeight,
608
         _filmstripHeight: remoteFilmstripHeight,
598
         _filmstripWidth: remoteFilmstripWidth,
609
         _filmstripWidth: remoteFilmstripWidth,
610
+        _iAmRecorder: Boolean(iAmRecorder),
599
         _isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
611
         _isFilmstripButtonEnabled: isButtonEnabled('filmstrip', state),
600
         _remoteParticipantsLength: remoteParticipants.length,
612
         _remoteParticipantsLength: remoteParticipants.length,
601
         _remoteParticipants: remoteParticipants,
613
         _remoteParticipants: remoteParticipants,

+ 6
- 5
react/features/filmstrip/components/web/ThumbnailWrapper.js Прегледај датотеку

113
         const { columns, rows } = gridDimensions;
113
         const { columns, rows } = gridDimensions;
114
         const index = (rowIndex * columns) + columnIndex;
114
         const index = (rowIndex * columns) + columnIndex;
115
         let horizontalOffset;
115
         let horizontalOffset;
116
+        const { iAmRecorder } = state['features/base/config'];
117
+        const participantsLenght = remoteParticipantsLength + (iAmRecorder ? 0 : 1);
116
 
118
 
117
         if (rowIndex === rows - 1) { // center the last row
119
         if (rowIndex === rows - 1) { // center the last row
118
             const { width: thumbnailWidth } = thumbnailSize;
120
             const { width: thumbnailWidth } = thumbnailSize;
119
-            const { iAmRecorder } = state['features/base/config'];
120
-            const partialLastRowParticipantsNumber = (remoteParticipantsLength + (iAmRecorder ? 0 : 1)) % columns;
121
+            const partialLastRowParticipantsNumber = participantsLenght % columns;
121
 
122
 
122
             if (partialLastRowParticipantsNumber > 0) {
123
             if (partialLastRowParticipantsNumber > 0) {
123
                 horizontalOffset = Math.floor((columns - partialLastRowParticipantsNumber) * (thumbnailWidth + 4) / 2);
124
                 horizontalOffset = Math.floor((columns - partialLastRowParticipantsNumber) * (thumbnailWidth + 4) / 2);
124
             }
125
             }
125
         }
126
         }
126
 
127
 
127
-        if (index > remoteParticipantsLength) {
128
+        if (index > participantsLenght - 1) {
128
             return {};
129
             return {};
129
         }
130
         }
130
 
131
 
131
         // When the thumbnails are reordered, local participant is inserted at index 0.
132
         // When the thumbnails are reordered, local participant is inserted at index 0.
132
         const localIndex = enableThumbnailReordering ? 0 : remoteParticipantsLength;
133
         const localIndex = enableThumbnailReordering ? 0 : remoteParticipantsLength;
133
-        const remoteIndex = enableThumbnailReordering ? index - 1 : index;
134
+        const remoteIndex = enableThumbnailReordering && !iAmRecorder ? index - 1 : index;
134
 
135
 
135
-        if (index === localIndex) {
136
+        if (!iAmRecorder && index === localIndex) {
136
             return {
137
             return {
137
                 _participantID: 'local',
138
                 _participantID: 'local',
138
                 _horizontalOffset: horizontalOffset
139
                 _horizontalOffset: horizontalOffset

Loading…
Откажи
Сачувај