Skip to content

Commit

Permalink
UIEdgeInsetsMake' has been replaced by 'UIEdgeInsets.init(top:left:bo…
Browse files Browse the repository at this point in the history
…ttom:right:)'

refs artemkrachulov#41
  • Loading branch information
ykws committed Jan 18, 2022
1 parent 74d2ab5 commit 9195850
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct AKImageCropperCropViewConfiguration {

/// Edges insets for crop rectangle. Static values for programmatically rotation.

public var cropRectInsets = UIEdgeInsetsMake(20, 20, 20, 20)
public var cropRectInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)

/// The smallest value for the crop rectangle sizes. Initial value of this property is 60 pixels width and 60 pixels height.
public var minCropRectSize: CGSize = CGSize(width: 60, height: 60)
Expand Down
50 changes: 25 additions & 25 deletions AKImageCropperView/AKImageCropperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ open class AKImageCropperView: UIView, UIScrollViewDelegate, UIGestureRecognizer

switch angle {
case Double.pi/2:
newEdgeInsets = UIEdgeInsetsMake(
minEdgeInsets.right,
minEdgeInsets.top,
minEdgeInsets.left,
minEdgeInsets.bottom)
newEdgeInsets = UIEdgeInsets(
top: minEdgeInsets.right,
left: minEdgeInsets.top,
bottom: minEdgeInsets.left,
right: minEdgeInsets.bottom)
case Double.pi:
newEdgeInsets = UIEdgeInsetsMake(
minEdgeInsets.bottom,
minEdgeInsets.right,
minEdgeInsets.top,
minEdgeInsets.left)
newEdgeInsets = UIEdgeInsets(
top: minEdgeInsets.bottom,
left: minEdgeInsets.right,
bottom: minEdgeInsets.top,
right: minEdgeInsets.left)
case Double.pi/2 * 3:
newEdgeInsets = UIEdgeInsetsMake(
minEdgeInsets.left,
minEdgeInsets.bottom,
minEdgeInsets.right,
minEdgeInsets.top)
newEdgeInsets = UIEdgeInsets(
top: minEdgeInsets.left,
left: minEdgeInsets.bottom,
bottom: minEdgeInsets.right,
right: minEdgeInsets.top)
default:
newEdgeInsets = minEdgeInsets
}
Expand Down Expand Up @@ -705,11 +705,11 @@ open class AKImageCropperView: UIView, UIScrollViewDelegate, UIGestureRecognizer

// Fix insets direct to orientation

return UIEdgeInsetsMake(
center.y + minEdgeInsets.top,
center.x + minEdgeInsets.left,
center.y + minEdgeInsets.bottom,
center.x + minEdgeInsets.right)
return UIEdgeInsets(
top: center.y + minEdgeInsets.top,
left: center.x + minEdgeInsets.left,
bottom: center.y + minEdgeInsets.bottom,
right: center.x + minEdgeInsets.right)
}

private func contentOffset(from savedContentOffsetPercentage: CGPointPercentage) -> CGPoint {
Expand All @@ -732,11 +732,11 @@ open class AKImageCropperView: UIView, UIScrollViewDelegate, UIGestureRecognizer

func cropperOverlayViewDidChangeCropRect(_ view: AKImageCropperOverlayView, _ cropRect: CGRect) {

scrollView.contentInset = UIEdgeInsetsMake(
cropRect.origin.y,
cropRect.origin.x,
view.frame.size.height - cropRect.size.height - cropRect.origin.y,
view.frame.size.width - cropRect.size.width - cropRect.origin.x)
scrollView.contentInset = UIEdgeInsets(
top: cropRect.origin.y,
left: cropRect.origin.x,
bottom: view.frame.size.height - cropRect.size.height - cropRect.origin.y,
right: view.frame.size.width - cropRect.size.width - cropRect.origin.x)

if cropRect.size.height > scrollView.contentSize.height || cropRect.size.width > scrollView.contentSize.width {

Expand Down

0 comments on commit 9195850

Please sign in to comment.