             break;
         case UIGestureRecognizerState.ended:
             let scrollCenterY = self.scrollView.center.y
-            if(scrollCenterY <= (UIScreen.main.bounds.height / 2 - 15) && self.gallery.dismissWhenSlidesUp){
+            if(scrollCenterY <= (UIScreen.main.bounds.height / 2 - 25) && self.gallery.dismissWhenSlidesUp){
                 if(self.gallery.onMovedToTop != nil){
                     self.gallery.onMovedToTop!()
                     

                })
            }
            
            if(scrollCenterY >= (UIScreen.main.bounds.height / 2 + 15) && self.gallery.dismissWhenSlidesDown){
                
                self.gallery.removeGallery()
            } else{

            scrollView.backgroundColor = UIColor.black
            let imageView:UIImageView = scrollView.subviews[0] as! UIImageView
            
            mainView.frame = CGRect(x: 0, y: statusBarHeight(), width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - statusBarHeight())
            scrollView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - statusBarHeight())
            scrollView.contentSize = CGSize(width: imageView.frame.size.width, height: imageView.frame.size.height - statusBarHeight())
            scrollView.center = view.center
            imageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height - statusBarHeight())
            imageView.center = view.center
            
            let orientation: UIInterfaceOrientation = UIApplication.shared.statusBarOrientation
