Browse Source

【2025】【Markup】图形,线段注释属性列表自测处理

niehaoyu 3 months ago
parent
commit
710b8db4e2
16 changed files with 212 additions and 199 deletions
  1. 3 0
      PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorGroup.swift
  2. 20 12
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationConfig.swift
  3. 19 11
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFCircleAnnotation+PDFListView.swift
  4. 17 10
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift
  5. 11 6
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFInkAnnotation+PDFListView.swift
  6. 44 14
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift
  7. 30 5
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFMarkupAnnotation+PDFListView.swift
  8. 14 17
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFPolylineAnnotation+PDFListView.swift
  9. 17 11
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFSquareAnnotation+PDFListView.swift
  10. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFTextAnnotation+PDFListView.swift
  11. 0 21
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+AnnotationsCompare.swift
  12. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Eraser/KMEraserController.swift
  13. 7 2
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/KMRightSideController.swift
  14. 5 0
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Line/KMLineController.swift
  15. 1 1
      PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Note/KMNoteController.swift
  16. 22 87
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 3 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Color/ComponentCColorGroup.swift

@@ -103,6 +103,9 @@ public class ComponentCColorGroup: ComponentBaseXibView {
                     if itemView.properties?.color?.colorToHexString() == currentColor?.colorToHexString() {
                         itemView.properties?.state = .pressed
                         isPressed = true
+                    } else if itemView.properties?.color?.colorToHexString() == "#00000000" && currentColor == nil {
+                        itemView.properties?.state = .pressed
+                        isPressed = true
                     } else {
                         itemView.properties?.state = .normal
                     }

+ 20 - 12
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationConfig.swift

@@ -15,7 +15,7 @@ class CPDFAnnotationConfig: NSObject {
         super.init()
         
     }
-
+    
     //MARK: - Common
     //Color
     func setColor(_ color: NSColor, toType type: CAnnotationType) {
@@ -53,7 +53,7 @@ class CPDFAnnotationConfig: NSObject {
     
     //Opacity
     func setOpacity(_ opacity: CGFloat, toType type: CAnnotationType) {
-         if type == .highlight {
+        if type == .highlight {
             CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CHighlightNoteOpacityKey)
         } else if type == .strikeOut {
             CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CStrikeOutNoteOpacityKey)
@@ -67,14 +67,22 @@ class CPDFAnnotationConfig: NSObject {
     }
     
     func opacityWithType(_ type: CAnnotationType) -> CGFloat {
-         if type == .highlight {
-            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CHighlightNoteOpacityKey)
-       } else if type == .strikeOut {
-           return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CStrikeOutNoteOpacityKey)
+        if type == .highlight {
+            if let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CHighlightNoteOpacityKey) {
+                return value
+            }
+        } else if type == .strikeOut {
+            if let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CStrikeOutNoteOpacityKey) {
+                return value
+            }
         } else if type == .underline {
-           return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CUnderlineNoteOpacityKey)
+            if let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CUnderlineNoteOpacityKey) {
+                return value
+            }
         } else if type == .ink {
-           return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey)
+            if let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey) {
+                return value
+            }
         }
         return 1
     }
@@ -117,13 +125,13 @@ extension CPDFAnnotationConfig {
     }
     
     //MARK: - Float
