Skip to content

Commit 94e0735

Browse files
paodbjavier-godoy
authored andcommitted
fix: update canvas size to avoid white space on result
Close #7
1 parent 860226f commit 94e0735

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/resources/META-INF/resources/frontend/src/image-crop.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ class ImageCropElement extends ReactAdapterElement {
8989
const scaleY = image.naturalHeight / image.height;
9090
const ctx = canvas.getContext("2d");
9191
const pixelRatio = window.devicePixelRatio;
92-
canvas.width = ccrop.width * pixelRatio * scaleX;
93-
canvas.height = ccrop.height * pixelRatio * scaleY;
92+
canvas.width = ccrop.width * pixelRatio;
93+
canvas.height = ccrop.height * pixelRatio;
9494

9595
if (ctx) {
9696
ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);

0 commit comments

Comments
 (0)