Kaynağa Gözat

【综合】BOTA 当注释被筛选后,列表显示为空时,搜索和筛选不应该置灰禁用(已修复)

tangchao 11 ay önce
ebeveyn
işleme
abd5c522a2

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideEmptyFileViewController.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMLeftSideEmptyFileViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMLeftSideEmptyFileViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="addOutlineBox" destination="MIA-lH-jtO" id="u8H-eE-4q9"/>
                 <outlet property="addOutlineBtn" destination="X7a-nf-rDc" id="IsA-ct-1Nj"/>
@@ -83,8 +83,8 @@
             </constraints>
             <point key="canvasLocation" x="-6495" y="-11614"/>
         </customView>
-        <customView id="xPY-zh-ajV">
-            <rect key="frame" x="0.0" y="0.0" width="250" height="173"/>
+        <customView misplaced="YES" id="xPY-zh-ajV">
+            <rect key="frame" x="0.0" y="0.0" width="196" height="173"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="MNd-Tq-dI0">

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -617,7 +617,7 @@ extension KMLeftSideViewController {
                 }
                 
                 //添加所有annotation 用于筛选
-                annotationArray += annos
+                annotationArray += (page?.annotations ?? [])
             }
             
             //  处理排序

+ 36 - 42
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -2053,52 +2053,46 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
             }
             var count = 0
             for section in self.annotations {
-                if section.annotations?.count != 0 {
-                    count += section.annotations!.count
+                if let cnt = section.annotations?.count {
+                    count += cnt
                 }
             }
-//            if (item == nil){
-//                NSInteger count = [[rightSideController.noteArrayController arrangedObjects] count];
+            if (self.allAnnotations.count < 1) {
+                self.noteSearchButton.isEnabled = false
+                self.noteFilterButton.isEnabled = false
+            } else {
+                self.noteSearchButton.isEnabled = true
+                self.noteFilterButton.isEnabled = true
+            }
+            if count < 1 {
+                self.noteOutlineView.usesAlternatingRowBackgroundColors = false
+                let view = self.noteOutlineView.enclosingScrollView
+                let viewFrame = view?.frame ?? .zero
+                var emptyVcSize =  self.leftSideEmptyVC.emptyAnnotationView.frame.size
+                self.leftSideEmptyVC.emptyAnnotationView.frame = NSMakeRect((viewFrame.size.width-emptyVcSize.width)/2.0,(viewFrame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height)
                 
-                if (count < 1) {
-//                    if (notes.count < 1) {
-                    self.noteSearchButton.isEnabled = false
-                    self.noteFilterButton.isEnabled = false
-//                    }
-                    self.noteOutlineView.usesAlternatingRowBackgroundColors = false
-                    let view = self.noteOutlineView.enclosingScrollView
-                    let viewFrame = view?.frame ?? .zero
-                    var emptyVcSize =  self.leftSideEmptyVC.emptyAnnotationView.frame.size
-                    self.leftSideEmptyVC.emptyAnnotationView.frame = NSMakeRect((viewFrame.size.width-emptyVcSize.width)/2.0,(viewFrame.size.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height)
-                    
-                    self.leftSideEmptyVC.emptyAnnotationView.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
-                    self.noteOutlineView.enclosingScrollView?.documentView?.addSubview(self.leftSideEmptyVC.emptyAnnotationView)
-                    self.leftSideEmptyVC.exportAnnotationBtn.isEnabled = false
-                    self.leftSideEmptyVC.deleteAnnotationBtn.isEnabled = false
-//
-                    if (self.leftView.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
-                        self.noteHeaderView.isHidden = true
-                        self.toolButtonBoxLayoutConstraint.constant = 40.0
-                    }
-                } else {
-                    self.noteSearchButton.isEnabled = true
-                    self.noteFilterButton.isEnabled = true
-
-                    self.noteOutlineView.usesAlternatingRowBackgroundColors = false
-
-                    self.leftSideEmptyVC.emptyAnnotationView.removeFromSuperview()
-                    self.leftSideEmptyVC.exportAnnotationBtn.isEnabled = true
-                    self.leftSideEmptyVC.deleteAnnotationBtn.isEnabled = true
-//
-                    if (self.leftView.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
-                        self.noteHeaderView.isHidden = false
-                        self.toolButtonBoxLayoutConstraint.constant = 64.0
-                    }
+                self.leftSideEmptyVC.emptyAnnotationView.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
+                self.noteOutlineView.enclosingScrollView?.documentView?.addSubview(self.leftSideEmptyVC.emptyAnnotationView)
+                self.leftSideEmptyVC.exportAnnotationBtn.isEnabled = false
+                self.leftSideEmptyVC.deleteAnnotationBtn.isEnabled = false
+                
+                if (self.leftView.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
+                    self.noteHeaderView.isHidden = true
+                    self.toolButtonBoxLayoutConstraint.constant = 40.0
                 }
-                return count
-//            } else {
-//                                return [item hasNoteText];
-//            }
+            } else {
+                self.noteOutlineView.usesAlternatingRowBackgroundColors = false
+                
+                self.leftSideEmptyVC.emptyAnnotationView.removeFromSuperview()
+                self.leftSideEmptyVC.exportAnnotationBtn.isEnabled = true
+                self.leftSideEmptyVC.deleteAnnotationBtn.isEnabled = true
+                if (self.leftView.segmentedControl.selectedSegment == KMSelectedSegmentType.annotation.rawValue) {
+                    self.noteHeaderView.isHidden = false
+                    self.toolButtonBoxLayoutConstraint.constant = 64.0
+                }
+            }
+            
+            return count
         }
         return 0
     }