-    class func getDefaultFloatValue(forKey key: String) -> CGFloat {
+    class func getDefaultFloatValue(forKey key: String) -> CGFloat? {
         if let value = UserDefaults.standard.value(forKey: key) {
             if let data = value as? CGFloat {
                 return data
             }
         }
-        return 1.0
+        return nil
     }
     
     class func setDefaultFloatValue(_ value: CGFloat, toKey key: String) {
@@ -132,13 +140,13 @@ extension CPDFAnnotationConfig {
     }
     
     //MARK: - Int
-    class func getDefaultIntValue(forKey key: String) -> Int {
+    class func getDefaultIntValue(forKey key: String) -> Int? {
         if let value = UserDefaults.standard.value(forKey: key) {
             if let data = value as? Int {
                 return data
             }
         }
-        return 0
+        return nil
     }
     
     class func setDefaultIntValue(_ value: Int, toKey key: String) {

+ 19 - 11
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFCircleAnnotation+PDFListView.swift

@@ -13,6 +13,7 @@ import Foundation
         
         self.color = CPDFCircleAnnotation.defaultColor()
         self.opacity = CPDFCircleAnnotation.defaultOpacity()
+        
         self.interiorColor = CPDFCircleAnnotation.defaultInteriorColor()
         self.interiorOpacity = CPDFCircleAnnotation.defaultInteriorOpacity()
         
@@ -170,11 +171,11 @@ extension CPDFCircleAnnotation {
     }
     
     class func defaultOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteOpacityKey) ?? 1
     }
     
     class func defaultInteriorOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteInteriorOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteInteriorOpacityKey) ?? 1
     }
     
     class func defaultBorder() -> CPDFBorder {
@@ -186,17 +187,25 @@ extension CPDFCircleAnnotation {
     }
     
     class func defaultLineStyle() -> CPDFBorderStyle {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CCircleNoteLineStyleKey)
-        let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CCircleNoteLineStyleKey) {
+            let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
+            return style
+        }
+        return .solid
     }
     
     class func defaultLineWidth() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteLineWidthKey)
+        if let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CCircleNoteLineWidthKey) {
+            return value
+        }
+        return 2
     }
     
     class func defaultDashPattern() -> [NSNumber] {
-        return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CCircleNoteDashPatternKey) as? [NSNumber] ?? []
+        if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CCircleNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+            return array
+        }
+        return [1]
     }
     
     //MARK: -Update
@@ -226,18 +235,15 @@ extension CPDFCircleAnnotation {
         let opacity = resultColor.getAlphaComponent()
         for annotation in annotations {
             if opacity < 0.01 {
-                annotation.interiorColor = NSColor.black
-                annotation.interiorOpacity = 0
+                annotation.interiorColor = NSColor.clear
             } else {
                 annotation.interiorColor = resultColor
-                annotation.interiorOpacity = opacity
             }
         }
         
         pdfView.setNeedsDisplayMultiAnnotations(annotations)
         
         CPDFAnnotationConfig.setDefaultColor(resultColor, toKey: CCircleNoteInteriorColorKey)
-        CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CCircleNoteInteriorOpacityKey)
         
     }
     
@@ -247,10 +253,12 @@ extension CPDFCircleAnnotation {
         }
         for annotation in annotations {
             annotation.opacity = opacity
+            annotation.interiorOpacity = opacity
         }
         pdfView.setNeedsDisplayMultiAnnotations(annotations)
 
         CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CCircleNoteOpacityKey)
+        CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CCircleNoteInteriorOpacityKey)
     }
     
     class func updateStyle(_ annotations: [CPDFCircleAnnotation], _ style: CPDFBorderStyle, withPDFView pdfView: CPDFListView?) {

+ 17 - 10
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift

@@ -218,13 +218,15 @@ extension CPDFFreeTextAnnotation {
     }
     
     class func defaultFontSize() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteFontSizeKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteFontSizeKey) ?? 1
     }
     
     class func defaultFontAlignment() -> NSTextAlignment {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CFreeTextNoteAlignmentKey)
