Browse Source

【注释】文本注释,默认显示和点击添加后的属性面板参数不一致,且添加后部分属性不显示参数 -- 修复

lizhe 11 months ago
parent
commit
7c46d56f74

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

@@ -2268,14 +2268,31 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     } else if (CAnnotationTypeFreeText == self.annotationType ||
                CAnnotationTypeSignText == self.annotationType) {
         //保存参数
-        KMEditPDFTextFontModel *model = [KMEditPDFTextManager.manager fetchUserDefaultDataWithTypeStringWithType:@"Commonly"];
-        NSString *fontName = [KMEditPDFTextManager.manager fetchFontNameWithFontName:model.fontName];
-        NSString *fontStyle = [KMEditPDFTextManager.manager fetchFontStyleWithFontName:model.fontName];
-        CGFloat size = model.fontSize;
+        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+        NSString *fontName = [KMEditPDFTextManager.manager fetchFontNameWithFontName: [defaults objectForKey:CFreeTextNoteFontNameKey]];
+        NSString *fontStyle = [KMEditPDFTextManager.manager fetchFontStyleWithFontName: [defaults objectForKey:CFreeTextNoteFontNameKey]];
+        CGFloat size = [[defaults objectForKey:CFreeTextNoteFontSizeKey] floatValue];
+        CGFloat opacity = [[defaults objectForKey:CFreeTextNoteOpacityKey] floatValue];
+//        CGFloat size = [[defaults objectForKey:CFreeTextNoteFontSizeKey] floatValue];
+//        defaults.safe_setColor(annotation.color, forKey: CFreeTextNoteColorKey)
+//        defaults.safe_setColor((annotation as! CPDFFreeTextAnnotation).fontColor, forKey: CFreeTextNoteFontColorKey)
+//        defaults.set((annotation as! CPDFFreeTextAnnotation).alignment.rawValue, forKey: CFreeTextNoteAlignmentKey)
+//        defaults.set((annotation as! CPDFFreeTextAnnotation).fontName(), forKey: CFreeTextNoteFontNameKey)
+//        defaults.set((annotation as! CPDFFreeTextAnnotation).fontSize(), forKey: CFreeTextNoteFontSizeKey)
+//        defaults.set(annotation.lineWidth(), forKey: CFreeTextNoteLineWidthKey)
+//        defaults.set(annotation.borderStyle().rawValue, forKey: CFreeTextNoteLineStyleKey)
+//        defaults.set(annotation.dashPattern(), forKey: CFreeTextNoteDashPatternKey)
+        
+        
+//        KMEditPDFTextFontModel *model = [KMEditPDFTextManager.manager fetchUserDefaultDataWithTypeStringWithType:@"Commonly"];
+//        NSString *fontName = [KMEditPDFTextManager.manager fetchFontNameWithFontName:model.fontName];
+//        NSString *fontStyle = [KMEditPDFTextManager.manager fetchFontStyleWithFontName:model.fontName];
+//        CGFloat size = model.fontSize;
         
         CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc] initWithAnnotationType:self.annotationType];
         annotationModel.fontName = [NSString stringWithFormat:@"%@-%@",fontName,fontStyle];
         annotationModel.fontSize = size;
+        annotationModel.opacity = opacity;
         
         CGFloat defaultWidth = annotationModel.fontSize;
         CGFloat defaultHeight = annotationModel.fontSize;
@@ -2288,6 +2305,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
         annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:bounds];
         if (self.annotationType == CAnnotationTypeFreeText) {
             ((CPDFFreeTextAnnotation *)annotation).font = [NSFont fontWithName:fontName size:fontSize];
+            annotation.opacity = opacity;
         }
         originalBounds = [annotation bounds];
         if (annotation) {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -579,7 +579,7 @@ let KMColorPickerViewHeight: CGFloat = 64
     
     var annotation: CPDFAnnotation {
         get {
-            return (annotationModel?.annotation)!
+            return annotationModel?.annotation ?? CPDFAnnotation()
         }
     }
     

File diff suppressed because it is too large
+ 5896 - 10623
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist