Skip to content

Commit

Permalink
Fixed zero bounds issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mozharovsky committed Jan 17, 2017
1 parent 6a9f985 commit eb0eaa5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion ImagePickerKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "ImagePickerKit"
s.version = "0.2.5"
s.version = "0.2.6"
s.summary = "ImagePickerKit is a protocol-oriented framework that provides handly features to dealing with picking or taking a photo!"
s.homepage = "https://github.com/Athlee/ImagePickerKit"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
Binary file modified Source/.DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions Source/Cropable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ public extension Cropable {
///
func updateContent() {
let childViewSize = childContainerView.bounds.size
let scrollViewSize = cropView.bounds.size

guard childViewSize != .zero else {
debugPrint("Zero bounds found!")
return
}

let scrollViewSize = cropView.bounds.size
let widthScale = scrollViewSize.width / childViewSize.width
let heightScale = scrollViewSize.height / childViewSize.height

Expand All @@ -208,8 +213,8 @@ public extension Cropable {
}

let maxZoomScale = CGAffineTransform.scalingFactor(toFill: cropView.bounds.size,
with: childView.bounds.size,
atAngle: Double(0))
with: childView.bounds.size,
atAngle: Double(0))


cropView.minimumZoomScale = minScale
Expand Down

0 comments on commit eb0eaa5

Please sign in to comment.