-        let style: NSTextAlignment = NSTextAlignment(rawValue: styleKey) ?? .left
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CFreeTextNoteAlignmentKey) {
+            let style: NSTextAlignment = NSTextAlignment(rawValue: styleKey) ?? .left
+            return style
+        }
+        return .left
     }
     
     class func defaultFontColor() -> NSColor {
@@ -249,7 +251,7 @@ extension CPDFFreeTextAnnotation {
     }
     
     class func defaultOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteOpacityKey) ?? 1
     }
     
     class func defaultBorder() -> CPDFBorder {
@@ -261,17 +263,22 @@ extension CPDFFreeTextAnnotation {
     }
     
     class func defaultLineStyle() -> CPDFBorderStyle {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CFreeTextNoteLineStyleKey)
-        let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CFreeTextNoteLineStyleKey) {
+            let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
+            return style
+        }
+        return .solid
     }
     
     class func defaultLineWidth() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteLineWidthKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CFreeTextNoteLineWidthKey) ?? 2
     }
     
     class func defaultDashPattern() -> [NSNumber] {
-        return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CFreeTextNoteDashPatternKey) as? [NSNumber] ?? []
+        if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CFreeTextNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+            return array
+        }
+        return [1]
     }
     
     //MARK: - Update

+ 11 - 6
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFInkAnnotation+PDFListView.swift

@@ -406,7 +406,7 @@ extension CPDFInkAnnotation {
     }
     
     class func defaultOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey) ?? 1
     }
     
     class func defaultBorder() -> CPDFBorder {
@@ -418,17 +418,22 @@ extension CPDFInkAnnotation {
     }
     
     class func defaultLineStyle() -> CPDFBorderStyle {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CInkNoteLineStyleKey)
-        let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CInkNoteLineStyleKey) {
+            let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
+            return style
+        }
+        return .solid
     }
     
     class func defaultLineWidth() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteLineWidthKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteLineWidthKey) ?? 2
     }
     
     class func defaultDashPattern() -> [NSNumber] {
-        return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CInkNoteDashPatternKey) as? [NSNumber] ?? []
+        if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CInkNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+            return array
+        }
+        return [1]
     }
      
     //MARK: -update

+ 44 - 14
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift

@@ -536,10 +536,32 @@ extension CPDFLineAnnotation {
     }
 }
 
+//MARK: - Compare
+extension CPDFLineAnnotation {
+    //判断注释中是否同时存在箭头跟线段
+    class func isLineAnnotationsContainMultiType(_ annotations: [CPDFLineAnnotation]) -> Bool {
+        if annotations.count < 2 {
+            return false
+        }
+        
+        guard let firstAnnotation = annotations.first else {
+            return false
+        }
+        let typeStr = firstAnnotation.type
+        
+        for annotation in annotations {
+            if firstAnnotation != annotation {
+                if typeStr != annotation.type {
+                    return true
+                }
+            }
+        }
+        return false
+    }
+}
 
-//MARK: - Update
+//MARK: - Default Value
 extension CPDFLineAnnotation {
-    //MARK: -Default默认值
     class func defaultColor(_ annotationType: CAnnotationType) -> NSColor {
         if annotationType == .line {
             if let color = CPDFAnnotationConfig.getDefaultColor(forKey: CLineNoteColorKey) {
@@ -555,9 +577,9 @@ extension CPDFLineAnnotation {
     
     class func defaultOpacity(_ annotationType: CAnnotationType) -> CGFloat {
         if annotationType == .line {
-            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CLineNoteOpacityKey)
+            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CLineNoteOpacityKey) ?? 1
         } else if annotationType == .arrow {
-            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CArrowNoteOpacityKey)
+            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CArrowNoteOpacityKey) ?? 1
         }
         return 1
     }
@@ -573,10 +595,10 @@ extension CPDFLineAnnotation {
     class func defaultLineStyle(_ annotationType: CAnnotationType) -> CPDFBorderStyle {
         var style: CPDFBorderStyle = .solid
         if annotationType == .line {
-            let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CLineNoteLineStyleKey)
+            let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CLineNoteLineStyleKey) ?? 0
             style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
         } else if annotationType == .arrow {
-            let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteLineStyleKey)
+            let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteLineStyleKey) ?? 0
             style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
         }
         return style
