Pārlūkot izejas kodu

fix(vertical-filmstrip): prevent scaling based on video count

Vertical filmstrip has a scrollbar to scroll through all remote
video thumbnails instead of scaling width and height to force all
thumbnails to display on screen. The scaling is not necessary in
vertical filmstrip mode and instead causes some UI spacing issues
with the video status label.

Also addressed a typo in "removeVideoWidth" near the area of the
changed logic.
j8
Leonard Kim 8 gadus atpakaļ
vecāks
revīzija
5d1087e464
1 mainītis faili ar 21 papildinājumiem un 19 dzēšanām
  1. 21
    19
      modules/UI/videolayout/Filmstrip.js

+ 21
- 19
modules/UI/videolayout/Filmstrip.js Parādīt failu

@@ -286,9 +286,10 @@ const Filmstrip = {
286 286
             );
287 287
         }
288 288
 
289
-        // If the number of videos is 0 or undefined we don't need to calculate
290
-        // further.
291
-        if (numvids) {
289
+        // If the number of videos is 0 or undefined or we're in vertical
290
+        // filmstrip mode we don't need to calculate further any adjustments
291
+        // to width based on the number of videos present.
292
+        if (numvids && !interfaceConfig.VERTICAL_FILMSTRIP) {
292 293
             let remoteVideoContainer = thumbs.remoteThumbs.eq(0);
293 294
             availableWidth = Math.floor(
294 295
                 (videoAreaAvailableWidth - numvids * (
@@ -358,8 +359,9 @@ const Filmstrip = {
358 359
          * h - the height of the thumbnails
359 360
          * remoteRatio - width:height for the remote thumbnail
360 361
          * localRatio - width:height for the local thumbnail
361
-         * numberRemoteThumbs - number of remote thumbnails (we have only one
362
-         * local thumbnail)
362
+         * remoteThumbsInRow - number of remote thumbnails in a row (we have
363
+         * only one local thumbnail) next to the local thumbnail. In vertical
364
+         * filmstrip mode, this will always be 0.
363 365
          *
364 366
          * Since the height for local thumbnail = height for remote thumbnail
365 367
          * and we know the ratio (width:height) for the local and for the
@@ -368,9 +370,9 @@ const Filmstrip = {
368 370
          * remoteLocalWidthRatio = rW / lW = remoteRatio / localRatio
369 371
          * and rW = lW * remoteRatio / localRatio = lW * remoteLocalWidthRatio
370 372
          * And the total width for the thumbnails is:
371
-         * totalWidth = rW * numberRemoteThumbs + lW
372
-         * = lW * remoteLocalWidthRatio * numberRemoteThumbs + lW =
373
-         * lW * (remoteLocalWidthRatio * numberRemoteThumbs + 1)
373
+         * totalWidth = rW * remoteThumbsInRow + lW
374
+         * = lW * remoteLocalWidthRatio * remoteThumbsInRow + lW =
375
+         * lW * (remoteLocalWidthRatio * remoteThumbsInRow + 1)
374 376
          * and the h = lW/localRatio
375 377
          *
376 378
          * In order to fit all the thumbails in the area defined by
@@ -388,21 +390,21 @@ const Filmstrip = {
388 390
          * availableHeight/h > availableWidth/totalWidth otherwise 2) is true
389 391
          */
390 392
 
391
-        const numberRemoteThumbs = this.getThumbs(true).remoteThumbs.length;
393
+        const remoteThumbsInRow = interfaceConfig.VERTICAL_FILMSTRIP
394
+            ? 0 : this.getThumbs(true).remoteThumbs.length;
392 395
         const remoteLocalWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO /
393 396
             interfaceConfig.LOCAL_THUMBNAIL_RATIO;
394 397
         const lW = Math.min(availableWidth /
395
-            (remoteLocalWidthRatio * numberRemoteThumbs + 1), availableHeight *
398
+            (remoteLocalWidthRatio * remoteThumbsInRow + 1), availableHeight *
396 399
             interfaceConfig.LOCAL_THUMBNAIL_RATIO);
397 400
         const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
398 401
 
399
-        const removeVideoWidth = lW * remoteLocalWidthRatio;
402
+        const remoteVideoWidth = lW * remoteLocalWidthRatio;
400 403
 
401 404
         let localVideo;
402 405
         if (interfaceConfig.VERTICAL_FILMSTRIP) {
403
-            // scale both width and height
404 406
             localVideo = {
405
-                thumbWidth: removeVideoWidth,
407
+                thumbWidth: remoteVideoWidth,
406 408
                 thumbHeight: h * remoteLocalWidthRatio
407 409
             };
408 410
         } else {
@@ -413,12 +415,12 @@ const Filmstrip = {
413 415
         }
414 416
 
415 417
         return {
416
-                    localVideo,
417
-                    remoteVideo: {
418
-                        thumbWidth: removeVideoWidth,
419
-                        thumbHeight: h
420
-                    }
421
-                };
418
+            localVideo,
419
+            remoteVideo: {
420
+                thumbWidth: remoteVideoWidth,
421
+                thumbHeight: h
422
+            }
423
+        };
422 424
     },
423 425
 
424 426
     /**

Notiek ielāde…
Atcelt
Saglabāt