 		return CGRect(x: x, y: y, width: previewDimension, height: previewDimension)
     }
     
-    func minimizedRectForRect(rect: CGRect) -> CGRect {
+    func minimizedTransformForRect(rect: CGRect) -> CGAffineTransform {
         let minimizedDimension: CGFloat = 5.0
-		let position = orientation == .Vertical ? rect.origin.y : rect.origin.x
-		let minimizedPosition = position + ((previewDimension - minimizedDimension) / 2)
-		let x = orientation == .Vertical ? bounds.width / 2 : minimizedPosition
-		let y = orientation == .Vertical ? minimizedPosition : bounds.height / 2
-		return CGRect(x: x, y: y, width: minimizedDimension, height: minimizedDimension)
+		
+		let scale = minimizedDimension / previewDimension
+		let scaleTransform = CGAffineTransformMakeScale(scale, scale)
+		
+		let tx = orientation == .Vertical ? previewOffset : 0
+		let ty = orientation == .Vertical ? 0 : previewOffset
+		let translationTransform = CGAffineTransformMakeTranslation(tx, ty)
+		
+		return CGAffineTransformConcat(scaleTransform, translationTransform)
     }
 }
 

	// MARK: Preview view
	@IBInspectable public var previewEnabled: Bool = false
    private var previewView: UIView = UIView()
	private let previewDimension: CGFloat = 32
	private let previewOffset: CGFloat = 44
	private let previewAnimationDuration: NSTimeInterval = 0.15
	
    // MARK: - Initializers
	convenience init() {

	
    func removePreview() {
		if !previewEnabled || previewView.superview == nil { return }
		
		UIView.animateWithDuration(previewAnimationDuration, delay: 0, options: [.BeginFromCurrentState, .CurveEaseInOut], animations: { () -> Void in
			self.previewView.transform = self.minimizedTransformForRect(self.previewView.frame)
		}, completion: { (completed: Bool) -> Void in
			self.previewView.removeFromSuperview()
			self.previewView.transform = CGAffineTransformIdentity
		})
    }
	
