Browse Source

【注释】复制图片后,在阅读页粘贴,头两次操作崩溃,后续没有复现 -- 修复

lizhe 11 months ago
parent
commit
27f60f01a2

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

@@ -4047,9 +4047,16 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                         }
                         newAnnotation.bounds = bounds;
                         [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:stamp];
+                    } else if (((CPDFStampAnnotation*)an).stampImage) {
+                        newAnnotation = [[CPDFListStampAnnotation alloc] initWithDocument:self.document image:((CPDFStampAnnotation*)an).stampImage];
+                        newAnnotation.bounds = CGRectMake(an.bounds.origin.x + 10, an.bounds.origin.y - 10, an.bounds.size.width, an.bounds.size.height);
+//                        [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:((CPDFStampAnnotation*)an).stampImage];
                     }
+                    
                     [self addAnnotation:newAnnotation toPage:page];
-                    [self addActiveAnnotations:@[newAnnotation]];
+                    if (newAnnotation != nil) {
+                        [self addActiveAnnotations:@[newAnnotation]];
+                    }
                 } else if ([an isKindOfClass:[CPDFLinkAnnotation class]]) {
                     CPDFLinkAnnotation *newAnnotation = [an copy];
                     if([(CPDFLinkAnnotation *)an URL]) {