marinofaggiana 3 жил өмнө
parent
commit
60e7c0714e

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

@@ -353,12 +353,12 @@
                         <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                             <constraint firstAttribute="bottom" secondItem="CdQ-LC-Trx" secondAttribute="bottom" id="4qB-8y-OcG"/>
-                            <constraint firstItem="P8R-4f-zAl" firstAttribute="top" secondItem="Yo6-7W-moG" secondAttribute="bottom" constant="-400" id="B4O-kU-vwy"/>
                             <constraint firstAttribute="trailing" secondItem="CdQ-LC-Trx" secondAttribute="trailing" id="IwE-oE-d3Y"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="bottom" secondItem="sBp-t2-eFh" secondAttribute="bottom" id="QHF-av-zeT"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="trailing" secondItem="sBp-t2-eFh" secondAttribute="trailing" constant="25" id="TCr-e0-gnG"/>
                             <constraint firstItem="2AU-85-K8y" firstAttribute="leading" secondItem="Yo6-7W-moG" secondAttribute="leading" constant="10" id="X10-OG-EKg"/>
                             <constraint firstItem="Yo6-7W-moG" firstAttribute="top" secondItem="2AU-85-K8y" secondAttribute="top" constant="-10" id="avO-83-uMQ"/>
+                            <constraint firstItem="Yo6-7W-moG" firstAttribute="bottom" secondItem="P8R-4f-zAl" secondAttribute="top" constant="400" id="bor-cg-Alz"/>
                             <constraint firstItem="P8R-4f-zAl" firstAttribute="leading" secondItem="Yo6-7W-moG" secondAttribute="leading" id="dly-i5-fPW"/>
                             <constraint firstItem="CdQ-LC-Trx" firstAttribute="leading" secondItem="fIE-H6-KKc" secondAttribute="leading" id="g8C-2m-KkX"/>
                             <constraint firstItem="CdQ-LC-Trx" firstAttribute="top" secondItem="fIE-H6-KKc" secondAttribute="top" id="hcQ-lB-JwU"/>
@@ -368,8 +368,10 @@
                     </view>
                     <connections>
                         <outlet property="detailView" destination="P8R-4f-zAl" id="xFW-qq-Cdi"/>
-                        <outlet property="detailViewTopConstraint" destination="B4O-kU-vwy" id="8Av-5H-ygG"/>
+                        <outlet property="detailViewTopConstraint" destination="mpQ-4V-Yfc" id="4qg-1r-9fq"/>
                         <outlet property="imageView" destination="kPV-JM-UnM" id="TEv-Tc-8pu"/>
+                        <outlet property="imageViewBottomConstraint" destination="vEd-X2-yGs" id="wp3-67-aZ2"/>
+                        <outlet property="imageViewTopConstraint" destination="tdo-XY-uqv" id="AM2-tz-fSt"/>
                         <outlet property="scrollView" destination="CdQ-LC-Trx" id="3np-FR-s39"/>
                         <outlet property="statusLabel" destination="DAi-gz-qGP" id="zZH-1B-HiI"/>
                         <outlet property="statusViewImage" destination="2AU-85-K8y" id="22h-Ec-bj0"/>

+ 15 - 34
iOSClient/Viewer/NCViewerImage/NCViewerImageZoom.swift

