aboutsummaryrefslogtreecommitdiff
path: root/src/components/comments
diff options
context:
space:
mode:
authorBrian Kim <brian@tagg.id>2021-06-19 03:26:49 +0900
committerBrian Kim <brian@tagg.id>2021-06-19 03:26:49 +0900
commit8723e8c9e32200d35f4027d2a16b6c89734c36b9 (patch)
treeff0071254bb58b8cfebb7a27ddc7f3df96fb8af8 /src/components/comments
parent947a06a323ebf69be3454801148814792df664ea (diff)
Clean up code a little
Diffstat (limited to 'src/components/comments')
-rw-r--r--src/components/comments/ImageCropper.tsx1
-rw-r--r--src/components/comments/ZoomInCropper.tsx29
2 files changed, 13 insertions, 17 deletions
diff --git a/src/components/comments/ImageCropper.tsx b/src/components/comments/ImageCropper.tsx
index 7d4eabff..9edd5838 100644
--- a/src/components/comments/ImageCropper.tsx
+++ b/src/components/comments/ImageCropper.tsx
@@ -83,7 +83,6 @@ const ImageCropper: React.FC<ImageCropperProps> = ({route, navigation}) => {
}}
keepAspectRatio
aspectRatio={aspectRatios[aspectRatioIndex]}
- ref={cropViewRef}
/>
)}
</View>
diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx
index 85b25541..097b1783 100644
--- a/src/components/comments/ZoomInCropper.tsx
+++ b/src/components/comments/ZoomInCropper.tsx
@@ -54,7 +54,6 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
y1 !== undefined &&
image.sourceURL
) {
- console.log('x0x1y0y1');
PhotoManipulator.crop(image.sourceURL, {
x: x0,
y: y1,
@@ -82,7 +81,6 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
image: {filename: image.sourceURL, path: image.sourceURL},
});
}
- console.log('crop photo and send to caption screen');
};
const [x0, setX0] = useState<number>();
@@ -98,25 +96,24 @@ export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
const y = position.positionY;
const scale = position.scale;
const screen_ratio = SCREEN_HEIGHT / SCREEN_WIDTH;
- let x0 = w / 2 - x * (w / SCREEN_WIDTH) - w / 2 / scale;
- let x1 = w / 2 - x * (w / SCREEN_WIDTH) + w / 2 / scale;
- if (x0 < 0) {
- x0 = 0;
+ let tempx0 = w / 2 - x * (w / SCREEN_WIDTH) - w / 2 / scale;
+ let tempx1 = w / 2 - x * (w / SCREEN_WIDTH) + w / 2 / scale;
+ if (tempx0 < 0) {
+ tempx0 = 0;
}
- if (x1 > w) {
- x1 = w;
+ if (tempx1 > w) {
+ tempx1 = w;
}
- const x_distance = Math.abs(x1 - x0);
+ const x_distance = Math.abs(tempx1 - tempx0);
const y_distance = screen_ratio * x_distance;
- let y0 = h / 2 - y * (h / SCREEN_HEIGHT) + y_distance / 2;
- let y1 = h / 2 - y * (h / SCREEN_HEIGHT) - y_distance / 2;
- if (y0 > h) {
- y0 = h;
+ let tempy0 = h / 2 - y * (h / SCREEN_HEIGHT) + y_distance / 2;
+ let tempy1 = h / 2 - y * (h / SCREEN_HEIGHT) - y_distance / 2;
+ if (tempy0 > h) {
+ tempy0 = h;
}
- if (y1 < 0) {
- y1 = 0;
+ if (tempy1 < 0) {
+ tempy1 = 0;
}
- console.log('onMove x0: ', x0, 'x1: ', x1, 'y0: ', y0, 'y1: ', y1);
setX0(x0);
setX1(x1);
setY0(y0);