Просмотр исходного кода

【2025】【Link】创建注释相关

dinglingui 2 месяцев назад
Родитель
Сommit
97c6f90f32

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

@@ -218,26 +218,26 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
         [self doDrawRedactErasureWithEvent:theEvent];
     } else if (CDigitalSignToolMode == self.toolMode) {
         [self doFormWithEvent:theEvent];
+    } else if (CEditLinkToolMode == self.toolMode) {
+        if (self.isSetLinkDestinationArea) {
+            [self doDrawLinkDestinationAreaWithEvent:theEvent];
+        } else {
+            NSPoint newpoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+            CPDFAreaOfInterest area1 = [self areaOfInterestForPoint:newpoint];
+            if (area1 & CPDFTextArea) {
+                [super mouseDown:theEvent];
+                [self doMarkUpWithEvent:theEvent];
+                [self setCurrentSelection:nil];
+            } else {
+                [self doDrawLinkNoteWithEvent:theEvent];
+            }
+        }
     } else if ((CNoteToolMode == self.toolMode && ![CPDFListView isMarkupAnnotationType:self.annotationType] && CAnnotationTypeUnkown != self.annotationType) ||
-               CFormToolMode == self.toolMode) {
+                CFormToolMode == self.toolMode) {
         if (CAnnotationTypeEraser == self.annotationType) {
             [self doEraseAnnotationsWithEvent:theEvent];
         } else if (CAnnotationTypeInk == self.annotationType) {
             [self doDrawFreehandNoteWithEvent:theEvent];
-        } else if(CAnnotationTypeLink == self.annotationType ) {
-            if (self.isSetLinkDestinationArea) {
-                [self doDrawLinkDestinationAreaWithEvent:theEvent];
-            } else {
-                NSPoint newpoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
-                CPDFAreaOfInterest area1 = [self areaOfInterestForPoint:newpoint];
-                if (area1 & CPDFTextArea) {
-                    [super mouseDown:theEvent];
-                    [self doMarkUpWithEvent:theEvent];
-                    [self setCurrentSelection:nil];
-                } else {
-                    [self doDrawLinkNoteWithEvent:theEvent];
-                }
-            }
         } else if (self.toolMode == CFormToolMode) {
             NSPoint p = [theEvent locationInWindow];
             NSPoint currentPoint = [self convertPoint:p fromView:nil];
@@ -475,7 +475,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             if([newActiveAnnotation isKindOfClass:[CPDFLinkAnnotation class]]) {
                 if(self.popOver == nil && (CTextToolMode == self.toolMode ||
                                            CMoveToolMode == self.toolMode ||
-                                           CEditPDFToolLink == self.toolMode)) {
+                                           CEditLinkToolMode == self.toolMode)) {
                     CPDFLinkAnnotation *linkNewAnnotation = (CPDFLinkAnnotation *)newActiveAnnotation;
                     if(linkNewAnnotation.destination != nil) {
                         [[KMImageToolTipWindow shared] showForImageContext:linkNewAnnotation at:NSZeroPoint];
@@ -490,7 +490,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                     }
                 }
                 
-                if(!(CTextToolMode == self.toolMode || CEditPDFToolLink == self.toolMode || CMoveToolMode == self.toolMode)) {
+                if(!(CTextToolMode == self.toolMode || CEditLinkToolMode == self.toolMode || CMoveToolMode == self.toolMode)) {
                     clickNewActiveAnnotation = nil;
                 }
             } else if([newActiveAnnotation isKindOfClass:[CPDFRedactAnnotation class]]) {
@@ -771,7 +771,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                     self.hoverAnnotation = nil;
                     [self setNeedsDisplayAnnotation:annotation];
                 }
-                if([self toolMode] != CEditPDFToolLink) {
+                if([self toolMode] != CEditLinkToolMode) {
                     annotation = nil;
                 }
             }

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -103,7 +103,7 @@ typedef NS_ENUM(NSInteger, CToolMode) {
     CSelectZoomToolMode,      //区域放大模式
     CFormToolMode,            //Form模式
     CEditPDFToolMode,         //内容编辑模式
-    CEditPDFToolLink,         //添加Link注释模式
+    CEditLinkToolMode,         //添加Link注释模式
     CRedactToolMode,          //密文模式
     CRedactErasureToolMode,   //密文擦除
     CDigitalSignToolMode,     //数字签名

+ 2 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -543,7 +543,7 @@ struct KMNMWCFlags {
                 listView.change(.image)
                 
             } else if subToolMode == .Edit_Link {
-                listView.toolMode = .CEditPDFToolLink
+                listView.toolMode = .CEditLinkToolMode
                 
                 listView.annotationType = .link
                 
@@ -4007,7 +4007,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
                 properties.readactAnnotation = redactAnnotation
                 self.km_beginSheet(windowC: properties)
                 properties.callback = { [weak self] annotation in
-                    if let page = annotation.page {
+                    if let page = annotation?.page {
                         self?.listView.setNeedsDisplayAnnotationViewFor(page)
                     }
                 }