Added media_aspect_ratio util
This commit is contained in:
parent
a8bef0faab
commit
5f366a013a
17
app/javascript/gabsocial/utils/media_aspect_ratio.js
Normal file
17
app/javascript/gabsocial/utils/media_aspect_ratio.js
Normal file
@ -0,0 +1,17 @@
|
||||
export const minimumAspectRatio = .8;
|
||||
export const maximumAspectRatio = 2.8;
|
||||
|
||||
export const isPanoramic = ar => {
|
||||
if (isNaN(ar)) return false;
|
||||
return ar >= maximumAspectRatio;
|
||||
}
|
||||
|
||||
export const isPortrait = ar => {
|
||||
if (isNaN(ar)) return false;
|
||||
return ar <= minimumAspectRatio;
|
||||
}
|
||||
|
||||
export const isNonConformingRatio = ar => {
|
||||
if (isNaN(ar)) return false;
|
||||
return !isPanoramic(ar) && !isPortrait(ar);
|
||||
}
|
Loading…
Reference in New Issue
Block a user