您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.web.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // @flow
  2. import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { CLIENT_RESIZED } from '../base/responsive-ui';
  5. import {
  6. getCurrentLayout,
  7. LAYOUTS,
  8. shouldDisplayTileView
  9. } from '../video-layout';
  10. import { SET_HORIZONTAL_VIEW_DIMENSIONS, SET_TILE_VIEW_DIMENSIONS } from './actionTypes';
  11. import { setHorizontalViewDimensions, setTileViewDimensions } from './actions.web';
  12. import './subscriber.web';
  13. /**
  14. * The middleware of the feature Filmstrip.
  15. */
  16. MiddlewareRegistry.register(store => next => action => {
  17. const result = next(action);
  18. switch (action.type) {
  19. case CLIENT_RESIZED: {
  20. const state = store.getState();
  21. const layout = getCurrentLayout(state);
  22. switch (layout) {
  23. case LAYOUTS.TILE_VIEW: {
  24. const { gridDimensions } = state['features/filmstrip'].tileViewDimensions;
  25. const { clientHeight, clientWidth } = state['features/base/responsive-ui'];
  26. const { isOpen } = state['features/chat'];
  27. const { visible } = state['features/toolbox'];
  28. store.dispatch(
  29. setTileViewDimensions(
  30. gridDimensions,
  31. {
  32. clientHeight,
  33. clientWidth
  34. },
  35. isOpen,
  36. visible
  37. )
  38. );
  39. break;
  40. }
  41. case LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW:
  42. store.dispatch(setHorizontalViewDimensions(state['features/base/responsive-ui'].clientHeight));
  43. break;
  44. }
  45. break;
  46. }
  47. case SET_TILE_VIEW_DIMENSIONS: {
  48. const state = store.getState();
  49. if (shouldDisplayTileView(state)) {
  50. const { width, height } = state['features/filmstrip'].tileViewDimensions.thumbnailSize;
  51. // Once the thumbnails are reactified this should be moved there too.
  52. Filmstrip.resizeThumbnailsForTileView(width, height, true);
  53. }
  54. break;
  55. }
  56. case SET_HORIZONTAL_VIEW_DIMENSIONS: {
  57. const state = store.getState();
  58. if (getCurrentLayout(state) === LAYOUTS.HORIZONTAL_FILMSTRIP_VIEW) {
  59. const { horizontalViewDimensions = {} } = state['features/filmstrip'];
  60. // Once the thumbnails are reactified this should be moved there too.
  61. Filmstrip.resizeThumbnailsForHorizontalView(horizontalViewDimensions, true);
  62. }
  63. break;
  64. }
  65. }
  66. return result;
  67. });