Browse Source

注释 - 修改文本注释右键创建需要进入编辑状态

wanjun 1 year ago
parent
commit
6be1a2aa68

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -1950,7 +1950,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
         bounds = CPDFListViewConstrainRect(bounds, page.bounds,[CPDFListViewConfig defaultManager].annotationBorderOffset.floatValue);
         annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:bounds];
         originalBounds = [annotation bounds];
-        if(annotation) {
+        if (annotation) {
             [self updateActiveAnnotations:@[annotation]];
         }
     } else if((CAnnotationTypeStamp == self.annotationType ||

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

@@ -556,6 +556,10 @@ extension KMMainViewController {
                     let defaultSize = self.listView.defaultSize(with: .freeText, in: self.listView.currentPage())
                     let bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize)
                     annotation = self.listView.addAnnotation(with: .freeText, selection: nil, page: self.listView.currentPage(), bounds: bounds)
+                    if ((annotation) != nil) {
+                        self.listView.updateActiveAnnotations([annotation!])
+                        self.listView.edit(annotation)
+                    }
                 case 2:
 //                    self.listView.annotationType = CAnnotationType.anchored
                     let defaultSize = self.listView.defaultSize(with: .anchored, in: self.listView.currentPage())
@@ -613,6 +617,10 @@ extension KMMainViewController {
                     let bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize)
                     annotation = self.listView.addAnnotation(with: .freeText, selection: nil, page: self.listView.currentPage(), bounds: bounds)
 //                    self.view.window?.makeFirstResponder()
+                    if ((annotation) != nil) {
+                        self.listView.updateActiveAnnotations([annotation!])
+                        self.listView.edit(annotation)
+                    }
                 case 2:
 //                    self.listView.annotationType = CAnnotationType.anchored
                     let defaultSize = self.listView.defaultSize(with: .anchored, in: self.listView.currentPage())