소스 검색

feat(horizontal-filmstrip): scroll

master
Hristo Terezov 5 년 전
부모
커밋
42b71fc4b9
4개의 변경된 파일87개의 추가작업 그리고 68개의 파일을 삭제
  1. 1
    0
      css/_base.scss
  2. 1
    1
      css/_variables.scss
  3. 65
    2
      css/filmstrip/_horizontal_filmstrip.scss
  4. 20
    65
      modules/UI/videolayout/Filmstrip.js

+ 1
- 0
css/_base.scss 파일 보기

@@ -161,6 +161,7 @@ form {
161 161
 ::-webkit-scrollbar {
162 162
     background: transparent;
163 163
     width: 7px;
164
+    height: $scrollHeight;
164 165
 }
165 166
 
166 167
 ::-webkit-scrollbar-button {

+ 1
- 1
css/_variables.scss 파일 보기

@@ -37,7 +37,6 @@ $presence-idle: rgb(172, 172, 172);
37 37
 /**
38 38
  * Toolbar
39 39
  */
40
-$defaultToolbarSize: 50px;
41 40
 $newToolbarBackgroundColor: rgba(22, 38, 55, 0.8);
42 41
 $newToolbarButtonHoverColor: rgba(255, 255, 255, 0.15);
43 42
 $newToolbarButtonToggleColor: rgba(255, 255, 255, 0.2);
@@ -106,6 +105,7 @@ $defaultWatermarkLink: '../images/watermark.png';
106 105
 $popoverMenuPadding: 13px;
107 106
 $happySoftwareBackground: transparent;
108 107
 $desktopAppDragBarHeight: 25px;
108
+$scrollHeight: 7px;
109 109
 
110 110
 /**
111 111
  * Z-indexes. TODO: Replace this by a function.

+ 65
- 2
css/filmstrip/_horizontal_filmstrip.scss 파일 보기

@@ -13,9 +13,24 @@
13 13
     @extend %align-right;
14 14
     transition: bottom .3s;
15 15
     z-index: $filmstripVideosZ;
16
+    box-sizing: border-box;
17
+    width: 100%;
18
+    position: fixed;
19
+
20
+    /*
21
+     * Firefox sets flex items to min-height: auto and min-width: auto,
22
+     * preventing flex children from shrinking like they do on other browsers.
23
+     * Setting min-height and min-width 0 is a workaround for the issue so
24
+     * Firefox behaves like other browsers.
25
+     * https://bugzilla.mozilla.org/show_bug.cgi?id=1043520
26
+     */
27
+     @mixin minHWAutoFix() {
28
+        min-height: 0;
29
+        min-width: 0;
30
+    }
16 31
 
17 32
     &.reduce-height {
18
-        bottom: $newToolbarSizeWithPadding;
33
+        bottom: calc(#{$newToolbarSizeWithPadding} + #{$scrollHeight});
19 34
     }
20 35
 
21 36
     &__videos {
@@ -29,8 +44,9 @@
29 44
 
30 45
         &#remoteVideos {
31 46
             border: $thumbnailsBorder solid transparent;
32
-            padding-left: $defaultToolbarSize + 5;
33 47
             transition: bottom 2s;
48
+            flex-grow: 1;
49
+            @include minHWAutoFix()
34 50
         }
35 51
 
36 52
         /**
@@ -74,4 +90,51 @@
74 90
             pointer-events: none;
75 91
         }
76 92
     }
93
+
94
+    #filmstripRemoteVideos {
95
+        @include minHWAutoFix();
96
+
97
+        display: flex;
98
+        flex: 1;
99
+        width: auto;
100
+        justify-content: flex-end;
101
+        flex-direction: row;
102
+
103
+        #filmstripRemoteVideosContainer {
104
+            flex-direction: row-reverse;
105
+            /**
106
+             * Add padding as a hack for Firefox not to show scrollbars when
107
+             * unnecessary.
108
+             */
109
+            padding: 1px 0;
110
+            overflow-y: hidden;
111
+        }
112
+    }
113
+
114
+    .videocontainer {
115
+        margin-bottom: 10px;
116
+    }
117
+}
118
+
119
+
120
+/**
121
+ * Workarounds for Edge and Firefox not handling scrolling properly with
122
+ * flex-direction: row-reverse.
123
+ */
124
+ @mixin undoRowReverseVideos() {
125
+    .horizontal-filmstrip {
126
+        #remoteVideos #filmstripRemoteVideos #filmstripRemoteVideosContainer {
127
+            flex-direction: row;
128
+        }
129
+    }
130
+}
131
+
132
+/** Firefox detection hack **/
133
+@-moz-document url-prefix() {
134
+    @include undoRowReverseVideos();
135
+}
136
+
137
+/** Edge detection hack **/
138
+@supports (-ms-ime-align:auto) {
139
+    @include undoRowReverseVideos();
77 140
 }

