diff options
author | Piotr P <piotr.palek@housecallpro.com> | 2024-04-27 14:59:00 +0200 |
---|---|---|
committer | Piotr P <piotr.palek@housecallpro.com> | 2024-04-27 14:59:00 +0200 |
commit | bf7aee19b8fc0dfb31376f814d883b654b5db8a1 (patch) | |
tree | 568c7ba796bb75a141d64ea6adb64819caefab2e /src | |
parent | beddddcb579b7bd0a6f4d7d2a014a92a5399f3c6 (diff) | |
download | voidsky-bf7aee19b8fc0dfb31376f814d883b654b5db8a1.tar.zst |
add missing cropImageUtil file
Diffstat (limited to 'src')
-rw-r--r-- | src/view/com/modals/crop-image/cropImageUtil.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/view/com/modals/crop-image/cropImageUtil.ts b/src/view/com/modals/crop-image/cropImageUtil.ts new file mode 100644 index 000000000..303d15ba5 --- /dev/null +++ b/src/view/com/modals/crop-image/cropImageUtil.ts @@ -0,0 +1,13 @@ +export const calculateDimensions = ( + maxWidth: number, + originalHeight: number, + originalWidth: number, +) => { + const aspectRatio = originalWidth / originalHeight + const newHeight = maxWidth / aspectRatio + const newWidth = maxWidth + return { + width: newWidth, + height: newHeight, + } +} |