Quellcode durchsuchen

fix(video-layout): functions imports.

master
Hristo Terezov vor 3 Jahren
Ursprung
Commit
2a5be074d0

react/features/video-layout/functions.js → react/features/video-layout/functions.any.js Datei anzeigen

@@ -7,16 +7,6 @@ import {
7 7
     getParticipantCount,
8 8
     pinParticipant
9 9
 } from '../base/participants';
10
-import {
11
-    DEFAULT_MAX_COLUMNS,
12
-    ABSOLUTE_MAX_COLUMNS,
13
-    TILE_PORTRAIT_ASPECT_RATIO
14
-} from '../filmstrip/constants';
15
-import {
16
-    getNumberOfPartipantsForTileView,
17
-    getThumbnailMinHeight,
18
-    getTileDefaultAspectRatio
19
-} from '../filmstrip/functions.web';
20 10
 import { isVideoPlaying } from '../shared-video/functions';
21 11
 import { VIDEO_QUALITY_LEVELS } from '../video-quality/constants';
22 12
 
@@ -56,78 +46,6 @@ export function getCurrentLayout(state: Object) {
56 46
     return LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW;
57 47
 }
58 48
 
59
-/**
60
- * Returns how many columns should be displayed in tile view. The number
61
- * returned will be between 1 and 7, inclusive.
62
- *
63
- * @param {Object} state - The redux store state.
64
- * @param {Object} options - Object with custom values used to override the values that we get from redux by default.
65
- * @param {number} options.width - Custom width to be used.
66
- * @param {boolean} options.disableResponsiveTiles - Custom value to be used instead of config.disableResponsiveTiles.
67
- * @param {boolean} options.disableTileEnlargement - Custom value to be used instead of config.disableTileEnlargement.
68
- * @returns {number}
69
- */
70
-export function getMaxColumnCount(state, options = {}) {
71
-    if (typeof interfaceConfig === 'undefined') {
72
-        return DEFAULT_MAX_COLUMNS;
73
-    }
74
-
75
-    const {
76
-        disableResponsiveTiles: configDisableResponsiveTiles,
77
-        disableTileEnlargement: configDisableTileEnlargement
78
-    } = state['features/base/config'];
79
-    const {
80
-        width,
81
-        disableResponsiveTiles = configDisableResponsiveTiles,
82
-        disableTileEnlargement = configDisableTileEnlargement
83
-    } = options;
84
-    const { clientWidth } = state['features/base/responsive-ui'];
85
-    const widthToUse = width || clientWidth;
86
-    const configuredMax = interfaceConfig.TILE_VIEW_MAX_COLUMNS;
87
-
88
-    if (disableResponsiveTiles) {
89
-        return Math.min(Math.max(configuredMax || DEFAULT_MAX_COLUMNS, 1), ABSOLUTE_MAX_COLUMNS);
90
-    }
91
-
92
-    if (typeof interfaceConfig.TILE_VIEW_MAX_COLUMNS !== 'undefined' && interfaceConfig.TILE_VIEW_MAX_COLUMNS > 0) {
93
-        return Math.max(configuredMax, 1);
94
-    }
95
-
96
-    const aspectRatio = disableTileEnlargement
97
-        ? getTileDefaultAspectRatio(true, disableTileEnlargement, widthToUse)
98
-        : TILE_PORTRAIT_ASPECT_RATIO;
99
-    const minHeight = getThumbnailMinHeight(widthToUse);
100
-    const minWidth = aspectRatio * minHeight;
101
-
102
-    return Math.floor(widthToUse / minWidth);
103
-}
104
-
105
-/**
106
- * Returns the cell count dimensions for tile view. Tile view tries to uphold
107
- * equal count of tiles for height and width, until maxColumn is reached in
108
- * which rows will be added but no more columns.
109
- *
110
- * @param {Object} state - The redux store state.
111
- * @param {boolean} stageFilmstrip - Whether the dimensions should be calculated for the stage filmstrip.
112
- * @returns {Object} An object is return with the desired number of columns,
113
- * rows, and visible rows (the rest should overflow) for the tile view layout.
114
- */
115
-export function getNotResponsiveTileViewGridDimensions(state: Object, stageFilmstrip: boolean = false) {
116
-    const maxColumns = getMaxColumnCount(state);
117
-    const { activeParticipants } = state['features/filmstrip'];
118
-    const numberOfParticipants = stageFilmstrip ? activeParticipants.length : getNumberOfPartipantsForTileView(state);
119
-    const columnsToMaintainASquare = Math.ceil(Math.sqrt(numberOfParticipants));
120
-    const columns = Math.min(columnsToMaintainASquare, maxColumns);
121
-    const rows = Math.ceil(numberOfParticipants / columns);
122
-    const minVisibleRows = Math.min(maxColumns, rows);
123
-
124
-    return {
125
-        columns,
126
-        minVisibleRows,
127
-        rows
128
-    };
129
-}
130
-
131 49
 /**
132 50
  * Selector for determining if the UI layout should be in tile view. Tile view
133 51
  * is determined by more than just having the tile view setting enabled, as

+ 1
- 0
react/features/video-layout/functions.native.js Datei anzeigen

@@ -0,0 +1 @@
1
+export * from './functions.any';

+ 86
- 0
react/features/video-layout/functions.web.js Datei anzeigen

@@ -0,0 +1,86 @@
1
+import {
2
+    DEFAULT_MAX_COLUMNS,
3
+    ABSOLUTE_MAX_COLUMNS,
4
+    TILE_PORTRAIT_ASPECT_RATIO
5
+} from '../filmstrip/constants';
6
+import {
7
+    getNumberOfPartipantsForTileView,
8
+    getThumbnailMinHeight,
9
+    getTileDefaultAspectRatio
10
+} from '../filmstrip/functions';
11
+
12
+export * from './functions.any';
13
+
14
+declare var interfaceConfig: Object;
15
+
16
+/**
17
+ * Returns how many columns should be displayed in tile view. The number
18
+ * returned will be between 1 and 7, inclusive.
19
+ *
20
+ * @param {Object} state - The redux store state.
21
+ * @param {Object} options - Object with custom values used to override the values that we get from redux by default.
22
+ * @param {number} options.width - Custom width to be used.
23
+ * @param {boolean} options.disableResponsiveTiles - Custom value to be used instead of config.disableResponsiveTiles.
24
+ * @param {boolean} options.disableTileEnlargement - Custom value to be used instead of config.disableTileEnlargement.
25
+ * @returns {number}
26
+ */
27
+export function getMaxColumnCount(state, options = {}) {
28
+    if (typeof interfaceConfig === 'undefined') {
29
+        return DEFAULT_MAX_COLUMNS;
30
+    }
31
+
32
+    const {
33
+        disableResponsiveTiles: configDisableResponsiveTiles,
34
+        disableTileEnlargement: configDisableTileEnlargement
35
+    } = state['features/base/config'];
36
+    const {
37
+        width,
38
+        disableResponsiveTiles = configDisableResponsiveTiles,
39
+        disableTileEnlargement = configDisableTileEnlargement
40
+    } = options;
41
+    const { clientWidth } = state['features/base/responsive-ui'];
42
+    const widthToUse = width || clientWidth;
43
+    const configuredMax = interfaceConfig.TILE_VIEW_MAX_COLUMNS;
44
+
45
+    if (disableResponsiveTiles) {
46
+        return Math.min(Math.max(configuredMax || DEFAULT_MAX_COLUMNS, 1), ABSOLUTE_MAX_COLUMNS);
47
+    }
48
+
49
+    if (typeof interfaceConfig.TILE_VIEW_MAX_COLUMNS !== 'undefined' && interfaceConfig.TILE_VIEW_MAX_COLUMNS > 0) {
50
+        return Math.max(configuredMax, 1);
51
+    }
52
+
53
+    const aspectRatio = disableTileEnlargement
54
+        ? getTileDefaultAspectRatio(true, disableTileEnlargement, widthToUse)
55
+        : TILE_PORTRAIT_ASPECT_RATIO;
56
+    const minHeight = getThumbnailMinHeight(widthToUse);
57
+    const minWidth = aspectRatio * minHeight;
58
+
59
+    return Math.floor(widthToUse / minWidth);
60
+}
61
+
62
+/**
63
+ * Returns the cell count dimensions for tile view. Tile view tries to uphold
64
+ * equal count of tiles for height and width, until maxColumn is reached in
65
+ * which rows will be added but no more columns.
66
+ *
67
+ * @param {Object} state - The redux store state.
68
+ * @param {boolean} stageFilmstrip - Whether the dimensions should be calculated for the stage filmstrip.
69
+ * @returns {Object} An object is return with the desired number of columns,
70
+ * rows, and visible rows (the rest should overflow) for the tile view layout.
71
+ */
72
+export function getNotResponsiveTileViewGridDimensions(state: Object, stageFilmstrip: boolean = false) {
73
+    const maxColumns = getMaxColumnCount(state);
74
+    const { activeParticipants } = state['features/filmstrip'];
75
+    const numberOfParticipants = stageFilmstrip ? activeParticipants.length : getNumberOfPartipantsForTileView(state);
76
+    const columnsToMaintainASquare = Math.ceil(Math.sqrt(numberOfParticipants));
77
+    const columns = Math.min(columnsToMaintainASquare, maxColumns);
78
+    const rows = Math.ceil(numberOfParticipants / columns);
79
+    const minVisibleRows = Math.min(maxColumns, rows);
80
+
81
+    return {
82
+        columns,
83
+        minVisibleRows,
84
+        rows
85
+    };
86
+}

Laden…
Abbrechen
Speichern