Kaynağa Gözat

【文字图片编辑】添加通知,刷新注释缩图(图片)。 图片点击添加位置优化

lizhe 1 yıl önce
ebeveyn
işleme
ea481dca86

+ 18 - 5
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -1318,7 +1318,9 @@ import Cocoa
                     self.rightSideViewController.eidtPDFTextProperty.initData()
                 }
             }
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            if self.listView.annotationType != .addText {
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            }
             return
         }
         
@@ -1383,7 +1385,9 @@ import Cocoa
         if self.listView.isEdited() {
             self._isPDFDocumentEdited = true
             
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            if self.listView.annotationType != .addText {
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
+            }
         }
     }
     
@@ -1412,7 +1416,7 @@ import Cocoa
                         var previewSize = rect.size
                         var isChangeSize = false
                         if previewSize.width == 0 && previewSize.height == 0 {
-                            previewSize = CGSize(width: 500, height: 500)
+                            previewSize = CGSize(width: 400, height: 400)
                             isChangeSize = true
                         }
                         
@@ -1447,9 +1451,11 @@ import Cocoa
                                                height: imageRect.height * pageScale)
                         }
                         
-                        if imageRect.origin.x < 0 ||
-                            imageRect.origin.y < 0 {
+                        if imageRect.origin.x < 0 {
                             imageRect.origin.x = 5
+                        }
+                        
+                        if imageRect.origin.y < 0 {
                             imageRect.origin.y = 5
                         }
                         
@@ -1466,6 +1472,9 @@ import Cocoa
                         DispatchQueue.main.async {
                             self.listView.createImagePath(filePath, rect: imageRect, page: pdfView.currentPage())
                             self.isPDFTextImageEdited = true
+                            self.asyncSaveDocument { params in
+                                
+                            }
                         }
                     }
                 }
@@ -1508,6 +1517,10 @@ import Cocoa
         if self.rightSideViewController != nil && self.rightSideViewController.subViewType == .EditPDFAddText && self.listView.annotationType == .addText {
             self.rightSideViewController.eidtPDFTextProperty.refreshSelectAreaProperty(needDefaultData: true)
         }
+        
+        self.asyncSaveDocument { params in
+            
+        }
     }
     
     func pdfListViewKeyDownIsContinue(_ pdfListView: CPDFListView!, theEvent: NSEvent!) -> Bool {