about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPiotr P <piotr.palek@housecallpro.com>2024-04-27 14:59:00 +0200
committerPiotr P <piotr.palek@housecallpro.com>2024-04-27 14:59:00 +0200
commitbf7aee19b8fc0dfb31376f814d883b654b5db8a1 (patch)
tree568c7ba796bb75a141d64ea6adb64819caefab2e /src
parentbeddddcb579b7bd0a6f4d7d2a014a92a5399f3c6 (diff)
downloadvoidsky-bf7aee19b8fc0dfb31376f814d883b654b5db8a1.tar.zst
add missing cropImageUtil file
Diffstat (limited to 'src')
-rw-r--r--src/view/com/modals/crop-image/cropImageUtil.ts13
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,
+  }
+}