Skip to content

Commit 854d52e

Browse files
committed
fix: 修复旋转中心点
1 parent 0e732d3 commit 854d52e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/web/src/components/modals/ImageCropper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ function getCroppedImg(
9797
canvas.height = scale * crop.height;
9898

9999
// translate canvas context to a central location on image to allow rotating around the center.
100-
ctx.translate(canvas.width / 2, canvas.width / 2);
100+
ctx.translate(canvas.width / 2, canvas.height / 2);
101101
ctx.rotate(getRadianAngle(rotation));
102-
ctx.translate(-canvas.width / 2, -canvas.width / 2);
102+
ctx.translate(-canvas.width / 2, -canvas.height / 2);
103103

104104
// draw rotated image and store data.
105105
ctx.drawImage(

0 commit comments

Comments
 (0)