use number for aspect ratio
This commit is contained in:
parent
6425afbfce
commit
1d50beb552
3 changed files with 5 additions and 5 deletions
|
@ -22,7 +22,7 @@
|
||||||
ref="cropper"
|
ref="cropper"
|
||||||
:img="imgUrl"
|
:img="imgUrl"
|
||||||
:options="{
|
:options="{
|
||||||
aspectRatio: aspectRatio ? aspectRatio[0] / aspectRatio[1] : null,
|
aspectRatio: aspectRatio ?? null,
|
||||||
viewMode: 1,
|
viewMode: 1,
|
||||||
}"
|
}"
|
||||||
></VuePictureCropper>
|
></VuePictureCropper>
|
||||||
|
@ -52,7 +52,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
file: firefish.entities.DriveFile;
|
file: firefish.entities.DriveFile;
|
||||||
aspectRatio?: Array<number>;
|
aspectRatio?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const imgUrl = `${url}/proxy/image.webp?${query({
|
const imgUrl = `${url}/proxy/image.webp?${query({
|
||||||
|
|
|
@ -747,7 +747,7 @@ export async function pickEmoji(src: HTMLElement | null, opts) {
|
||||||
export async function cropImage(
|
export async function cropImage(
|
||||||
image: firefish.entities.DriveFile,
|
image: firefish.entities.DriveFile,
|
||||||
options?: {
|
options?: {
|
||||||
aspectRatio?: Array<number>;
|
aspectRatio?: number;
|
||||||
},
|
},
|
||||||
): Promise<firefish.entities.DriveFile> {
|
): Promise<firefish.entities.DriveFile> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -257,7 +257,7 @@ function changeAvatar(ev) {
|
||||||
|
|
||||||
if (!canceled) {
|
if (!canceled) {
|
||||||
originalOrCropped = await os.cropImage(file, {
|
originalOrCropped = await os.cropImage(file, {
|
||||||
aspectRatio: [1, 1],
|
aspectRatio: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ function changeBanner(ev) {
|
||||||
|
|
||||||
if (!canceled) {
|
if (!canceled) {
|
||||||
originalOrCropped = await os.cropImage(file, {
|
originalOrCropped = await os.cropImage(file, {
|
||||||
aspectRatio: [16, 9],
|
aspectRatio: 16 / 9,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue