             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!()
                     

    
    override func viewWillAppear(_ animated: Bool) {
        gallery.currentViewController = self
        scrollView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
        imageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
        scrollView.contentSize = CGSize(width: imageView.frame.size.width, height: imageView.frame.size.height)
        scrollView.center = view.center
        imageView.center = view.center
        
        for subview  in  self.view.subviews {
            subview.backgroundColor = UIColor.clear
            

        
    }
    
    internal func statusBarHeight() -> CGFloat {
        let statusBarSize = UIApplication.shared.statusBarFrame.size
        return Swift.min(statusBarSize.width, statusBarSize.height)
    }
    
    func orientationChanged(){
        if(pageViewController != nil){
            let scrollView: UIScrollView = pageViewController.viewControllers?.first!.view?.subviews[0] as! UIScrollView
