 import UIKit
 
 public class LightboxView: UIView {
+
+  public var minimumZoomScale: CGFloat = 1
+  public var maximumZoomScale: CGFloat = 3
+  var lastZoomScale: CGFloat = -1
 
   lazy var imageView: UIImageView = {
     let imageView = UIImageView(frame: CGRectZero)


  public func updateZoom() {
    if let image = imageView.image {
      var minZoom = min(
        bounds.size.width / image.size.width,
        bounds.size.height / image.size.height)

      if minZoom > 1 {
        minZoom = 1
      }

      scrollView.minimumZoomScale = minZoom

      if minZoom == lastZoomScale {
        minZoom += 0.000001
      }

      scrollView.zoomScale = minZoom
      lastZoomScale = minZoom
    }
  }
}


  public func updateImageConstraints() {
    if let image = imageView.image {
      let viewWidth = bounds.size.width
      let viewHeight = bounds.size.height

      let imageWidth = image.size.width
      let imageHeight = image.size.height

      // Center image
      var hPadding = (viewWidth - scrollView.zoomScale * imageWidth) / 2
      if hPadding < 0 {
        hPadding = 0
      }

      var vPadding = (viewHeight - scrollView.zoomScale * imageHeight) / 2
      if vPadding < 0 {
        vPadding = 0
      }

      imageConstraintLeading.constant = hPadding
      imageConstraintTrailing.constant = hPadding
