Skip to content

Commit

Permalink
Merge pull request #201 from ruslanskorb/develop
Browse files Browse the repository at this point in the history
Version 2.2.1
  • Loading branch information
ruslanskorb authored Sep 26, 2018
2 parents 8b639c3 + f3bde56 commit 9d80e7d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,26 @@ - (UIBezierPath *)imageCropViewControllerCustomMaskPath:(RSKImageCropViewControl
// Returns a custom rect in which the image can be moved.
- (CGRect)imageCropViewControllerCustomMovementRect:(RSKImageCropViewController *)controller
{
// If the image is not rotated, then the movement rect coincides with the mask rect.
return controller.maskRect;
if (controller.rotationAngle == 0) {
return controller.maskRect;
} else {
CGRect maskRect = controller.maskRect;
CGFloat rotationAngle = controller.rotationAngle;

CGRect movementRect = CGRectZero;

movementRect.size.width = CGRectGetWidth(maskRect) * fabs(cos(rotationAngle)) + CGRectGetHeight(maskRect) * fabs(sin(rotationAngle));
movementRect.size.height = CGRectGetHeight(maskRect) * fabs(cos(rotationAngle)) + CGRectGetWidth(maskRect) * fabs(sin(rotationAngle));

movementRect.origin.x = CGRectGetMinX(maskRect) + (CGRectGetWidth(maskRect) - CGRectGetWidth(movementRect)) * 0.5f;
movementRect.origin.y = CGRectGetMinY(maskRect) + (CGRectGetHeight(maskRect) - CGRectGetHeight(movementRect)) * 0.5f;

movementRect.origin.x = floor(CGRectGetMinX(movementRect));
movementRect.origin.y = floor(CGRectGetMinY(movementRect));
movementRect = CGRectIntegral(movementRect);

return movementRect;
}
}

@end
Expand Down
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion RSKImageCropper.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RSKImageCropper'
s.version = '2.2.0'
s.version = '2.2.1'
s.summary = 'An image cropper for iOS like in the Contacts app with support for landscape orientation.'
s.homepage = 'https://github.com/ruslanskorb/RSKImageCropper'
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
12 changes: 6 additions & 6 deletions RSKImageCropper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.2.0;
CURRENT_PROJECT_VERSION = 2.2.1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -294,7 +294,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2.2.0;
CURRENT_PROJECT_VERSION = 2.2.1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -321,8 +321,8 @@
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.2.0;
DYLIB_CURRENT_VERSION = 2.2.0;
DYLIB_COMPATIBILITY_VERSION = 2.2.1;
DYLIB_CURRENT_VERSION = 2.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Framework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -339,8 +339,8 @@
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 2.2.0;
DYLIB_CURRENT_VERSION = 2.2.0;
DYLIB_COMPATIBILITY_VERSION = 2.2.1;
DYLIB_CURRENT_VERSION = 2.2.1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Framework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand Down
6 changes: 3 additions & 3 deletions RSKImageCropper/RSKImageCropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,9 @@ - (UIImage *)croppedImage:(UIImage *)originalImage cropMode:(RSKImageCropMode)cr
CGFloat scale = 1.0 / zoomScale;
[maskPathCopy applyTransform:CGAffineTransformMakeScale(scale, scale)];

// 5b: move the mask to the top-left.
CGPoint translation = CGPointMake(-CGRectGetMinX(maskPathCopy.bounds),
-CGRectGetMinY(maskPathCopy.bounds));
// 5b: center the mask.
CGPoint translation = CGPointMake(-CGRectGetMinX(maskPathCopy.bounds) + (CGRectGetWidth(cropRect) - CGRectGetWidth(maskPathCopy.bounds)) * 0.5f,
-CGRectGetMinY(maskPathCopy.bounds) + (CGRectGetHeight(cropRect) - CGRectGetHeight(maskPathCopy.bounds)) * 0.5f);
[maskPathCopy applyTransform:CGAffineTransformMakeTranslation(translation.x, translation.y)];

// 5c: apply the mask.
Expand Down

0 comments on commit 9d80e7d

Please sign in to comment.