         }
     }
     
-    func dismiss() {
-        self.animator.removeAllBehaviors()
-        self.imageView.removeGestureRecognizer(self.flickGestureRecognizer)
-        delegate?.didDismissViewController(self)
+    
+    func handleDoubleTap(recognizer: UITapGestureRecognizer) {
+        
+        if self.scrollView.zoomScale > self.scrollView.minimumZoomScale {
+            self.scrollView.setZoomScale(self.scrollView.minimumZoomScale, animated: true)
+        }
+        else {
+            let zoomRect = self.getZoomRectForScale(self.scrollView.maximumZoomScale, andCenter: recognizer.locationInView(self.view))
+            self.scrollView.zoomToRect(zoomRect, animated: true)
+        }
+    }
+    
+    func handleSingleTap(recognizer: UITapGestureRecognizer) {
+        self.dismiss()
+        UIView.animateWithDuration(FPGalleryViewControllerConstants.mediumAnimationDuration,animations: {
+            self.imageView.frame = CGRectMake(self.view.center.x, self.view.center.y, 0, 0)
+        })
     }
     
 //MARK:- Scroll View Delegate Methods

        flickGestureRecognizer = UIPanGestureRecognizer(target: self, action: "handleFlick:" )
        flickGestureRecognizer.delegate = self
        self.imageView.addGestureRecognizer(flickGestureRecognizer)

    }
    

        }
        self.centerScrollViewContents()
    }
    
    
    func getZoomRectForScale(scale: CGFloat, andCenter center:CGPoint) -> CGRect {
        
        var zoomRect: CGRect = CGRect()
        
        zoomRect.size.height = self.scrollView.frame.height / scale
        zoomRect.size.width = self.scrollView.frame.width / scale
        
        zoomRect.origin.x = center.x - (zoomRect.size.width / 2)
        zoomRect.origin.y = center.y - (zoomRect.size.height / 2)
        
        return zoomRect
    }
    
    
//MARK:- Dismissing View Controller
    func dismiss() {
        self.animator.removeAllBehaviors()
        self.imageView.removeGestureRecognizer(self.flickGestureRecognizer)
        delegate?.didDismissViewController(self)
    }




