Sfoglia il codice sorgente

Fix aligning of indicator icon; Update logic for dynamically change of thumb indicators via font-size

j8
Ilya Daynatovich 8 anni fa
parent
commit
9bc24e1caa

+ 1
- 1
css/_mixins.scss Vedi File

@@ -63,7 +63,7 @@
63 63
   top: 50%;
64 64
   left: 50%;
65 65
   position: absolute;
66
-  @include transform(translate(-50%, -50%))
66
+  @include transform(translate(-50%, -50%));
67 67
 }
68 68
 
69 69
 /**

+ 4
- 35
css/_videolayout_default.scss Vedi File

@@ -68,33 +68,24 @@
68 68
             }
69 69
 
70 70
             .indicatoricon {
71
-                position: absolute;
72
-                top: 50%;
73
-                left: 0;
74
-                @include transform(translateY(-50%));
75
-                width: 100%;
71
+                @include absoluteAligning();
76 72
             }
77 73
 
78 74
             .connection {
79 75
                 position: relative;
76
+                display: inline-block;
80 77
                 margin: 0 auto;
81
-                width: 12px;
82
-                height: 8px;
78
+                left: 0;
79
+                @include transform(translate(0, -50%));
83 80
 
84 81
                 &_empty
85 82
                 {
86
-                    @include topLeft();
87
-                    max-width: 12px;
88
-                    width: 12px;
89 83
                     color: #8B8B8B;/*#FFFFFF*/
90 84
                     overflow: hidden;
91 85
                 }
92 86
 
93 87
                 &_lost
94 88
                 {
95
-                    @include topLeft();
96
-                    max-width: 12px;
97
-                    width: 12px;
98 89
                     color: #8B8B8B;
99 90
                     overflow: visible;
100 91
                 }
@@ -102,8 +93,6 @@
102 93
                 &_full
103 94
                 {
104 95
                     @include topLeft();
105
-                    max-width: 12px;
106
-                    width: 12px;
107 96
                     color: #FFFFFF;/*#15A1ED*/
108 97
                     overflow: hidden;
109 98
                 }
@@ -116,26 +105,6 @@
116 105
         }
117 106
     }
118 107
 
