Quellcode durchsuchen

【文字图片编辑】注释缩图列表联动

lizhe vor 1 Jahr
Ursprung
Commit
0db6c06478

+ 13 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -88,6 +88,8 @@ class KMThumbnailViewController: NSViewController {
     }
     }
     
     
     func initNotification() {
     func initNotification() {
+        NotificationCenter.default.addObserver(self, selector: #selector(PDFViewEditingAreaDidChangedNotification), name: NSNotification.Name.init(rawValue: "kPDFViewEditingAreaDidChanged"), object: nil)
+        
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewPageCountChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewRotatePage"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewPageCountChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewRotatePage"), object: nil)
         
         
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewCurrentPageDidChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewCurrentPageDidChanged"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(KMPDFViewCurrentPageDidChangedNotification), name: NSNotification.Name.init(rawValue: "KMPDFViewCurrentPageDidChanged"), object: nil)
@@ -231,6 +233,17 @@ class KMThumbnailViewController: NSViewController {
         }
         }
     }
     }
     
     
+    @objc func PDFViewEditingAreaDidChangedNotification(notification: NSNotification) {
+        if notification.object is CPDFDocument {
+            let pdfdocument : CPDFDocument = notification.object as! CPDFDocument
+            if pdfdocument.isEqual(self.listView.document) {
+                var indexs: IndexSet = IndexSet()
+                indexs.insert(IndexSet.Element(self.listView.currentPageIndex))
+                self.reloadDataAtIndexs(indexs: indexs)
+            }
+        }
+    }
+    
     func pdfCurrentPageChange () {
     func pdfCurrentPageChange () {
         if self.listView.document.pageCount == 0 {
         if self.listView.document.pageCount == 0 {
             return
             return

+ 3 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1318,6 +1318,7 @@ import Cocoa
                     self.rightSideViewController.eidtPDFTextProperty.initData()
                     self.rightSideViewController.eidtPDFTextProperty.initData()
                 }
                 }
             }
             }
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
             return
             return
         }
         }
         
         
@@ -1381,6 +1382,8 @@ import Cocoa
         
         
         if self.listView.isEdited() {
         if self.listView.isEdited() {
             self._isPDFDocumentEdited = true
             self._isPDFDocumentEdited = true
+            
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
         }
         }
     }
     }