mirror of https://github.com/tooot-app/app
Fix too thin images
This commit is contained in:
parent
b52b529550
commit
34c0bbf4bb
|
@ -9,7 +9,12 @@ export const aspectRatio = ({
|
|||
width?: number
|
||||
height?: number
|
||||
}): number => {
|
||||
const cropTooTall = (height || 1) / (width || 1) > 3 / 2 ? 2 / 3 : (width || 1) / (height || 1)
|
||||
const defaultCrop =
|
||||
(height || 1) / (width || 1) > 3 / 2
|
||||
? 2 / 3
|
||||
: (width || 1) / (height || 1) > 4
|
||||
? 4
|
||||
: (width || 1) / (height || 1)
|
||||
|
||||
const isEven = total % 2 == 0
|
||||
if (total > 5) {
|
||||
|
@ -26,12 +31,12 @@ export const aspectRatio = ({
|
|||
} else {
|
||||
switch (isEven) {
|
||||
case true:
|
||||
return cropTooTall
|
||||
return defaultCrop
|
||||
case false:
|
||||
if ((index || -2) + 1 == total) {
|
||||
return cropTooTall * 2
|
||||
return defaultCrop * 2
|
||||
} else {
|
||||
return cropTooTall
|
||||
return defaultCrop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue