From 1d50beb55248faaf8bd4e40c450df1e2981127a7 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 3 Oct 2023 00:39:00 -0700 Subject: [PATCH] use number for aspect ratio --- packages/client/src/components/MkCropperDialog.vue | 4 ++-- packages/client/src/os.ts | 2 +- packages/client/src/pages/settings/profile.vue | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/MkCropperDialog.vue b/packages/client/src/components/MkCropperDialog.vue index 4f65268505..9731a64c34 100644 --- a/packages/client/src/components/MkCropperDialog.vue +++ b/packages/client/src/components/MkCropperDialog.vue @@ -22,7 +22,7 @@ ref="cropper" :img="imgUrl" :options="{ - aspectRatio: aspectRatio ? aspectRatio[0] / aspectRatio[1] : null, + aspectRatio: aspectRatio ?? null, viewMode: 1, }" > @@ -52,7 +52,7 @@ const emit = defineEmits<{ const props = defineProps<{ file: firefish.entities.DriveFile; - aspectRatio?: Array; + aspectRatio?: number; }>(); const imgUrl = `${url}/proxy/image.webp?${query({ diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 9279098a7b..c4091e91a6 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -747,7 +747,7 @@ export async function pickEmoji(src: HTMLElement | null, opts) { export async function cropImage( image: firefish.entities.DriveFile, options?: { - aspectRatio?: Array; + aspectRatio?: number; }, ): Promise { return new Promise((resolve, reject) => { diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 5d5aedb19e..e3e4476b92 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -257,7 +257,7 @@ function changeAvatar(ev) { if (!canceled) { originalOrCropped = await os.cropImage(file, { - aspectRatio: [1, 1], + aspectRatio: 1, }); } @@ -282,7 +282,7 @@ function changeBanner(ev) { if (!canceled) { originalOrCropped = await os.cropImage(file, { - aspectRatio: [16, 9], + aspectRatio: 16 / 9, }); }