Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Added maximumZoomScale and minimumZoomScale
Browse files Browse the repository at this point in the history
  • Loading branch information
ikorich committed Jan 17, 2019
1 parent 34275c9 commit 97776f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Example/ExampleCropViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class ExampleCropViewController: IGRPhotoTweakViewController {
super.viewDidLoad()

self.setupSlider()

//FIXME: Zoom setup
//self.photoView.minimumZoomScale = 1.0;
//self.photoView.maximumZoomScale = 10.0;
}

//FIXME: Themes Preview
Expand Down
22 changes: 20 additions & 2 deletions IGRPhotoTweaks/PhotoTweakView/IGRPhotoTweakView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ public class IGRPhotoTweakView: UIView {
}
}

public var maximumZoomScale: CGFloat {
set {
self.scrollView.maximumZoomScale = newValue
}
get {
return self.scrollView.maximumZoomScale
}
}

public var minimumZoomScale: CGFloat {
set {
self.scrollView.minimumZoomScale = newValue
}
get {
return self.scrollView.minimumZoomScale
}
}

//MARK: - Private VARs

internal var radians: CGFloat = CGFloat.zero
Expand Down Expand Up @@ -124,8 +142,8 @@ public class IGRPhotoTweakView: UIView {
y: CGFloat.zero,
width: self.originalSize.width,
height: self.originalSize.height)
self.scrollView.minimumZoomScale = 1
self.scrollView.setZoomScale(1, animated: false)
self.scrollView.minimumZoomScale = 1.0
self.scrollView.setZoomScale(1.0, animated: false)

self.cropView.frame = self.scrollView.frame
self.cropView.center = self.scrollView.center
Expand Down

0 comments on commit 97776f2

Please sign in to comment.