chore: cleanup

This commit is contained in:
Nathan Walker
2020-07-06 14:25:11 -07:00
parent 94cf5c4706
commit 6336eac4b5
477 changed files with 59087 additions and 74961 deletions

View File

@@ -1,27 +1,23 @@
export function getScaledDimensions(
width: number,
height: number,
maxSize: number
) {
if (height >= width) {
if (height <= maxSize) {
// if image already smaller than the required height
return { width, height };
}
export function getScaledDimensions(width: number, height: number, maxSize: number) {
if (height >= width) {
if (height <= maxSize) {
// if image already smaller than the required height
return { width, height };
}
return {
width: Math.round((maxSize * width) / height),
height: maxSize,
};
}
return {
width: Math.round((maxSize * width) / height),
height: maxSize,
};
}
if (width <= maxSize) {
// if image already smaller than the required width
return { width, height };
}
if (width <= maxSize) {
// if image already smaller than the required width
return { width, height };
}
return {
width: maxSize,
height: Math.round((maxSize * height) / width),
};
return {
width: maxSize,
height: Math.round((maxSize * height) / width),
};
}