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

actions.js 680B

12345678910111213141516171819202122
  1. /* @flow */
  2. import { SET_ASPECT_RATIO } from './actionTypes';
  3. import { ASPECT_RATIO_NARROW, ASPECT_RATIO_WIDE } from './constants';
  4. /**
  5. * Calculates new aspect ratio for the app based on provided width and height
  6. * values.
  7. *
  8. * @param {number} width - The width of the app's area used on the screen.
  9. * @param {number} height - The height of the app's area used on the screen.
  10. * @returns {{
  11. * type: SET_ASPECT_RATIO,
  12. * aspectRatio: Symbol
  13. * }}
  14. */
  15. export function calculateNewAspectRatio(width: number, height: number): Object {
  16. return {
  17. type: SET_ASPECT_RATIO,
  18. aspectRatio: width > height ? ASPECT_RATIO_WIDE : ASPECT_RATIO_NARROW
  19. };
  20. }