bigbuffet-rw/app/soapbox/utils/media_aspect_ratio.js

18 lines
411 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
export const minimumAspectRatio = .8;
export const maximumAspectRatio = 2.8;
export const isPanoramic = ar => {
if (isNaN(ar)) return false;
return ar >= maximumAspectRatio;
2020-04-14 11:44:40 -07:00
};
2020-03-27 13:59:38 -07:00
export const isPortrait = ar => {
if (isNaN(ar)) return false;
return ar <= minimumAspectRatio;
2020-04-14 11:44:40 -07:00
};
2020-03-27 13:59:38 -07:00
export const isNonConformingRatio = ar => {
if (isNaN(ar)) return false;
return !isPanoramic(ar) && !isPortrait(ar);
2020-04-14 11:44:40 -07:00
};