You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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. }