Skip to content
Prev Previous commit
Next Next commit
fix: 可以正确旋转了
  • Loading branch information
hxg2050 committed Jan 11, 2024
commit 0e732d33031da9c26cb56c8a80dfec733f387d5d
12 changes: 6 additions & 6 deletions client/web/src/components/modals/ImageCropper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ function getCroppedImg(
// draw rotated image and store data.
ctx.drawImage(
image,
crop.x,
crop.y,
crop.width,
crop.height,
0,
0,
canvas.width,
canvas.height
image.width,
image.height,
-crop.x * scale,
-crop.y * scale,
image.width * scale,
image.height * scale
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is design for common image cropper not only for avatar. for example: group background.

maybe you can check component in client/web/src/components/ImageUploader.tsx#AvatarUploader

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, understanding

}

Expand Down