2017-11-07 14:28:08 +00:00
|
|
|
// @flow
|
2017-10-13 16:13:46 +00:00
|
|
|
|
|
|
|
import { SET_ASPECT_RATIO } from './actionTypes';
|
|
|
|
import { ASPECT_RATIO_NARROW, ASPECT_RATIO_WIDE } from './constants';
|
|
|
|
|
|
|
|
/**
|
2017-11-07 14:28:08 +00:00
|
|
|
* Sets the aspect ratio of the app's user interface based on specific width and
|
|
|
|
* height.
|
2017-10-13 16:13:46 +00:00
|
|
|
*
|
2017-11-07 14:28:08 +00:00
|
|
|
* @param {number} width - The width of the app's user interface.
|
|
|
|
* @param {number} height - The height of the app's user interface.
|
2017-10-13 16:13:46 +00:00
|
|
|
* @returns {{
|
|
|
|
* type: SET_ASPECT_RATIO,
|
|
|
|
* aspectRatio: Symbol
|
|
|
|
* }}
|
|
|
|
*/
|
2017-11-07 14:28:08 +00:00
|
|
|
export function setAspectRatio(width: number, height: number): Object {
|
2017-10-13 16:13:46 +00:00
|
|
|
return {
|
|
|
|
type: SET_ASPECT_RATIO,
|
2017-11-07 14:28:08 +00:00
|
|
|
aspectRatio: width < height ? ASPECT_RATIO_NARROW : ASPECT_RATIO_WIDE
|
2017-10-13 16:13:46 +00:00
|
|
|
};
|
|
|
|
}
|