Skip to content

Commit

Permalink
Update ImageCropPicker.m (ivpusic#1467)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlindDev authored Nov 19, 2020
1 parent d9bd599 commit 798ac61
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions ios/src/ImageCropPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -864,31 +864,31 @@ + (NSDictionary *)cgRectToDictionary:(CGRect)rect {

#pragma mark - TOCCropViewController Implementation
- (void)cropImage:(UIImage *)image {
TOCropViewController *cropVC;
if ([[[self options] objectForKey:@"cropperCircleOverlay"] boolValue]) {
cropVC = [[TOCropViewController alloc] initWithCroppingStyle:TOCropViewCroppingStyleCircular image:image];
} else {
cropVC = [[TOCropViewController alloc] initWithImage:image];
CGFloat widthRatio = [[self.options objectForKey:@"width"] floatValue];
CGFloat heightRatio = [[self.options objectForKey:@"height"] floatValue];
if (widthRatio > 0 && heightRatio > 0){
CGSize aspectRatio = CGSizeMake(widthRatio, heightRatio);
cropVC.customAspectRatio = aspectRatio;

}
cropVC.aspectRatioLockEnabled = ![[self.options objectForKey:@"freeStyleCropEnabled"] boolValue];
cropVC.resetAspectRatioEnabled = !cropVC.aspectRatioLockEnabled;
}

cropVC.title = [[self options] objectForKey:@"cropperToolbarTitle"];
cropVC.delegate = self;

cropVC.doneButtonTitle = [self.options objectForKey:@"cropperChooseText"];
cropVC.cancelButtonTitle = [self.options objectForKey:@"cropperCancelText"];

cropVC.modalPresentationStyle = UIModalPresentationFullScreen;

dispatch_async(dispatch_get_main_queue(), ^{
TOCropViewController *cropVC;
if ([[[self options] objectForKey:@"cropperCircleOverlay"] boolValue]) {
cropVC = [[TOCropViewController alloc] initWithCroppingStyle:TOCropViewCroppingStyleCircular image:image];
} else {
cropVC = [[TOCropViewController alloc] initWithImage:image];
CGFloat widthRatio = [[self.options objectForKey:@"width"] floatValue];
CGFloat heightRatio = [[self.options objectForKey:@"height"] floatValue];
if (widthRatio > 0 && heightRatio > 0){
CGSize aspectRatio = CGSizeMake(widthRatio, heightRatio);
cropVC.customAspectRatio = aspectRatio;

}
cropVC.aspectRatioLockEnabled = ![[self.options objectForKey:@"freeStyleCropEnabled"] boolValue];
cropVC.resetAspectRatioEnabled = !cropVC.aspectRatioLockEnabled;
}

cropVC.title = [[self options] objectForKey:@"cropperToolbarTitle"];
cropVC.delegate = self;

cropVC.doneButtonTitle = [self.options objectForKey:@"cropperChooseText"];
cropVC.cancelButtonTitle = [self.options objectForKey:@"cropperCancelText"];

cropVC.modalPresentationStyle = UIModalPresentationFullScreen;\

[[self getRootVC] presentViewController:cropVC animated:FALSE completion:nil];
});
}
Expand Down

0 comments on commit 798ac61

Please sign in to comment.