Skip to content

Commit

Permalink
Merge pull request #257 from ruslanskorb/develop
Browse files Browse the repository at this point in the history
Version 5.0.0
  • Loading branch information
ruslanskorb authored Nov 29, 2024
2 parents c023288 + 9520771 commit f6fb28b
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.2.2'
bundler-cache: true
- uses: actions/cache@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: e2296c0f63c75329f0583a4252b3dfcb582ff009

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
8 changes: 4 additions & 4 deletions Example/RSKImageCropperExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = J3P7YV7464;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RSKImageCropperExample/RSKImageCropperExample-Prefix.pch";
INFOPLIST_FILE = "RSKImageCropperExample/RSKImageCropperExample-Info.plist";
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 5.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.ruslanskorb.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = RSKImageCropperExample;
TARGETED_DEVICE_FAMILY = 1;
Expand All @@ -572,12 +572,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = J3P7YV7464;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RSKImageCropperExample/RSKImageCropperExample-Prefix.pch";
INFOPLIST_FILE = "RSKImageCropperExample/RSKImageCropperExample-Info.plist";
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 5.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.ruslanskorb.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = RSKImageCropperExample;
TARGETED_DEVICE_FAMILY = 1;
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'cocoapods', '1.15.2'
gem 'cocoapods', '1.16.2'

gem 'fui', '0.5.0'
gem 'xcpretty', '0.3.0'
gem 'xcpretty', '0.4.0'
54 changes: 29 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,32 @@ GEM
base64
nkf
rexml
activesupport (7.1.3.2)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.7)
benchmark (0.4.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.15.2)
cocoapods (1.16.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.15.2)
cocoapods-core (= 1.16.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -41,8 +44,8 @@ GEM
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
xcodeproj (>= 1.27.0, < 2.0)
cocoapods-core (1.16.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -62,55 +65,56 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.3)
ffi (1.17.0)
fourflusher (2.3.1)
fui (0.5.0)
gli
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
gli (2.21.1)
httpclient (2.8.3)
i18n (1.14.4)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.7.2)
minitest (5.22.3)
json (2.8.2)
logger (1.6.1)
minitest (5.25.2)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nanaimo (0.4.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.3.9)
rouge (2.0.7)
rouge (3.28.0)
ruby-macho (2.5.1)
securerandom (0.3.2)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.25.1)
xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
nanaimo (~> 0.4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty (0.4.0)
rouge (~> 3.28.0)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.15.2)
cocoapods (= 1.16.2)
fui (= 0.5.0)
xcpretty (= 0.3.0)
xcpretty (= 0.4.0)

BUNDLED WITH
2.4.10
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 = '4.1.1'
s.version = '5.0.0'
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
20 changes: 10 additions & 10 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 = 4.1.1;
CURRENT_PROJECT_VERSION = 7;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -297,7 +297,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4.1.1;
CURRENT_PROJECT_VERSION = 7;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -324,10 +324,10 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 4.1.1;
DYLIB_CURRENT_VERSION = 4.1.1;
DYLIB_COMPATIBILITY_VERSION = 5.0.0;
DYLIB_CURRENT_VERSION = 5.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
INFOPLIST_FILE = Framework/Info.plist;
Expand All @@ -337,7 +337,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 5.0.0;
MODULEMAP_FILE = "$(SRCROOT)/RSKImageCropper/RSKImageCropper.modulemap";
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
Expand All @@ -351,10 +351,10 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 4.1.1;
DYLIB_CURRENT_VERSION = 4.1.1;
DYLIB_COMPATIBILITY_VERSION = 5.0.0;
DYLIB_CURRENT_VERSION = 5.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
INFOPLIST_FILE = Framework/Info.plist;
Expand All @@ -364,7 +364,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.1.1;
MARKETING_VERSION = 5.0.0;
MODULEMAP_FILE = "$(SRCROOT)/RSKImageCropper/RSKImageCropper.modulemap";
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
Expand Down
2 changes: 1 addition & 1 deletion RSKImageCropper/RSKImageCropViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ NS_SWIFT_UI_ACTOR
/**
Zooms to a specific area of the image so that it is visible.
@param rect A rectangle defining an area of the image. The rectangle should be in the coordinate space of the image view controller's view.
@param rect A rectangle defining an area of the image. The rectangle should be in the coordinate space of the image crop view controller's view.
@param animated YES if the scrolling should be animated, NO if it should be immediate.
*/
- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated;
Expand Down
24 changes: 17 additions & 7 deletions RSKImageCropper/RSKImageCropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,11 @@ - (void)onChooseButtonTouch:(UIBarButtonItem *)sender

