marinofaggiana 4 жил өмнө
parent
commit
71aeb6b216

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

@@ -144,6 +144,7 @@
                                         </constraints>
                                         </constraints>
                                         <connections>
                                         <connections>
                                             <outlet property="dateLabel" destination="Son-CZ-zFa" id="0Wi-XW-0hw"/>
                                             <outlet property="dateLabel" destination="Son-CZ-zFa" id="0Wi-XW-0hw"/>
+                                            <outlet property="detailViewHeightConstraint" destination="zD7-Vw-cAA" id="gUw-lv-4eV"/>
                                             <outlet property="locationButton" destination="oov-9f-Oeu" id="cGg-Gb-m5S"/>
                                             <outlet property="locationButton" destination="oov-9f-Oeu" id="cGg-Gb-m5S"/>
                                             <outlet property="mapView" destination="Typ-A8-XIO" id="XCg-a6-NUq"/>
                                             <outlet property="mapView" destination="Typ-A8-XIO" id="XCg-a6-NUq"/>
                                         </connections>
                                         </connections>
@@ -177,7 +178,6 @@
                     </view>
                     </view>
                     <connections>
                     <connections>
                         <outlet property="detailView" destination="P8R-4f-zAl" id="xFW-qq-Cdi"/>
                         <outlet property="detailView" destination="P8R-4f-zAl" id="xFW-qq-Cdi"/>
-                        <outlet property="detailViewHeightConstraint" destination="zD7-Vw-cAA" id="4pI-xn-Z4y"/>
                         <outlet property="detailViewTopConstraint" destination="B4O-kU-vwy" id="8Av-5H-ygG"/>
                         <outlet property="detailViewTopConstraint" destination="B4O-kU-vwy" id="8Av-5H-ygG"/>
                         <outlet property="imageView" destination="kPV-JM-UnM" id="TEv-Tc-8pu"/>
                         <outlet property="imageView" destination="kPV-JM-UnM" id="TEv-Tc-8pu"/>
                         <outlet property="imageViewBottomConstraint" destination="xTI-ae-JfJ" id="vdW-Ma-BV1"/>
                         <outlet property="imageViewBottomConstraint" destination="xTI-ae-JfJ" id="vdW-Ma-BV1"/>

+ 8 - 7
iOSClient/Viewer/NCViewerImage/NCViewerImageDetailView.swift

@@ -11,12 +11,12 @@ import MapKit
 
 
 class NCViewerImageDetailView: UIView {
 class NCViewerImageDetailView: UIView {
     
     
+    @IBOutlet weak var detailViewHeightConstraint: NSLayoutConstraint!
     @IBOutlet weak var dateLabel: UILabel!
     @IBOutlet weak var dateLabel: UILabel!
     @IBOutlet weak var mapView: MKMapView!
     @IBOutlet weak var mapView: MKMapView!
     @IBOutlet weak var locationButton: UIButton!
     @IBOutlet weak var locationButton: UIButton!
 
 
     var annotation = MKPointAnnotation()
     var annotation = MKPointAnnotation()
-    
     var latitude: Double = 0
     var latitude: Double = 0
     var longitude: Double = 0
     var longitude: Double = 0
     var location: String = ""
     var location: String = ""
@@ -94,23 +94,24 @@ class NCViewerImageDetailView: UIView {
     }
     }
     
     
     func hasData() -> Bool {
     func hasData() -> Bool {
-        if self.latitude > 0 && self.longitude > 0 {
+        if latitude > 0 && longitude > 0 {
             return true
             return true
         } else {
         } else {
             return false
             return false
         }
         }
     }
     }
     
     
-    func show(textColor: UIColor) {
-        self.dateLabel.textColor = textColor
-        self.isHidden = false
+    func show(height: CGFloat, textColor: UIColor) {
+        detailViewHeightConstraint.constant = height
+        dateLabel.textColor = textColor
+        isHidden = false
     }
     }
     
     
     func hide() {
     func hide() {
-        self.isHidden = true
+        isHidden = true
     }
     }
     
     
     func isShow() -> Bool {
     func isShow() -> Bool {
-        return !self.isHidden
+        return !isHidden
     }
     }
 }
 }

