Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions android/src/main/java/com/wwimmo/imageeditor/ImageEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ protected void startMeasurementToolEntity(String imageShapeAsset) {
if (mDrawingCanvas.getWidth() > mSketchCanvas.getWidth() || mDrawingCanvas.getHeight() > mSketchCanvas.getHeight()) {
measurementEntity = new MeasureToolEntity(layer, mDrawingCanvas.getWidth(), mDrawingCanvas.getHeight(), imageShapeAsset, dm);
} else {
measurementEntity = new MeasureToolEntity(layer, mSketchCanvas.getWidth(), mSketchCanvas.getHeight(), imageShapeAsset, dm);
measurementEntity = new MeasureToolEntity(layer, getWidth(), getHeight(), imageShapeAsset, dm);
}
if (imageShapeAsset != null) {
getBitmap(prepareUri(imageShapeAsset), 0, 0, new BaseBitmapDataSubscriber() {
Expand All @@ -1011,8 +1011,10 @@ protected void onFailureImpl(@NonNull DataSource<CloseableReference<CloseableIma
});
}
addEntityAndPosition(measurementEntity);
measurementEntity.addPoint(measurementEntity.getWidth() * 0.35f, measurementEntity.getHeight() / 2);
measurementEntity.addPoint(measurementEntity.getWidth() * 0.65f, measurementEntity.getHeight() / 2);
float width = getWidth();
float height = getHeight();
measurementEntity.addPoint(width * 0.35f, height / 2);
measurementEntity.addPoint(width * 0.65f, height / 2);
}

protected void addSquareEntity(int width) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,13 @@ float getTouchRadius() {
}

float limitX (float x) {
return Math.max(Math.min(x, getWidth()), 0);
float minWidth = Math.min(getWidth(), getMeasuredWidth());
return Math.max(Math.min(x, minWidth), 0);
}

float limitY (float y) {
return Math.max(Math.min(y, getHeight()), 0);
float minHeight = Math.min(getHeight(), getMeasuredHeight());
return Math.max(Math.min(y, minHeight), 0);
}

public boolean handleTranslate(PointF delta) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "https://github.com/hoverinc/react-native-sketch-image"
},
"version": "0.8.49",
"version": "0.8.50",
"description": "react-native-sketch-canvas allows you to draw / sketch on both iOS and Android devices and sync the drawing data between users. Of course you can save as image.",
"author": "Terry Lin, Thomas Steinbrüchel",
"main": "index.js",
Expand Down