@@ -584,18 +606,22 @@ extension CPDFLineAnnotation {
     
     class func defaultLineWidth(_ annotationType: CAnnotationType) -> CGFloat {
         if annotationType == .line {
-            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CLineNoteLineWidthKey)
+            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CLineNoteLineWidthKey) ?? 2
         } else if annotationType == .arrow {
-            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CArrowNoteLineWidthKey)
+            return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CArrowNoteLineWidthKey) ?? 2
         }
-        return 1
+        return 2
     }
     
     class func defaultDashPattern(_ annotationType: CAnnotationType) -> [NSNumber] {
         if annotationType == .line {
-            return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CLineNoteDashPatternKey) as? [NSNumber] ?? []
+            if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CLineNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+                return array
+            }
         } else if annotationType == .arrow {
-            return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CArrowNoteDashPatternKey) as? [NSNumber] ?? []
+            if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CArrowNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+                return array
+            }
         }
         return [1]
     }
@@ -603,7 +629,7 @@ extension CPDFLineAnnotation {
     class func defaultArrow_StartLineStyle() -> CPDFLineStyle {
         var style: CPDFLineStyle = .none
         
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteStartStyleKey)
+        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteStartStyleKey) ?? 0
         style = CPDFLineStyle(rawValue: styleKey) ?? .none
         
         return style
@@ -612,13 +638,17 @@ extension CPDFLineAnnotation {
     class func defaultArrow_EndLineStyle() -> CPDFLineStyle {
         var style: CPDFLineStyle = .none
         
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteEndStyleKey)
+        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CArrowNoteEndStyleKey) ?? 1
         style = CPDFLineStyle(rawValue: styleKey) ?? .none
         
         return style
     }
     
-    //MARK: - Update
+}
+
+//MARK: - Update
+extension CPDFLineAnnotation {
+    
     class func updateColor(_ annotations: [CPDFLineAnnotation], _ color: NSColor?, withPDFView pdfView: CPDFListView?, isArrow: Bool = false) {
         guard let resultColor = color else {
             return

+ 30 - 5
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFMarkupAnnotation+PDFListView.swift

@@ -388,18 +388,43 @@ class CPDFAnnotationMarkupExtraIvars: NSObject {
     }
 }
 
-//MARK: - Update
+//MARK: -判断Markup注释是否存在不同类型
 extension CPDFMarkupAnnotation {
-    
-    class func defaultColor(_ type: CAnnotationType) -> NSColor {
+    class func isMarkupAnnotationsContainMultiType(_ annotations: [CPDFMarkupAnnotation]) -> Bool {
+        if annotations.count < 2 {
+            return false
+        }
+        
+        guard let firstAnnotation = annotations.first else {
+            return false
+        }
+        let markupType = firstAnnotation.markupType()
+        
+        for annotation in annotations {
+            if firstAnnotation != annotation {
+                if markupType != annotation.markupType() {
+                    return true
+                }
+            }
+        }
+        return false
+    }
+}
+
+//MARK: - DefaultInfo
+extension CPDFMarkupAnnotation {
+     class func defaultColor(_ type: CAnnotationType) -> NSColor {
         return CPDFAnnotationConfig.standard.colorWithType(type) ?? NSColor(red: 255/255.0, green: 229/255.0, blue: 0, alpha: 1)
     }
     
     class func defaultOpacity(_ type: CAnnotationType) -> CGFloat {
         return CPDFAnnotationConfig.standard.opacityWithType(type)
     }
-    
-    //Update
+}
+
+//MARK: - Update
+extension CPDFMarkupAnnotation {
+
     class func update(_ annotations: [CPDFMarkupAnnotation], _ color: NSColor?, PDFView pdfView: CPDFListView?) {
         guard let resultColor = color else {
             return

+ 14 - 17
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFPolylineAnnotation+PDFListView.swift

@@ -112,9 +112,9 @@ import Foundation
     }
 }
 
-//Default MeasureInfo
+//MARK: -Default默认值
 extension CPDFPolygonAnnotation {
-    //MARK: -Default默认值
+
     class func defaultColor() -> NSColor {
         if let color = CPDFAnnotationConfig.getDefaultColor(forKey: CInkNoteColorKey) {
             return color
@@ -123,29 +123,26 @@ extension CPDFPolygonAnnotation {
     }
     
     class func defaultOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteOpacityKey) ?? 1
     }
-    
-//    class func defaultBorder() -> CPDFBorder {
-//        let lineWidth = CPDFInkAnnotation.defaultLineWidth()
-//        let dashPattern = CPDFInkAnnotation.defaultDashPattern()
-//        let style = CPDFInkAnnotation.defaultLineStyle()
-//        
-//        return CPDFBorder(style: style, lineWidth: lineWidth, dashPattern: dashPattern)
-//    }
-    
+     
     class func defaultLineStyle() -> CPDFBorderStyle {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CInkNoteLineStyleKey)
-        let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CInkNoteLineStyleKey) {
+            let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
+            return style
+        }
+        return .solid
     }
     
     class func defaultLineWidth() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteLineWidthKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CInkNoteLineWidthKey) ?? 2
     }
     
     class func defaultDashPattern() -> [NSNumber] {
-        return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CInkNoteDashPatternKey) as? [NSNumber] ?? []
+        if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CInkNoteDashPatternKey) as? [NSNumber], array.count > 1 {
+            return array
+        }
+        return [1]
     }
      
 }

