mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-03-28 11:13:16 +00:00
fix: cropping images decreases resolution
This commit is contained in:
parent
1e1c38ffc0
commit
a6b444fcea
2 changed files with 11 additions and 9 deletions
|
|
@ -32,10 +32,10 @@ export default function CropPortrait({ isOpen, setIsOpen, image, setImage }: Pro
|
|||
const scaleX = image.naturalWidth / image.width;
|
||||
const scaleY = image.naturalHeight / image.height;
|
||||
|
||||
canvas.width = crop.width;
|
||||
canvas.height = crop.height;
|
||||
canvas.width = crop.width * scaleX;
|
||||
canvas.height = crop.height * scaleY;
|
||||
|
||||
ctx.drawImage(image, crop.x * scaleX, crop.y * scaleY, crop.width * scaleX, crop.height * scaleY, 0, 0, crop.width, crop.height);
|
||||
ctx.drawImage(image, crop.x * scaleX, crop.y * scaleY, crop.width * scaleX, crop.height * scaleY, 0, 0, crop.width * scaleX, crop.height * scaleY);
|
||||
|
||||
setImage(canvas.toDataURL());
|
||||
close();
|
||||
|
|
|
|||
|
|
@ -282,12 +282,14 @@ export const switchMiiInstructionsSchema = z
|
|||
height: z.number().int().min(0).max(128).optional(),
|
||||
weight: z.number().int().min(0).max(128).optional(),
|
||||
datingPreferences: z.array(z.enum(MiiGender)).optional(),
|
||||
birthday: z.object({
|
||||
day: z.number().int().min(1).max(31).optional(),
|
||||
month: z.number().int().min(1).max(12).optional(),
|
||||
age: z.number().int().min(1).max(100).optional(),
|
||||
dontAge: z.boolean().optional(),
|
||||
}),
|
||||
birthday: z
|
||||
.object({
|
||||
day: z.number().int().min(1).max(31).optional(),
|
||||
month: z.number().int().min(1).max(12).optional(),
|
||||
age: z.number().int().min(1).max(100).optional(),
|
||||
dontAge: z.boolean().optional(),
|
||||
})
|
||||
.optional(),
|
||||
voice: z
|
||||
.object({
|
||||
speed: z.number().int().min(0).max(50).optional(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue