Skip to content

Commit 685996d

Browse files
souheTrancever
authored andcommitted
fix: image scaling on android (#42)
1 parent a9681f6 commit 685996d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorModule.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ private Bitmap cropAndResize(
363363
}
364364
}
365365

366-
int cropX = (int) Math.floor(newX / (float) outOptions.inSampleSize);
367-
int cropY = (int) Math.floor(newY / (float) outOptions.inSampleSize);
368-
int cropWidth = (int) Math.floor(newWidth / (float) outOptions.inSampleSize);
369-
int cropHeight = (int) Math.floor(newHeight / (float) outOptions.inSampleSize);
366+
int cropX = Math.round(newX / (float) outOptions.inSampleSize);
367+
int cropY = Math.round(newY / (float) outOptions.inSampleSize);
368+
int cropWidth = Math.round(newWidth / (float) outOptions.inSampleSize);
369+
int cropHeight = Math.round(newHeight / (float) outOptions.inSampleSize);
370370
float cropScale = scale * outOptions.inSampleSize;
371371

372372
Matrix scaleMatrix = new Matrix();

0 commit comments

Comments
 (0)