+ 20
- 65
modules/UI/videolayout/Filmstrip.js 파일 보기

@@ -76,10 +76,6 @@ const Filmstrip = {
76 76
      * @returns {{availableWidth: number, availableHeight: number}}
77 77
      */
78 78
     calculateAvailableSize() {
79
-        const state = APP.store.getState();
80
-        const currentLayout = getCurrentLayout(state);
81
-        const isHorizontalFilmstripView = currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW;
82
-
83 79
         /**
84 80
          * If the videoAreaAvailableWidth is set we use this one to calculate
85 81
          * the filmstrip width, because we're probably in a state where the
@@ -87,70 +83,31 @@ const Filmstrip = {
87 83
          */
88 84
         const videoAreaAvailableWidth
89 85
             = UIUtil.getAvailableVideoWidth()
90
-            - this._getFilmstripExtraPanelsWidth()
91
-            - UIUtil.parseCssInt(this.filmstrip.css('right'), 10)
92
-            - UIUtil.parseCssInt(this.filmstrip.css('paddingLeft'), 10)
93
-            - UIUtil.parseCssInt(this.filmstrip.css('paddingRight'), 10)
94
-            - UIUtil.parseCssInt(this.filmstrip.css('borderLeftWidth'), 10)
95
-            - UIUtil.parseCssInt(this.filmstrip.css('borderRightWidth'), 10)
96
-            - 5;
97
-
98
-        let availableHeight = interfaceConfig.FILM_STRIP_MAX_HEIGHT;
86
+                - this._getFilmstripExtraPanelsWidth()
87
+                - UIUtil.parseCssInt(this.filmstrip.css('right'), 10)
88
+                - UIUtil.parseCssInt(this.filmstrip.css('paddingLeft'), 10)
89
+                - UIUtil.parseCssInt(this.filmstrip.css('paddingRight'), 10)
90
+                - UIUtil.parseCssInt(this.filmstrip.css('borderLeftWidth'), 10)
91
+                - UIUtil.parseCssInt(this.filmstrip.css('borderRightWidth'), 10)
92
+                - 5;
93
+
94
+        const availableHeight = Math.min(interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120, window.innerHeight - 18);
99 95
         let availableWidth = videoAreaAvailableWidth;
100
-        const thumbs = this.getThumbs(true);
96
+        const localVideoContainer = $('#localVideoContainer');
101 97
 
102 98
         // If local thumb is not hidden
103
-        if (thumbs.localThumb) {
104
-            const localVideoContainer = $('#localVideoContainer');
105
-
99
+        if (!localVideoContainer.has('hidden')) {
106 100
             availableWidth = Math.floor(
107 101
                 videoAreaAvailableWidth - (
108
-                    UIUtil.parseCssInt(
109
-                        localVideoContainer.css('borderLeftWidth'), 10)
110
-                    + UIUtil.parseCssInt(
111
-                        localVideoContainer.css('borderRightWidth'), 10)
112
-                    + UIUtil.parseCssInt(
113
-                        localVideoContainer.css('paddingLeft'), 10)
114
-                    + UIUtil.parseCssInt(
115
-                        localVideoContainer.css('paddingRight'), 10)
116
-                    + UIUtil.parseCssInt(
117
-                        localVideoContainer.css('marginLeft'), 10)
118
-                    + UIUtil.parseCssInt(
119
-                        localVideoContainer.css('marginRight'), 10))
102
+                    UIUtil.parseCssInt(localVideoContainer.css('borderLeftWidth'), 10)
103
+                    + UIUtil.parseCssInt(localVideoContainer.css('borderRightWidth'), 10)
104
+                    + UIUtil.parseCssInt(localVideoContainer.css('paddingLeft'), 10)
105
+                    + UIUtil.parseCssInt(localVideoContainer.css('paddingRight'), 10)
106
+                    + UIUtil.parseCssInt(localVideoContainer.css('marginLeft'), 10)
107
+                    + UIUtil.parseCssInt(localVideoContainer.css('marginRight'), 10))
120 108
             );
121 109
         }
122 110
 
123
-        // If the number of videos is 0 or undefined or we're not in horizontal
124
-        // filmstrip mode we don't need to calculate further any adjustments
125
-        // to width based on the number of videos present.
126
-        const numvids = thumbs.remoteThumbs.length;
127
-
128
-        if (numvids && isHorizontalFilmstripView) {
129
-            const remoteVideoContainer = thumbs.remoteThumbs.eq(0);
130
-
131
-            availableWidth = Math.floor(
132
-                videoAreaAvailableWidth - (numvids * (
133
-                    UIUtil.parseCssInt(
134
-                        remoteVideoContainer.css('borderLeftWidth'), 10)
135
-                    + UIUtil.parseCssInt(
136
-                        remoteVideoContainer.css('borderRightWidth'), 10)
137
-                    + UIUtil.parseCssInt(
138
-                        remoteVideoContainer.css('paddingLeft'), 10)
139
-                    + UIUtil.parseCssInt(
140
-                        remoteVideoContainer.css('paddingRight'), 10)
141
-                    + UIUtil.parseCssInt(
142
-                        remoteVideoContainer.css('marginLeft'), 10)
143
-                    + UIUtil.parseCssInt(
144
-                        remoteVideoContainer.css('marginRight'), 10)))
145
-            );
146
-        }
147
-
148
-        // If the MAX_HEIGHT property hasn't been specified
149
-        // we have the static value.
150
-        const maxHeight = Math.min(interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120, availableHeight);
151
-
152
-        availableHeight = Math.min(maxHeight, window.innerHeight - 18);
153
-
154 111
         return {
155 112
             availableHeight,
156 113
             availableWidth
@@ -231,10 +188,8 @@ const Filmstrip = {
231 188
          * availableHeight/h > availableWidth/totalWidth otherwise 2) is true
232 189
          */
233 190
 
234
-        const remoteThumbsInRow = interfaceConfig.VERTICAL_FILMSTRIP ? 0 : this.getThumbs(true).remoteThumbs.length;
235 191
         const remoteLocalWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
236
-        const lW = Math.min(availableWidth / ((remoteLocalWidthRatio * remoteThumbsInRow) + 1),
237
-            availableHeight * interfaceConfig.LOCAL_THUMBNAIL_RATIO);
192
+        const lW = Math.min(availableWidth, availableHeight * interfaceConfig.LOCAL_THUMBNAIL_RATIO);
238 193
         const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;
239 194
 
240 195
         const remoteVideoWidth = lW * remoteLocalWidthRatio;
@@ -378,8 +333,8 @@ const Filmstrip = {
378 333
             });
379 334
         } else if (currentLayout === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
380 335
             this.filmstrip.css({
381
-                // adds 4 px because of small video 2px border
382
-                height: `${remote.thumbHeight + 4}px`
336
+                // adds 4 px because of small video 2px border and 10px margin for the scroll
337
+                height: `${remote.thumbHeight + 14}px`
383 338
             });
384 339
         }
385 340
 

Loading…
취소
저장