119
-    &_small {
120
-        span.indicator {
121
-            font-size: 5px;
122
-
123
-            .connection {
124
-                height: 5px;
125
-            }
126
-        }
127
-    }
128
-
129
-    &_medium {
130
-        span.indicator {
131
-            font-size: 6px;
132
-
133
-            .connection {
134
-                height: 6px;
135
-            }
136
-        }
137
-    }
138
-
139 108
     &__hoverOverlay {
140 109
         position: relative;
141 110
         width: 100%;

+ 53
- 0
modules/UI/util/UIUtil.js Vedi File

@@ -27,6 +27,25 @@ const SHOW_CLASSES = {
27 27
     'list-item': 'show-list-item'
28 28
 };
29 29
 
30
+/**
31
+ * Contains sizes of thumbnails
32
+ * @type {{SMALL: number, MEDIUM: number}}
33
+ */
34
+const ThumbnailSizes = {
35
+    SMALL: 60,
36
+    MEDIUM: 80
37
+};
38
+
39
+/**
40
+ * Contains font sizes for thumbnail indicators
41
+ * @type {{SMALL: number, MEDIUM: number}}
42
+ */
43
+const IndicatorFontSizes = {
44
+    SMALL: 5,
45
+    MEDIUM: 6,
46
+    NORMAL: 8
47
+};
48
+
30 49
 /**
31 50
  * Created by hristo on 12/22/14.
32 51
  */
@@ -463,6 +482,7 @@ const SHOW_CLASSES = {
463 482
 
464 483
         if (indicators.length <= 0) {
465 484
             indicatorSpan = document.createElement('span');
485
+
466 486
             indicatorSpan.className = 'indicator';
467 487
             indicatorSpan.id = indicatorId;
468 488
 
@@ -475,6 +495,8 @@ const SHOW_CLASSES = {
475 495
                 APP.translation.translateElement($(indicatorSpan));
476 496
             }
477 497
 
498
+            this._resizeIndicator(indicatorSpan);
499
+
478 500
             document.getElementById(videoSpanId)
479 501
                 .querySelector('.videocontainer__toptoolbar')
480 502
                 .appendChild(indicatorSpan);
@@ -483,6 +505,37 @@ const SHOW_CLASSES = {
483 505
         }
484 506
 
485 507
         return indicatorSpan;
508
+    },
509
+
510
+    /**
511
+     * Resizing indicator element passing via argument
512
+     * according to the current thumbnail size
513
+     * @param {HTMLElement} indicator - indicator element
514
+     * @private
515
+     */
516
+    _resizeIndicator(indicator) {
517
+        let height = $('#localVideoContainer').height();
518
+        let fontSize = this.getIndicatorFontSize(height);
519
+        $(indicator).css('font-size', fontSize);
520
+    },
521
+
522
+    /**
523
+     * Returns font size for indicators according to current
524
+     * height of thumbnail
525
+     * @param {Number} - height - current height of thumbnail
526
+     * @returns {Number} - font size for current height
527
+     */
528
+    getIndicatorFontSize(height) {
529
+        const { SMALL, MEDIUM } = ThumbnailSizes;
530
+        let fontSize = IndicatorFontSizes.NORMAL;
531
+
532
+        if (height <= SMALL) {
533
+            fontSize = IndicatorFontSizes.SMALL;
534
+        } else if (height > SMALL && height <= MEDIUM) {
535
+            fontSize = IndicatorFontSizes.MEDIUM;
536
+        }
537
+
538
+        return fontSize;
486 539
     }
487 540
 };
488 541
 

+ 8
- 39
modules/UI/videolayout/FilmStrip.js Vedi File

@@ -3,15 +3,6 @@
3 3
 import UIEvents from "../../../service/UI/UIEvents";
4 4
 import UIUtil from "../util/UIUtil";
5 5
 
6
-/**
7
- * Contains sizes of thumbnails
8
- * @type {{SMALL: number, MEDIUM: number}}
9
- */
10
-const ThumbnailSizes = {
11
-    SMALL: 60,
12
-    MEDIUM: 80
13
-};
14
-
15 6
 const FilmStrip = {
16 7
     /**
17 8
      *
@@ -402,7 +393,14 @@ const FilmStrip = {
402 393
                 }, this._getAnimateOptions(animate, resolve));
403 394
             }));
404 395
 
405
-            this._setThumbnailsClasses(remote.thumbHeight);
396
+            promises.push(new Promise(() => {
397
+                let { localThumb } = this.getThumbs();
398
+                let height = localThumb.height();
399
+                let fontSize = UIUtil.getIndicatorFontSize(height);
400
+                this.filmStrip.find('.indicator').animate({
401
+                    fontSize
402
+                }, this._getAnimateOptions(animate, resolve));
403
+            }));
406 404
 
407 405
             if (!animate) {
408 406
                 resolve();
@@ -427,35 +425,6 @@ const FilmStrip = {
427 425
         };
428 426
     },
429 427
 
430
-    /**
431
-     * Set thumbnail classes according to the current size of thumbnail
432
-     * @param height
433
-     * @private
434
-     */
435
-    _setThumbnailsClasses(height) {
436
-        const { SMALL, MEDIUM } = ThumbnailSizes;
437
-        const { localThumb, remoteThumbs } = this.getThumbs();
438
-        let smallClass = 'videocontainer_small';
439
-        let mediumClass = 'videocontainer_medium';
440
-        let className = '';
441
-
442
-        if (height <= SMALL) {
443
-            className = smallClass;
444
-        } else if (height > SMALL && height <= MEDIUM) {
445
-            className = mediumClass;
446
-        }
447
-
448
-        localThumb
449
-            .removeClass(`${smallClass} ${mediumClass}`)
450
-            .addClass(className);
451
-
452
-        if (remoteThumbs) {
453
-            remoteThumbs
454
-                .removeClass(`${smallClass} ${mediumClass}`)
455
-                .addClass(className);
456
-        }
457
-    },
458
-
459 428
     /**
460 429
      * Returns thumbnails of the filmstrip
461 430
      * @param only_visible

Loading…
Annulla
Salva