@@ -34,6 +34,8 @@ protocol NCViewerImageZoomDelegate {
 class NCViewerImageZoom: UIViewController {
     
     @IBOutlet weak var detailViewTopConstraint: NSLayoutConstraint!
+    @IBOutlet weak var imageViewTopConstraint: NSLayoutConstraint!
+    @IBOutlet weak var imageViewBottomConstraint: NSLayoutConstraint!
     
     @IBOutlet weak var scrollView: UIScrollView!
     @IBOutlet weak var imageView: UIImageView!
@@ -132,13 +134,6 @@ class NCViewerImageZoom: UIViewController {
     
     override func viewDidDisappear(_ animated: Bool) {
         super.viewDidDisappear(animated)
-        
-        if detailView.isShow() {
-            
-            detailView.hide()
-//            updateZoom()
-//            updateConstraints()
-        }
     }
     
     override func viewDidLayoutSubviews() {
@@ -185,11 +180,8 @@ class NCViewerImageZoom: UIViewController {
             topPoint = CGPoint(x: currentLocation.x, y: currentLocation.y)
             
             // save start
-//            startImageViewTopConstraint = imageViewTopConstraint.constant
-//            startImageViewBottomConstraint = imageViewBottomConstraint.constant
-             
-            // VideoToolBar
-            self.videoToolBar.hideToolBar()
+            startImageViewTopConstraint = imageViewTopConstraint.constant
+            startImageViewBottomConstraint = imageViewBottomConstraint.constant
             
         case .ended:
             
@@ -202,33 +194,22 @@ class NCViewerImageZoom: UIViewController {
                 }
             } else if detailView.isSavedContraint() {
                 UIView.animate(withDuration: 0.3) {
-//                    self.imageViewTopConstraint.constant = self.detailView.imageViewTopConstraintConstant
-//                    self.imageViewBottomConstraint.constant = self.detailView.imageViewBottomConstraintConstant
+                    self.imageViewTopConstraint.constant = self.detailView.imageViewTopConstraintConstant
+                    self.imageViewBottomConstraint.constant = self.detailView.imageViewBottomConstraintConstant
                     self.detailViewTopConstraint.constant = self.detailView.detailViewTopConstraintConstant
                     self.view.layoutIfNeeded()
                 } completion: { (_) in
                 }
             }
             
-            // VideoToolBar
-            if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue {
-                if detailView.isShow() {
-                    self.videoToolBar.hideToolBar()
-                } else {
-                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
-                        self.videoToolBar.showToolBar()
-                    }
-                }
-            }
-            
         case .changed:
             
             if currentLocation.y < topPoint.y { topPoint = currentLocation }
             let deltaY = startPoint.y - currentLocation.y
             
-//            imageViewTopConstraint.constant = startImageViewTopConstraint + currentLocation.y
-//            imageViewBottomConstraint.constant = startImageViewBottomConstraint - currentLocation.y
-//            detailViewTopConstraint.constant = -imageViewBottomConstraint.constant
+            imageViewTopConstraint.constant = startImageViewTopConstraint + currentLocation.y
+            imageViewBottomConstraint.constant = startImageViewBottomConstraint - currentLocation.y
+            detailViewTopConstraint.constant = -imageViewBottomConstraint.constant
             
             // DISMISS
             if imageView.center.y > view.center.y + 100 {
@@ -245,15 +226,15 @@ class NCViewerImageZoom: UIViewController {
                     gestureRecognizer.state = .ended
                      
                     UIView.animate(withDuration: 0.3) {
-//                        self.imageViewTopConstraint.constant = self.startImageViewTopConstraint - self.detailView.frame.height
-//                        self.imageViewBottomConstraint.constant = self.startImageViewBottomConstraint + self.detailView.frame.height
-//                        self.detailViewTopConstraint.constant = -self.imageViewBottomConstraint.constant
+                        self.imageViewTopConstraint.constant = self.startImageViewTopConstraint - self.detailView.frame.height
+                        self.imageViewBottomConstraint.constant = self.startImageViewBottomConstraint + self.detailView.frame.height
+                        self.detailViewTopConstraint.constant = -self.imageViewBottomConstraint.constant
                         self.view.layoutIfNeeded()
                     } completion: { (_) in
                         // Save detail constraints
-//                        self.detailView.imageViewTopConstraintConstant = self.imageViewTopConstraint.constant
-//                        self.detailView.imageViewBottomConstraintConstant = self.imageViewBottomConstraint.constant
-//                        self.detailView.detailViewTopConstraintConstant = self.detailViewTopConstraint.constant
+                        self.detailView.imageViewTopConstraintConstant = self.imageViewTopConstraint.constant
+                        self.detailView.imageViewBottomConstraintConstant = self.imageViewBottomConstraint.constant
+                        self.detailView.detailViewTopConstraintConstant = self.detailViewTopConstraint.constant
                     }
                 }