+ 17 - 11
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFSquareAnnotation+PDFListView.swift

@@ -13,6 +13,7 @@ import Foundation
         
         self.color = CPDFSquareAnnotation.defaultColor()
         self.opacity = CPDFSquareAnnotation.defaultOpacity()
+        
         self.interiorColor = CPDFSquareAnnotation.defaultInteriorColor()
         self.interiorOpacity = CPDFSquareAnnotation.defaultInteriorOpacity()
         
@@ -151,11 +152,11 @@ extension CPDFSquareAnnotation {
     }
     
     class func defaultOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteOpacityKey) ?? 1
     }
     
     class func defaultInteriorOpacity() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteInteriorOpacityKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteInteriorOpacityKey) ?? 1
     }
     
     class func defaultBorder() -> CPDFBorder {
@@ -167,17 +168,22 @@ extension CPDFSquareAnnotation {
     }
     
     class func defaultLineStyle() -> CPDFBorderStyle {
-        let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CSquareNoteLineStyleKey)
-        let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
-        return style
+        if let styleKey = CPDFAnnotationConfig.getDefaultIntValue(forKey: CSquareNoteLineStyleKey) {
+            let style = CPDFBorderStyle(rawValue: styleKey) ?? .solid
+            return style
+        }
+        return .solid
     }
     
     class func defaultLineWidth() -> CGFloat {
-        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteLineWidthKey)
+        return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CSquareNoteLineWidthKey) ?? 2
     }
     
     class func defaultDashPattern() -> [NSNumber] {
-        return CPDFAnnotationConfig.getDefaultArrayValue(forKey: CSquareNoteDashPatternKey) as? [NSNumber] ?? []
+        if let array = CPDFAnnotationConfig.getDefaultArrayValue(forKey: CSquareNoteDashPatternKey) as? [NSNumber], array.count > 0 {
+            return array
+        }
+        return [1]
     }
     
     //MARK: -Update
@@ -207,17 +213,14 @@ extension CPDFSquareAnnotation {
         let opacity = resultColor.getAlphaComponent()
         for annotation in annotations {
             if opacity < 0.01 {
-                annotation.interiorColor = NSColor.black
-                annotation.interiorOpacity = 0
+                annotation.interiorColor = nil
             } else {
                 annotation.interiorColor = resultColor
-                annotation.interiorOpacity = opacity
             }
         }
         pdfView.setNeedsDisplayMultiAnnotations(annotations)
         
         CPDFAnnotationConfig.setDefaultColor(resultColor, toKey: CSquareNoteInteriorColorKey)
-        CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CSquareNoteInteriorOpacityKey)
         
     }
     