+ 10 - 6
iOSClient/Viewer/NCViewerImage/NCViewerImageZoom.swift

@@ -35,7 +35,6 @@ class NCViewerImageZoom: UIViewController {
     @IBOutlet weak var imageViewTrailingConstraint: NSLayoutConstraint!
     @IBOutlet weak var imageViewTrailingConstraint: NSLayoutConstraint!
         
         
     @IBOutlet weak var detailViewTopConstraint: NSLayoutConstraint!
     @IBOutlet weak var detailViewTopConstraint: NSLayoutConstraint!
-    @IBOutlet weak var detailViewHeightConstraint: NSLayoutConstraint!
     
     
     @IBOutlet weak var scrollView: UIScrollView!
     @IBOutlet weak var scrollView: UIScrollView!
     @IBOutlet weak var imageView: UIImageView!
     @IBOutlet weak var imageView: UIImageView!
@@ -54,6 +53,7 @@ class NCViewerImageZoom: UIViewController {
                 
                 
     private var startImageViewTopConstraint: CGFloat = 0
     private var startImageViewTopConstraint: CGFloat = 0
     private var startImageViewBottomConstraint: CGFloat = 0
     private var startImageViewBottomConstraint: CGFloat = 0
+    private var startPoint = CGPoint.zero
 
 
     required init?(coder aDecoder: NSCoder) {
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
         super.init(coder: aDecoder)
@@ -99,7 +99,6 @@ class NCViewerImageZoom: UIViewController {
         super.viewDidAppear(animated)
         super.viewDidAppear(animated)
         
         
         detailView.updateExifLocal(metadata: metadata)
         detailView.updateExifLocal(metadata: metadata)
-        detailViewHeightConstraint.constant = (view.bounds.width / 2)
         detailViewTopConstraint.constant = 0
         detailViewTopConstraint.constant = 0
         detailView.hide()
         detailView.hide()
         
         
@@ -140,12 +139,12 @@ class NCViewerImageZoom: UIViewController {
     
     
     @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
     @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
         
         
-        if !detailView.hasData() { return }
         let currentLocation = gestureRecognizer.translation(in: self.view)
         let currentLocation = gestureRecognizer.translation(in: self.view)
         
         
         switch gestureRecognizer.state {
         switch gestureRecognizer.state {
         case .began:
         case .began:
             
             
+            startPoint = CGPoint(x: currentLocation.x, y: currentLocation.y)
             scrollView.isScrollEnabled = false
             scrollView.isScrollEnabled = false
             // save start
             // save start
             startImageViewTopConstraint = imageViewTopConstraint.constant
             startImageViewTopConstraint = imageViewTopConstraint.constant
@@ -159,6 +158,9 @@ class NCViewerImageZoom: UIViewController {
             }
             }
             
             
         case .changed:
         case .changed:
+            
+            let deltaY = startPoint.y - currentLocation.y
+            print(deltaY)
                         
                         
             imageViewTopConstraint.constant = startImageViewTopConstraint + currentLocation.y
             imageViewTopConstraint.constant = startImageViewTopConstraint + currentLocation.y
             imageViewBottomConstraint.constant = startImageViewBottomConstraint - currentLocation.y
             imageViewBottomConstraint.constant = startImageViewBottomConstraint - currentLocation.y
@@ -173,9 +175,11 @@ class NCViewerImageZoom: UIViewController {
             // OPEN DETAIL
             // OPEN DETAIL
             if imageView.center.y < view.center.y - 50 {
             if imageView.center.y < view.center.y - 50 {
                 
                 
-                if let textColor = self.viewerImage?.textColor {
-                    detailView.show(textColor: textColor)
-                }
+                if !detailView.hasData() { return }
+                guard let textColor = self.viewerImage?.textColor else {return }
+                
+                let height = (view.bounds.width / 3) * 2
+                detailView.show(height: height, textColor: textColor)
             }
             }
             
             
             // CLOSE DETAIL
             // CLOSE DETAIL