Browse Source

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

lizhe 10 months ago
parent
commit
9ab6ad1cdd

+ 3 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CPDFListStampAnnotation.swift

@@ -46,10 +46,12 @@ class CPDFListStampAnnotation: CPDFStampAnnotation {
                 self.bounds = bounds
                 self.bounds = bounds
             }
             }
             
             
-            if .image == self.stamp!.stampCategoryType {
+            if .image == self.stamp?.stampCategoryType {
                 self.updateAppearanceStream(with: self.pImage, rotation: newValue)
                 self.updateAppearanceStream(with: self.pImage, rotation: newValue)
             } else if let type = self.stamp?.stampCategoryType, type.rawValue == CPDFSignatureTypeImage && self.pImage != nil {
             } else if let type = self.stamp?.stampCategoryType, type.rawValue == CPDFSignatureTypeImage && self.pImage != nil {
                 self.updateAppearanceStream(with: self.pImage, rotation: newValue)
                 self.updateAppearanceStream(with: self.pImage, rotation: newValue)
+            } else if self.pImage != nil {
+                self.updateAppearanceStream(with: self.pImage, rotation: newValue)
             } else {
             } else {
                 self.updateAppearanceStream(newValue)
                 self.updateAppearanceStream(newValue)
             }
             }

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

@@ -4547,11 +4547,14 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                     CPDFListStampAnnotation *newAnnotation = nil;
                     CPDFListStampAnnotation *newAnnotation = nil;
                     if ([(CPDFListStampAnnotation*)an pImage]) {
                     if ([(CPDFListStampAnnotation*)an pImage]) {
                         newAnnotation = [[CPDFListStampAnnotation alloc] initWithDocument:self.document image:[(CPDFListStampAnnotation*)an pImage]];
                         newAnnotation = [[CPDFListStampAnnotation alloc] initWithDocument:self.document image:[(CPDFListStampAnnotation*)an pImage]];
-                        newAnnotation.bounds = an.bounds;
-                        [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:[(CPDFListStampAnnotation*)an stamp]];
-                        if ([(CPDFListStampAnnotation *)an stamp].stampCategoryType == 7) {
-                            [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithImage:[(CPDFListStampAnnotation*)an pImage]];
+                        newAnnotation.bounds = CGRectMake(an.bounds.origin.x + 10, an.bounds.origin.y - 10, an.bounds.size.width, an.bounds.size.height);
+                        
+                        if ([(CPDFListStampAnnotation*)an stamp] != nil) {
+                            [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithStamp:[(CPDFListStampAnnotation*)an stamp]];
                         }
                         }
+//                        if ([(CPDFListStampAnnotation *)an stamp].stampCategoryType == 7) {
+                            [(CPDFListStampAnnotation *)newAnnotation setBorderBoundsWithImage:[(CPDFListStampAnnotation*)an pImage]];
+//                        }
                     } else if ([(CPDFListStampAnnotation*)an stamp]) {
                     } else if ([(CPDFListStampAnnotation*)an stamp]) {
                         CStampSignatureObject *stamp = [(CPDFListStampAnnotation*)an stamp];
                         CStampSignatureObject *stamp = [(CPDFListStampAnnotation*)an stamp];
                         if (CPDFStampTypeStandard == stamp.stampCategoryType) {
                         if (CPDFStampTypeStandard == stamp.stampCategoryType) {