diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/comments/ImageCropper.tsx | 1 | ||||
-rw-r--r-- | src/components/comments/ZoomInCropper.tsx | 29 | ||||
-rw-r--r-- | src/components/moments/Moment.tsx | 5 |
3 files changed, 13 insertions, 22 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); diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 1d4509dd..81e23076 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -56,11 +56,6 @@ const Moment: React.FC<MomentProps> = ({ }) .then((picture) => { if ('path' in picture) { - // navigation.navigate('ImageCropper', { - // screenType, - // title: title, - // image: picture, - // }); navigation.navigate('ZoomInCropper', { screenType, title: title, |