- (void)handleDoubleTap:(UITapGestureRecognizer *)gestureRecognizer
{
[self reset:YES];
if (self.imageScrollView.zoomScale == self.zoomScaleDefaultValue) {
[self.imageScrollView zoomToLocation:[gestureRecognizer locationInView:self.imageScrollView] animated:YES];
} else {
[self reset:YES];
}
}

- (void)handleRotation:(UIRotationGestureRecognizer *)gestureRecognizer
Expand All @@ -653,7 +657,7 @@ - (void)handleRotation:(UIRotationGestureRecognizer *)gestureRecognizer
- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated
{
rect = [self.imageScrollView convertRect:rect fromView:self.view];
rect = [self.imageScrollView convertRect:rect toCoordinateSpace:self.imageScrollView.imageCoordinateSpace];
rect = [self.imageScrollView convertRect:rect toCoordinateSpace:self.imageScrollView.imageViewCoordinateSpace];
[self.imageScrollView zoomToRect:rect animated:animated];
}

Expand All @@ -678,6 +682,7 @@ - (void)reset:(BOOL)animated
[self resetRotation];
[self resetZoomScale];
[self resetContentOffset];
[self centerImage];

if (animated) {
[UIView commitAnimations];
Expand All @@ -687,7 +692,7 @@ - (void)reset:(BOOL)animated
- (void)resetContentOffset
{
CGSize boundsSize = self.imageScrollView.bounds.size;
CGRect frameToCenter = self.imageScrollView.imageFrame;
CGRect frameToCenter = self.imageScrollView.imageViewFrame;

CGPoint contentOffset;
if (CGRectGetWidth(frameToCenter) > boundsSize.width) {
Expand All @@ -710,14 +715,19 @@ - (void)resetRotation
}

- (void)resetZoomScale
{
self.imageScrollView.zoomScale = self.zoomScaleDefaultValue;
}

- (CGFloat)zoomScaleDefaultValue
{
CGFloat zoomScale;
if (CGRectGetWidth(self.view.bounds) > CGRectGetHeight(self.view.bounds)) {
zoomScale = CGRectGetHeight(self.view.bounds) / self.originalImage.size.height;
} else {
zoomScale = CGRectGetWidth(self.view.bounds) / self.originalImage.size.width;
}
self.imageScrollView.zoomScale = zoomScale;
return zoomScale;
}

- (NSArray *)intersectionPointsOfLineSegment:(RSKLineSegment)lineSegment withRect:(CGRect)rect
Expand Down Expand Up @@ -768,9 +778,9 @@ - (void)displayImage
}
}

- (void)centerImageScrollViewZoomView
- (void)centerImage
{
// center imageScrollView.zoomView as it becomes smaller than the size of the screen
// center the image view of the imageScrollView as it becomes smaller than the size of the imageScrollView

CGPoint contentOffset = self.imageScrollView.contentOffset;

Expand Down Expand Up @@ -865,7 +875,7 @@ - (void)layoutImageScrollView
self.imageScrollView.transform = CGAffineTransformIdentity;

self.imageScrollView.frame = frame;
[self centerImageScrollViewZoomView];
[self centerImage];

self.imageScrollView.transform = transform;
}
Expand Down
Loading

0 comments on commit f6fb28b

Please sign in to comment.