use number for aspect ratio

This commit is contained in:
ThatOneCalculator 2023-10-03 00:39:00 -07:00
parent 6425afbfce
commit 1d50beb552
No known key found for this signature in database
GPG key ID: 8703CACD01000000
3 changed files with 5 additions and 5 deletions

View file

@ -22,7 +22,7 @@
ref="cropper"
:img="imgUrl"
:options="{
aspectRatio: aspectRatio ? aspectRatio[0] / aspectRatio[1] : null,
aspectRatio: aspectRatio ?? null,
viewMode: 1,
}"
></VuePictureCropper>
@ -52,7 +52,7 @@ const emit = defineEmits<{
const props = defineProps<{
file: firefish.entities.DriveFile;
aspectRatio?: Array<number>;
aspectRatio?: number;
}>();
const imgUrl = `${url}/proxy/image.webp?${query({

View file

@ -747,7 +747,7 @@ export async function pickEmoji(src: HTMLElement | null, opts) {
export async function cropImage(
image: firefish.entities.DriveFile,
options?: {
aspectRatio?: Array<number>;
aspectRatio?: number;
},
): Promise<firefish.entities.DriveFile> {
return new Promise((resolve, reject) => {

View file

@ -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,
});
}