bigbuffet-rw/app/soapbox/utils/media-aspect-ratio.ts
2022-12-22 21:06:27 -06:00

17 lines
472 B
TypeScript

export const minimumAspectRatio = 1; // Square
export const maximumAspectRatio = 10; // Generous min-height
export const isPanoramic = (ar: number) => {
if (isNaN(ar)) return false;
return ar >= maximumAspectRatio;
};
export const isPortrait = (ar: number) => {
if (isNaN(ar)) return false;
return ar <= minimumAspectRatio;
};
export const isNonConformingRatio = (ar: number) => {
if (isNaN(ar)) return false;
return !isPanoramic(ar) && !isPortrait(ar);
};