| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // @flow
-
- import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
- import { calculateThumbnailSizeForHorizontalView, calculateThumbnailSizeForTileView } from './functions';
-
- // dev mod
- import { getTileViewGridDimensions } from '../video-layout';
- window.glob_react.getTileViewGridDimensions = getTileViewGridDimensions
- // clog("window.glob_react",window.glob_react)
- // import { getCurrentLayout, getTileViewGridDimensions, shouldDisplayTileView, LAYOUTS } from '../video-layout';
-
- /**
- * The size of the side margins for each tile as set in CSS.
- */
- const TILE_VIEW_SIDE_MARGINS = 10 * 2;
-
- /**
- * Sets the dimensions of the tile view grid.
- *
- * @param {Object} dimensions - Whether the filmstrip is visible.
- * @param {Object} windowSize - The size of the window.
- * @returns {{
- * type: SET_TILE_VIEW_DIMENSIONS,
- * dimensions: Object
- * }}
- */
- export function setTileViewDimensions(dimensions: Object, windowSize: Object) {
- // dev hook
- if (window.glob_dev_fns && window.glob_dev_fns.setTileViewDimensions){
- // var ret = window.glob_dev_fns.setTileViewDimensions.apply(this,...arguments)
- var ret = window.glob_dev_fns.setTileViewDimensions({that:this,args:arguments})
- if (ret){
- if (ret.ret){
- return ret.ret
- } else {
- ret.dimensions ? dimensions = ret.dimensions : 0
- ret.windowSize ? windowSize = ret.windowSize : 0
- // if (ret.dimensions){}
-
- }
-
- }
- clog("STV.",SET_TILE_VIEW_DIMENSIONS,TILE_VIEW_SIDE_MARGINS)
- }
-
- const thumbnailSize = calculateThumbnailSizeForTileView({
- ...dimensions,
- ...windowSize
- });
- var TILE_VIEW_SIDE_MARGINS = 10 * 2;
- if (window.TILE_VIEW_SIDE_MARGINS){
- TILE_VIEW_SIDE_MARGINS = window.TILE_VIEW_SIDE_MARGINS
- }
- const filmstripWidth = dimensions.columns * (TILE_VIEW_SIDE_MARGINS + thumbnailSize.width);
-
- return {
- type: SET_TILE_VIEW_DIMENSIONS,
- dimensions: {
- gridDimensions: dimensions,
- xtra:"xtra_val",
- thumbnailSize,
- filmstripWidth
- }
- };
- }
-
- /**
- * Sets the dimensions of the thumbnails in horizontal view.
- *
- * @param {number} clientHeight - The height of the window.
- * @returns {{
- * type: SET_HORIZONTAL_VIEW_DIMENSIONS,
- * dimensions: Object
- * }}
- */
- export function setHorizontalViewDimensions(clientHeight: number = 0) {
- return {
- type: SET_HORIZONTAL_VIEW_DIMENSIONS,
- dimensions: calculateThumbnailSizeForHorizontalView(clientHeight)
- };
- }
-
- export * from './actions.native';
|