@@ -227,10 +230,13 @@ extension CPDFSquareAnnotation {
         }
         for annotation in annotations {
             annotation.opacity = opacity
+            annotation.interiorOpacity = opacity
         }
         pdfView.setNeedsDisplayMultiAnnotations(annotations)
 
         CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CSquareNoteOpacityKey)
+        CPDFAnnotationConfig.setDefaultFloatValue(opacity, toKey: CSquareNoteInteriorOpacityKey)
+
     }
     
     class func updateStyle(_ annotations: [CPDFSquareAnnotation], _ style: CPDFBorderStyle, withPDFView pdfView: CPDFListView?) {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFTextAnnotation+PDFListView.swift

@@ -230,7 +230,7 @@ extension CPDFTextAnnotation {
     }
     
     class func defaultType() -> CPDFTextAnnotationIconType {
-        return CPDFTextAnnotationIconType(rawValue: CPDFAnnotationConfig.getDefaultIntValue(forKey: CAnchoredNoteIconTypeKey)) ?? .comment
+        return CPDFTextAnnotationIconType(rawValue: CPDFAnnotationConfig.getDefaultIntValue(forKey: CAnchoredNoteIconTypeKey) ?? 0) ?? .comment
     }
     
     class func updateColor(_ annotations: [CPDFTextAnnotation], _ color: NSColor?, withPDFView pdfView: CPDFListView?) {

+ 0 - 21
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+AnnotationsCompare.swift

@@ -52,27 +52,6 @@ extension CPDFListView {
         return false
     }
     
-    //MARK: -判断Markup注释是否存在不同类型
-    class func isMarkupAnnotationsContainMultiType(_ annotations: [CPDFMarkupAnnotation]) -> Bool {
-        if annotations.count < 2 {
-            return false
-        }
-        
-        guard let firstAnnotation = annotations.first else {
-            return false
-        }
-        let markupType = firstAnnotation.markupType()
-        
-        for annotation in annotations {
-            if firstAnnotation != annotation {
-                if markupType != annotation.markupType() {
-                    return true
-                }
-            }
-        }
-        return false
-    }
-    
     //MARK: -比较注释中是否存在不同属性的参数
     static func isAnnotationsContainMultiType(_ annotations: [CPDFAnnotation], withType type: CPDFAnnotationCompareType) -> Bool {
         if annotations.count < 2 {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Eraser/KMEraserController.swift

@@ -59,7 +59,7 @@ class KMEraserController: NSViewController {
     
     
     func reloadData() {
-        let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CEraserkNoteLineWidthKey)
+        let value = CPDFAnnotationConfig.getDefaultFloatValue(forKey: CEraserkNoteLineWidthKey) ?? 7
         
         let percent: CGFloat = (CGFloat(value) - 6)/12
         eraserSlider.properties.percent = percent

+ 7 - 2
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/KMRightSideController.swift

@@ -406,9 +406,14 @@ class KMRightSideController: NSViewController {
         headerBGView.isHidden = false
         
         if contentViewController is KMHighlightController {
-             if CPDFListView.isMarkupAnnotationsContainMultiType((contentViewController as! KMHighlightController).getValidAnnotations()) {
+            if CPDFMarkupAnnotation.isMarkupAnnotationsContainMultiType((contentViewController as! KMHighlightController).getValidAnnotations()) {
                 infoContendTopConst.constant = 0
-                 headerBGView.isHidden = true
+                headerBGView.isHidden = true
+            }
+        } else if contentViewController is KMLineController {
+            if CPDFLineAnnotation.isLineAnnotationsContainMultiType((contentViewController as! KMLineController).getValidAnnotations()) {
+                infoContendTopConst.constant = 0
+                headerBGView.isHidden = true
             }
         }
         

+ 5 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Line/KMLineController.swift

@@ -58,6 +58,11 @@ class KMLineController: NSViewController {
         setupProperty()
     }
     
+    
+    func getValidAnnotations() -> [CPDFLineAnnotation] {
+        return annotations
+    }
+    
     func setupProperty() {
         
         //Color

+ 1 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Note/KMNoteController.swift

@@ -137,7 +137,7 @@ class KMNoteController: NSViewController {
         } else {
             var multiColor: Bool = CPDFListView.isAnnotationsContainMultiType(annotations, withType: .color)
             if multiColor == true {
-                colorGroup.currentColor = NSColor.clear
+                colorGroup.currentColor = nil
             } else {
                 if let annotation = firstAnnotation {
                     colorGroup.currentColor = annotation.color

+ 22 - 87
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3043,68 +3043,20 @@
                   endingLineNumber = "4106"
                   offsetFromSymbolStart = "720">
                </Location>
-            </Locations>
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "C11A5EAB-3C0F-444C-8EDC-40823949B391"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "4397"
-            endingLineNumber = "4397"
-            landmarkName = "showMeasureFloatingWindowsIfNeed()"
-            landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "C11A5EAB-3C0F-444C-8EDC-40823949B391 - 2bfd24d913332e29"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMMainViewController.showMeasureFloatingWindowsIfNeed() -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMMainViewController.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "4398"
-                  endingLineNumber = "4398"
-                  offsetFromSymbolStart = "428">
-               </Location>
-               <Location
-                  uuid = "C11A5EAB-3C0F-444C-8EDC-40823949B391 - 2bfd24d913332e48"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMMainViewController.showMeasureFloatingWindowsIfNeed() -&gt; ()"
-                  moduleName = "PDF Reader Pro"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMMainViewController.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "4397"
-                  endingLineNumber = "4397"
-                  offsetFromSymbolStart = "332">
-               </Location>
                <Location
-                  uuid = "C11A5EAB-3C0F-444C-8EDC-40823949B391 - 2bfd24d913332e48"
+                  uuid = "92759DD6-8CD9-4B54-BF74-D83EF6A6D5A5 - 8f899cce43942cda"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
-                  symbolName = "PDF_Reader_Pro.KMMainViewController.showMeasureFloatingWindowsIfNeed() -&gt; ()"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.awakeFromNibFunction() -&gt; ()"
                   moduleName = "PDF Reader Pro"
                   usesParentBreakpointCondition = "Yes"
                   urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMMainViewController.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "4397"
-                  endingLineNumber = "4397"
-                  offsetFromSymbolStart = "264">
+                  startingLineNumber = "4107"
+                  endingLineNumber = "4107"
+                  offsetFromSymbolStart = "652">
                </Location>
             </Locations>
          </BreakpointContent>
@@ -3154,6 +3106,21 @@
                   endingLineNumber = "4440"
                   offsetFromSymbolStart = "4420">
                </Location>
+               <Location
+                  uuid = "4E0E8246-D746-4D5F-A4A2-89C78AEA0880 - 1c7307af3eb0a992"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.enterRedact() -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/KMClass/KMPDFViewController/KMMainViewController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "4438"
+                  endingLineNumber = "4438"
+                  offsetFromSymbolStart = "3852">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
@@ -4197,22 +4164,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "C9F570EA-94AB-4BA7-8009-FC7712F398A9"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Line/KMLineController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "457"
-            endingLineNumber = "457"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -4469,22 +4420,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "BE47B4EE-C4B4-450E-A784-397E3BFFBCD7"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/Controller/ComponentCSelectorItem.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "201"
-            endingLineNumber = "201"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -4529,8 +4464,8 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "1135"
             endingLineNumber = "1135"
-            landmarkName = "popoverWillClose(_:)"
-            landmarkType = "7">
+            landmarkName = "KMNPopOperationWindowController"
+            landmarkType = "21">
             <Locations>
                <Location
                   uuid = "E82D6160-482C-43EB-9E78-7C3112283FF8 - c3eff9a377a5c662"