Explorar el Código

【2025】【Edit】Edit模块自测完善

niehaoyu hace 5 días
padre
commit
b3a388b7d6

+ 6 - 6
PDF Office/KMComponentLibrary/KMComponentLibrary/View/Controller/Position/ComponentCPosition.swift

@@ -130,8 +130,8 @@ public class ComponentCPosition: ComponentBaseXibView {
         let rows = properties.rowCount
         let columns = properties.columnCount
         
-        itemHeight = (bounds.size.height-CGFloat(rows)+1)/CGFloat(rows)
-        itemWidth = (bounds.size.width-CGFloat(columns)+1)/CGFloat(columns)
+        itemHeight = (bounds.size.height-CGFloat(rows)-1)/CGFloat(rows)
+        itemWidth = (bounds.size.width-CGFloat(columns)-1)/CGFloat(columns)
 
         if let subviews = contendBox.contentView?.subviews {
             for view in subviews {
@@ -141,11 +141,10 @@ public class ComponentCPosition: ComponentBaseXibView {
             }
         }
         
+        var yValue: CGFloat = 1
         for row in 0...properties.rowCount-1 {
             var xValue: CGFloat = 1
             for column in 0...properties.columnCount-1 {
-                var yValue: CGFloat = 1
-                
                 let item = ComponentCPositionItem()
                 item.frame = CGRectMake(xValue + CGFloat(column)*itemWidth, CGFloat(row)*itemHeight + yValue, itemWidth, itemHeight)
                 item.row = row
@@ -155,12 +154,11 @@ public class ComponentCPosition: ComponentBaseXibView {
                 item.isDisabled = properties.isDisabled
                 item.delegate = self
                 item.autoresizingMask = [.maxXMargin, .maxYMargin]
-                
                 contendBox.contentView?.addSubview(item)
                 
                 xValue += 1
-                yValue += 1
             }
+            yValue += 1
         }
         
         display()
@@ -242,6 +240,8 @@ extension ComponentCPosition: ComponentCPositionItemDelegate {
                     let item = subview as! ComponentCPositionItem
                     if item != view {
                         item.state = .normal
+                        item.refresh()
+                        
                     }
                 }
             }

+ 2 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/KMBackgroundController.swift

@@ -193,6 +193,8 @@ extension KMBackgroundController: KMBGTemplateControllerDelegate {
         
         propertyController.backgroundData = KMBackgroundModel.defaultData()
         
+        backgroundModel = propertyController.backgroundData
+        
         reloadData()
     }
     

+ 3 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/EditTool/Background/Background/KMBackgroundManager.swift

@@ -388,7 +388,9 @@ class KMBackgroundManager: NSObject  {
         model.verticalSpace = (dict.object(forKey: "verticalSpace") as! CGFloat)
         model.horizontalMode = (dict.object(forKey: "horizontalMode") as! Int)
         model.horizontalSpace = (dict.object(forKey: "horizontalSpace") as! CGFloat)
-        model.backgroundID = dict.object(forKey: "backgroundID") as! String
+        if let value = dict.object(forKey: "backgroundID") {
+            model.backgroundID = value as! String
+        }
         
         if let value = dict.object(forKey: "name") {
             model.name = value as! String

+ 5 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterManager.swift

@@ -181,7 +181,11 @@ class KMHeaderFooterManager: NSObject {
         model.pageFormatString = dict.object(forKey: "pageFormatString") as! String
         model.startString = dict.object(forKey: "startString") as! String
         model.name = dict.object(forKey: "name") as! String
-        model.tag = dict.object(forKey: "tag") as! String
+        
+        if let value = dict.object(forKey: "tag") {
+            model.tag = value as! String
+        }
+        
     }
     
     //Parse

+ 3 - 1
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/KMHeaderFooterObject.swift

@@ -30,12 +30,14 @@ class KMHeaderFooterObject: NSObject {
     var startString: String = "1"
 
     var name: String = ""
-    var tag: String = NSString.tagString()
+    var tag: String = ""
       
     override init() {
         super.init()
         
         self.name = ""
+        self.tag = NSString.tagString()
+        
     }
     
     static func parseModel(model: KMHeaderFooterObject, pageCount: Int) -> [String] {

+ 8 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/HeaderFooter/Views/KMHeaderPropertyController.swift

@@ -361,6 +361,14 @@ class KMHeaderPropertyController: NSViewController {
             layoutTextarea.properties.text = headerFooterModel.topRightString
         }
         layoutTextarea.reloadData()
+        
+        layoutPosition.setString(headerFooterModel.bottomLeftString, to: 0, 0)
+        layoutPosition.setString(headerFooterModel.bottomCenterString, to: 0, 1)
+        layoutPosition.setString(headerFooterModel.bottomRightString, to: 0, 2)
+        layoutPosition.setString(headerFooterModel.topLeftString, to: 1, 0)
+        layoutPosition.setString(headerFooterModel.topCenterString, to: 1, 1)
+        layoutPosition.setString(headerFooterModel.topRightString, to: 1, 2)
+        
     }
     
     //MARK: - Action