From bf7aee19b8fc0dfb31376f814d883b654b5db8a1 Mon Sep 17 00:00:00 2001 From: Piotr P Date: Sat, 27 Apr 2024 14:59:00 +0200 Subject: [PATCH] add missing cropImageUtil file --- src/view/com/modals/crop-image/cropImageUtil.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/view/com/modals/crop-image/cropImageUtil.ts 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 00000000..303d15ba --- /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, + } +}