marinofaggiana 4 years ago
parent
commit
b9e54012e7

+ 4 - 1
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard

@@ -132,7 +132,7 @@
                                         <state key="normal" title="location"/>
                                     </button>
                                 </subviews>
-                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <color key="backgroundColor" systemColor="systemRedColor"/>
                                 <constraints>
                                     <constraint firstItem="Typ-A8-XIO" firstAttribute="top" secondItem="P8R-4f-zAl" secondAttribute="top" constant="30" id="1o6-BQ-z66"/>
                                     <constraint firstItem="oov-9f-Oeu" firstAttribute="leading" secondItem="Typ-A8-XIO" secondAttribute="leading" id="HKa-ns-hP8"/>
@@ -187,5 +187,8 @@
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
+        <systemColor name="systemRedColor">
+            <color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
     </resources>
 </document>

+ 13 - 13
iOSClient/Viewer/NCViewerImage/NCViewerImageZoom.swift

@@ -37,7 +37,6 @@ class NCViewerImageZoom: UIViewController {
         
     @IBOutlet weak var detailViewTopConstraint: NSLayoutConstraint!
     @IBOutlet weak var detailViewHeightConstraint: NSLayoutConstraint!
-
     
     @IBOutlet weak var scrollView: UIScrollView!
     @IBOutlet weak var imageView: UIImageView!
@@ -52,9 +51,6 @@ class NCViewerImageZoom: UIViewController {
     var minScale: CGFloat = 0
     
     var doubleTapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
-
-    var panDistanceClose: CGFloat = 0
-    var panDistanceForDetailView: CGFloat = 50
             
     var isOpenDetailView: Bool = false
     
@@ -99,11 +95,11 @@ class NCViewerImageZoom: UIViewController {
 
         updateZoomScale()
         updateConstraints()
-        
-        panDistanceClose = view.bounds.height / 7
-        
+                
         detailView.updateExifLocal(metadata: metadata)
-
+        detailViewHeightConstraint.constant = (imageView.bounds.height / 3) * 2
+        detailViewTopConstraint.constant = 0
+        
         delegate?.willAppearImageZoom(viewerImageZoom: self, metadata: metadata)
     }
     
@@ -117,7 +113,9 @@ class NCViewerImageZoom: UIViewController {
         super.viewDidLayoutSubviews()
         
         updateZoomScale()
-        updateConstraints()
+        if !isOpenDetailView {
+            updateConstraints()
+        }
     }
     
     //MARK: - Gesture
@@ -169,22 +167,24 @@ class NCViewerImageZoom: UIViewController {
                         
             imageViewTopConstraint.constant = startImageViewTopConstraint + currentLocation.y
             imageViewBottomConstraint.constant = startImageViewBottomConstraint - currentLocation.y
-            
+                        
             // DISMISS
-            if imageView.center.y > view.center.y + panDistanceClose {
+            if imageView.center.y > view.center.y + 100 {
                 
                 delegate?.dismiss()
             }
 
             // OPEN DETAIL
-            if imageView.center.y < view.center.y - panDistanceForDetailView {
+            if imageView.center.y < view.center.y - 50 {
                 
+                detailViewTopConstraint.constant = imageViewBottomConstraint.constant
                 isOpenDetailView = true
             }
             
             // CLOSE DETAIL
-            if imageView.center.y >  view.center.y + panDistanceForDetailView {
+            if imageView.center.y >  view.center.y + 50 {
                 
+                detailViewTopConstraint.constant = 0
                 isOpenDetailView = false
             }