Browse Source

【2025】【Edit】图片编辑模块自测处理

niehaoyu 3 months ago
parent
commit
b9e36fbab4

+ 5 - 0
PDF Office/KMComponentLibrary/KMComponentLibrary/View/InputNumber/ComponentInputNumber.swift

@@ -12,6 +12,8 @@ import AppKit
     
     @objc optional func componentInputNumberDidValueChanged(inputNumber: ComponentInputNumber?)
     
+    @objc optional func componentInputNumberDidFinishEditing(inputNumber: ComponentInputNumber?)
+    
     @objc optional func componentInputNumberDidIncrease(inputNumber: ComponentInputNumber?)
     
     @objc optional func componentInputNumberDidDecrease(inputNumber: ComponentInputNumber?)
@@ -264,6 +266,7 @@ public class ComponentInputNumber: ComponentBaseXibView {
         
         refreshUI()
         
+        delegate?.componentInputNumberDidValueChanged?(inputNumber: self)
     }
     
     @objc func textFieldDidEndEditingNotification(_ notification: Notification) {
@@ -276,6 +279,8 @@ public class ComponentInputNumber: ComponentBaseXibView {
         refreshUI()
         
         inputFieldStringDidChanged()
+        
+        delegate?.componentInputNumberDidFinishEditing?(inputNumber: self)
     }
     
     //MARK: - MouseEvent

+ 119 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFEditArea/CPDFEditArea_Extension.swift

@@ -0,0 +1,119 @@
+//
+//  CPDFEditArea_Extension.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 2024/12/11.
+//
+
+import Foundation
+
+//MARK: - Areas Compare
+extension CPDFEditArea {
+    
+    //比较不同编辑块的旋转角度
+    class func isMultiAngle(_ areas: [CPDFEditImageArea], inPDFView pdfView: CPDFView?) -> Bool {
+        guard let pdfView = pdfView else {
+            return false
+        }
+        
+        if areas.count < 2 {
+            return false
+        }
+        guard let first_area = areas.first else {
+            return false
+        }
+        
+        let firstValue = pdfView.getRotateWith(first_area)
+        
+        var multiInfo: Bool = false
+        for area in areas {
+            if first_area != area {
+                let areaValue = pdfView.getRotateWith(area)
+                if firstValue - areaValue > 0.01 {
+                    multiInfo = true
+                    break
+                }
+            }
+        }
+        return multiInfo
+        
+    }
+    
+    class func isMultiOpacity(_ areas: [CPDFEditImageArea], inPDFView pdfView: CPDFView?) -> Bool {
+        guard let pdfView = pdfView else {
+            return false
+        }
+        
+        if areas.count < 2 {
+            return false
+        }
+        guard let first_area = areas.first else {
+            return false
+        }
+        
+        var firstValue = pdfView.opacityByRange(for: first_area)
+        if firstValue < 0 {
+            firstValue = pdfView.opacity(for: first_area)
+        }
+        
+        var multiInfo: Bool = false
+        for area in areas {
+            if first_area != area {
+                var areaValue = pdfView.opacityByRange(for: area)
+                if areaValue < 0 {
+                    areaValue = pdfView.opacity(for: area)
+                }
+                if firstValue - areaValue > 0.01 {
+                    multiInfo = true
+                    break
+                }
+            }
+        }
+        return multiInfo
+        
+    }
+    
+    class func isMultiBoundsWidth(_ areas: [CPDFEditImageArea]) -> Bool {
+        if areas.count < 2 {
+            return false
+        }
+        guard let first_area = areas.first else {
+            return false
+        }
+        
+        var firstValue = first_area.bounds.size.width
+        
+        var multiInfo: Bool = false
+        for area in areas {
+            if first_area != area {
+                if firstValue != area.bounds.size.width {
+                    multiInfo = true
+                    break
+                }
+            }
+        }
+        return multiInfo
+    }
+    
+    class func isMultiBoundsHeight(_ areas: [CPDFEditImageArea]) -> Bool {
+        if areas.count < 2 {
+            return false
+        }
+        guard let first_area = areas.first else {
+            return false
+        }
+        
+        var firstValue = first_area.bounds.size.height
+        
+        var multiInfo: Bool = false
+        for area in areas {
+            if first_area != area {
+                if firstValue != area.bounds.size.height {
+                    multiInfo = true
+                    break
+                }
+            }
+        }
+        return multiInfo
+    }
+}

+ 10 - 5
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFListViewExtension/CPDFListView+CPDFEditArea.swift

@@ -22,7 +22,7 @@ extension CPDFListView {
         return rects
     }
     
-    func km_editAreasOpacitys(_ areas: [CPDFEditArea]) -> [CGFloat] {
+    func km_editAreasOpacitys(_ areas: [CPDFEditArea]) -> [CGFloat]? {
         var arr: [CGFloat] = []
         for area in areas {
             var data = self.opacityByRange(for: area)
@@ -31,7 +31,10 @@ extension CPDFListView {
             }
             arr.append(data)
         }
-        return arr
+        if arr.count > 0 {
+            return arr
+        }
+        return nil
     }
     
     
@@ -46,14 +49,16 @@ extension CPDFListView {
         return areas
     }
     
-    func km_editAreasRotates(_ areas: [CPDFEditImageArea]) -> [CGFloat] {
+    func km_editAreasRotates(_ areas: [CPDFEditImageArea]) -> [CGFloat]? {
         var arr: [CGFloat] = []
         for area in areas {
             let data = self.getRotateWith(area)
             arr.append(data)
-            
         }
-        return arr
+        if arr.count > 0 {
+            return arr
+        }
+        return nil
     }
     
     //Text

+ 22 - 41
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/KMRightSideController.swift

@@ -96,16 +96,7 @@ class KMRightSideController: NSViewController {
         
         emptyView.properties = ComponentEmptyProperty(emptyType: .noWatermark, text: KMLocalizedString("No identical attributes"), subText: "")
     }
-    
-    func setEmptyView(isHidden hidden: Bool) {
-      
-        infoContendView.isHidden = false
-        headerBGView.isHidden = false
-        
-        emptyView.isHidden = true
-       
-    }
-    
+     
     func updateTitleLabel() {
         let subToolMode = viewManager?.subToolMode ?? .None
         
@@ -207,7 +198,6 @@ class KMRightSideController: NSViewController {
         contentViewController?.view.removeFromSuperview()
         contentViewController = nil
         
-        setEmptyView(isHidden: true)
         
         let toolMode = viewManager?.toolMode ?? .None
         let subToolMode = viewManager?.subToolMode ?? .None
@@ -216,38 +206,21 @@ class KMRightSideController: NSViewController {
         
         if toolMode == .Edit {
             //MARK: -Edit编辑
-            setEmptyView(isHidden: true)
-            if subToolMode != .None {
-                if subToolMode == .Edit_text {
-                    if pdfView?.km_editingImageAreas().isEmpty == true && pdfView?.km_editingTextAreas().isEmpty == false {
-                        //编辑文字
-                        if edit_textController == nil {
-                            edit_textController = KMEditPDFTextPropertyViewController.init()
-                        }
-                        edit_textController?.pdfView = self.pdfView
-                        
-                        contentViewController = edit_textController
-                        
-                    }
-                } else if subToolMode == .Edit_Image {
-                    
-                } else if subToolMode == .Edit_Link {
-                    //链接
-                    if edit_linkController == nil {
-                        edit_linkController = KMLinkViewController.init()
-                    }
-                    edit_linkController?.pdfView = self.pdfView
-                    contentViewController = edit_linkController
-                } else if subToolMode == .Edit_Crop {
-                    if edit_cropController == nil {
-                        edit_cropController = KMCropPropertyController.init()
-                    }
-                    contentViewController = edit_cropController
+            if subToolMode == .Edit_Link {
+                //链接
+                if edit_linkController == nil {
+                    edit_linkController = KMLinkViewController.init()
+                }
+                edit_linkController?.pdfView = self.pdfView
+                contentViewController = edit_linkController
+            } else if subToolMode == .Edit_Crop {
+                if edit_cropController == nil {
+                    edit_cropController = KMCropPropertyController.init()
                 }
+                contentViewController = edit_cropController
             } else {
                 if pdfView?.km_EditingAreas().isEmpty == true {
                     //未选中文字跟图片
-                    setEmptyView(isHidden: false)
                     
                 } else if pdfView?.km_editingImageAreas().isEmpty == true && pdfView?.km_editingTextAreas().isEmpty == false {
                     //编辑文字
@@ -267,7 +240,6 @@ class KMRightSideController: NSViewController {
                     
                 } else if pdfView?.km_editingImageAreas().isEmpty == false && pdfView?.km_editingTextAreas().isEmpty == false {
                     //混选
-                    setEmptyView(isHidden: false)
                 }
             }
             
@@ -276,7 +248,6 @@ class KMRightSideController: NSViewController {
         } else {
             let exitMulitAnnotation = pdfView?.isMultiAnnotation(annotations)
             if exitMulitAnnotation == true {
-                setEmptyView(isHidden: false)
                 
                 return
             }
@@ -390,6 +361,16 @@ class KMRightSideController: NSViewController {
             delegate?.kmRightSideControllerDidContendVCUpdated?(self)
         }
         
+        if let contendVC = contentViewController {
+            infoContendView.isHidden = false
+            headerBGView.isHidden = false
+             emptyView.isHidden = true
+         } else {
+            infoContendView.isHidden = true
+            headerBGView.isHidden = true
+             emptyView.isHidden = false
+        }
+        
         updateTitleLabel()
         
     }

+ 135 - 81
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditImageController.swift

@@ -18,7 +18,7 @@ class KMEditImageController: NSViewController {
     @IBOutlet var sizeSyncButton: ComponentButton!
     @IBOutlet var sizeWidthInput: ComponentInputNumber!
     @IBOutlet var sizeHeightInput: ComponentInputNumber!
-     
+    
     @IBOutlet var rotateBGView: NSView!
     @IBOutlet var rotateLabel: NSTextField!
     @IBOutlet var rotateSelect: ComponentSelect!
@@ -38,19 +38,20 @@ class KMEditImageController: NSViewController {
     @IBOutlet var extractBtnTopConst: NSLayoutConstraint!
     
     @IBOutlet var alignmentBGView: NSView!
-     
+    
     private var syncChangeBounds: Bool = true //同步修改宽高
     
     private var groupView: ComponentGroup!
     private var alignmentController: KMNAlignmentController?
     
+    private var areas: [CPDFEditImageArea] = []
+    
     var pdfView: CPDFListView? {
         didSet {
             reloadData()
         }
     }
     
-    var areas: [CPDFEditImageArea] = []
     
     //MARK: - func
     override func viewDidAppear() {
@@ -86,7 +87,8 @@ class KMEditImageController: NSViewController {
                                                                  showSuffix: false,
                                                                  minSize: 1,
                                                                  maxSize: 1000,
-                                                                 text:"100")
+                                                                 text:"100",
+                                                                 valueType: .floatType)
         sizeWidthInput.delegate = self
         
         sizeHeightInput.properties = ComponentInputNumberProperty(alignment: .center,
@@ -97,7 +99,8 @@ class KMEditImageController: NSViewController {
                                                                   showSuffix: false,
                                                                   minSize: 1,
                                                                   maxSize: 1000,
-                                                                  text:"100")
+                                                                  text:"100",
+                                                                  valueType: .floatType)
         sizeHeightInput.delegate = self
         
         //Rotate
@@ -163,7 +166,7 @@ class KMEditImageController: NSViewController {
         replaceButton.properties = ComponentButtonProperty(type: .default_tertiary, size: .s, buttonText: KMLocalizedString("Replace"), keepPressState: false)
         replaceButton.setTarget(self, action: #selector(buttonClicked(_:)))
         
-        extractButton.properties = ComponentButtonProperty(type: .default_tertiary, size: .s, buttonText: KMLocalizedString("Extract"), keepPressState: false)
+        extractButton.properties = ComponentButtonProperty(type: .default_tertiary, size: .s, buttonText: KMLocalizedString("Extract"), keepPressState: true)
         extractButton.setTarget(self, action: #selector(buttonClicked(_:)))
         
         if alignmentController == nil {
@@ -202,10 +205,93 @@ class KMEditImageController: NSViewController {
             }
         }
         
+        
+        var first_area: CPDFEditImageArea?
+        if areas.count > 0 {
+            first_area = areas.first
+        }
+        
+        
+        //refreshData
+        var boundsWidth: CGFloat?
+        var boundsHeight: CGFloat?
+        
+        var rotateAngle: CGFloat?
+        var opacity_value: CGFloat?
+        
+        if areas.count == 0 {
+            
+        } else if areas.count == 1, let area = first_area {
+            boundsWidth = area.bounds.size.width
+            boundsHeight = area.bounds.size.height
+            
+            if let rotates = pdfView?.km_editAreasRotates([area]) {
+                rotateAngle = rotates.first ?? 1
+            }
+            
+            if let opacitys = pdfView?.km_editAreasOpacitys([area]) {
+                var opacity = opacitys.first ?? 1
+                opacity = min(1, opacity)
+                opacity = max(0, opacity)
+                
+                opacity_value = opacity
+            }
+        } else if areas.count > 1, let area = first_area {
+            if CPDFEditArea.isMultiBoundsWidth(areas) == true {
+                boundsWidth = nil
+            } else {
+                boundsWidth = area.bounds.size.width
+            }
+ 
+            if CPDFEditArea.isMultiBoundsHeight(areas) == true {
+                boundsHeight = nil
+            } else {
+                boundsHeight = area.bounds.size.height
+            }
+            
+            if CPDFEditArea.isMultiAngle(areas, inPDFView: pdfView) == true {
+                rotateAngle = nil
+            } else {
+                rotateAngle = pdfView?.getRotateWith(area)
+            }
+            
+            if CPDFEditArea.isMultiOpacity(areas, inPDFView: pdfView) == true {
+                opacity_value = nil
+            } else {
+                var firstValue = pdfView?.opacityByRange(for: area) ?? 0
+                if firstValue < 0 {
+                    firstValue = pdfView?.opacity(for: area) ?? 0
+                }
+                opacity_value = firstValue
+            }
+        }
+        
+        if let value = boundsWidth {
+            sizeWidthInput.properties.text = String(format: "%.1f", value)
+        } else {
+            sizeWidthInput.properties.text = "-"
+        }
+        
+        if let value = boundsHeight {
+            sizeHeightInput.properties.text = String(format: "%.1f", value)
+        } else {
+            sizeHeightInput.properties.text = "-"
+        }
+        
         sizeWidthInput.properties.isDisabled = pdfView?.isEditImage == true
         sizeHeightInput.properties.isDisabled = pdfView?.isEditImage == true
+        sizeWidthInput.reloadData()
+        sizeHeightInput.reloadData()
+        
         sizeSyncButton.properties.isDisabled = pdfView?.isEditImage == true
-         rotateSelect.properties.isDisabled = pdfView?.isEditImage == true
+        if syncChangeBounds {
+            sizeSyncButton.properties.state = .pressed
+        } else {
+            sizeSyncButton.properties.state = .normal
+        }
+        sizeSyncButton.reloadData()
+        
+        rotateSelect.properties.isDisabled = pdfView?.isEditImage == true
         
         rotateLeftButton.properties.isDisabled = pdfView?.isEditImage == true
         rotateLeftButton.reloadData()
@@ -226,73 +312,33 @@ class KMEditImageController: NSViewController {
         
         replaceButton.properties.isDisabled = pdfView?.isEditImage == true
         replaceButton.reloadData()
-         
+        
         extractButton.properties.isDisabled = pdfView?.isEditImage == true
         extractButton.reloadData()
+         
+        if let value = rotateAngle {
+            rotateSelect.properties.text = String(format: "%.0f", value)
+        } else {
+            rotateSelect.properties.text = "-"
+        }
+        rotateSelect.reloadData()
         
-        if let area = areas.first {
-            //Size
-            if syncChangeBounds {
-                sizeSyncButton.properties.state = .pressed
-            } else {
-                sizeSyncButton.properties.state = .normal
-            }
-            sizeSyncButton.reloadData()
-            
-            if areas.count > 1 {
-                sizeWidthInput.properties.text = "-"
-                sizeWidthInput.properties.multiState = true
-                
-                sizeHeightInput.properties.text = "-"
-                sizeHeightInput.properties.multiState = true
-            } else {
-                let areaFrame = area.bounds
-                sizeWidthInput.properties.text = String(format: "%.1f", areaFrame.size.width)
-                sizeWidthInput.properties.multiState = false
-                
-                sizeHeightInput.properties.text = String(format: "%.1f", areaFrame.size.height)
-                sizeHeightInput.properties.multiState = false
-            }
-            sizeWidthInput.properties.maxSize = Int(area.page.bounds.size.width)
-            sizeHeightInput.properties.maxSize = Int(area.page.bounds.size.height)
-
-            sizeWidthInput.reloadData()
-            sizeHeightInput.reloadData()
-            
-            //Rotate
-            if let rotates = pdfView?.km_editAreasRotates([area]) {
-                if rotates.count > 0 {
-                    let rotate = rotates.first ?? 1
-                    
-                    rotateSelect.properties.text = String(format: "%.0f%@", rotate, "°")
-                    rotateSelect.reloadData()
-                    
-                }
-            }
-            
-            //Opacity
-            if let opacitys = pdfView?.km_editAreasOpacitys([area]) {
-                if opacitys.count > 0 {
-                    var opacity = opacitys.first ?? 1
-                    opacity = min(1, opacity)
-                    opacity = max(0, opacity)
-                    
-                    opacitySelect.properties.text = String(format: "%.0f%@", opacity*100, "%")
-                    opacitySelect.reloadData()
-                    
-                    opacitySlider.properties.percent = opacity
-                    opacitySlider.reloadData()
-                }
-            }
-            
-            if pdfView?.isEditImage == true {
-                cropButton.properties.buttonText = KMLocalizedString("Cancel Crop")
-            } else {
-                cropButton.properties.buttonText = KMLocalizedString("Crop")
-            }
-            cropButton.reloadData()
-            
+        if let value = opacity_value {
+            opacitySelect.properties.text = String(format: "%.0f", value*100)
+            opacitySlider.properties.percent = value
+        } else {
+            opacitySelect.properties.text = "-"
+            opacitySlider.properties.percent = 0
+        }
+        opacitySelect.reloadData()
+        opacitySlider.reloadData()
+        
+        if pdfView?.isEditImage == true {
+            cropButton.properties.buttonText = KMLocalizedString("Cancel Crop")
+        } else {
+            cropButton.properties.buttonText = KMLocalizedString("Crop")
         }
+        cropButton.reloadData()
         
         
     }
@@ -383,8 +429,8 @@ class KMEditImageController: NSViewController {
 
 //MARK: - ComponentInputNumberDelegate
 extension KMEditImageController: ComponentInputNumberDelegate {
-    func componentInputNumberDidValueChanged(inputNumber: ComponentInputNumber?) {
-        if areas.count > 1 || areas.count == 0 {
+    func componentInputNumberDidFinishEditing(inputNumber: ComponentInputNumber?) {
+        if areas.count == 0 {
             return
         }
         
@@ -399,12 +445,12 @@ extension KMEditImageController: ComponentInputNumberDelegate {
             for area in areas {
                 pdfView?.updateArea(area, newHeight: textValue, syncChangeBounds)
             }
-         }
+        }
         reloadData()
     }
     
     func componentInputNumberDidIncrease(inputNumber: ComponentInputNumber?) {
-        if areas.count == 1 || areas.count == 0 {
+        if areas.count == 0 {
             return
         }
         //只处理多选状态
@@ -426,7 +472,7 @@ extension KMEditImageController: ComponentInputNumberDelegate {
     }
     
     func componentInputNumberDidDecrease(inputNumber: ComponentInputNumber?) {
-        if areas.count == 1 || areas.count == 0 {
+        if areas.count == 0 {
             return
         }
         //只处理多选状态
@@ -478,18 +524,20 @@ extension KMEditImageController: ComponentSelectDelegate {
         if view == opacitySelect {
             if let text = opacitySelect.properties.text {
                 let result = text.stringByDeleteCharString("%")
-                let opacity = result.stringToCGFloat()/100
-                
-                pdfView?.setEditingAreasOpacity(opacity)
+                if result != "-" {
+                    let opacity = result.stringToCGFloat()/100
+                    pdfView?.setEditingAreasOpacity(opacity)
+                }
                 
                 reloadData()
             }
         } else if view == rotateSelect {
             if let text = rotateSelect.properties.text {
                 let result = text.stringByDeleteCharString("°")
-                let value = result.stringToCGFloat()
-                
-                pdfView?.rotateEditingAreas(value)
+                if result != "-" {
+                    let value = result.stringToCGFloat()
+                    pdfView?.rotateEditingAreas(value)
+                }
                 
                 reloadData()
             }
@@ -528,6 +576,12 @@ extension KMEditImageController: ComponentGroupDelegate {
         
     }
     
+    func componentGroupDidDismiss(group: ComponentGroup?) {
+        extractButton.properties.state = .normal
+        extractButton.reloadData()
+        
+    }
+    
 }
 
 

+ 0 - 254
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/Manager/KMEditPDFModel.swift

@@ -1,254 +0,0 @@
-//
-//  KMEditPDFModel.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2024/6/25.
-//
-
-import Cocoa
-
-class KMEditPDFModel: NSObject { 
-    var editingAreas: [CPDFEditArea]?
-    
-    var textAreas: [CPDFEditTextArea]? {
-        get {
-            guard let areas = self.editingAreas else {
-                return nil
-            }
-            var datas: [CPDFEditTextArea] = []
-            for area in areas {
-                if let data = area as? CPDFEditTextArea {
-                    datas.append(data)
-                    continue
-                }
-            }
-            return datas
-        }
-    }
-    
-    var imageAreas: [CPDFEditImageArea]? {
-        get {
-            guard let areas = self.editingAreas else {
-                return nil
-            }
-            var datas: [CPDFEditImageArea] = []
-            for area in areas {
-                if let data = area as? CPDFEditImageArea {
-                    datas.append(data)
-                    continue
-                }
-            }
-            return datas
-        }
-    }
-    
-    var fontColors: [NSColor] = []
-    var fontNames: [String] = []
-    var fontSizes: [CGFloat] = []
-    var fontBolds: [Bool] = []
-    var fontItalics: [Bool] = []
-    var textAlignments: [NSTextAlignment] = []
-    var boundsArray: [NSRect] = []
-    var rotates: [CGFloat] = []
-    var opacitys: [CGFloat] = []
-    
-    func editAreasFontColorIsEqual() -> Bool {
-        let datas = self.fontColors
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let color = datas.first
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d != color {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasFontNameIsEqual() -> Bool {
-        let datas = self.fontNames
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d != data {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasFontSizeIsEqual() -> Bool {
-        let datas = self.fontSizes
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d != data {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasFontBoldIsEqual() -> Bool {
-        let datas = self.fontBolds
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d != data {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasFontItalicIsEqual() -> Bool {
-        let datas = self.fontItalics
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d != data {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasTextAlignmentIsEqual() -> Bool {
-        let datas = self.textAlignments
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first?.rawValue ?? 0
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if d.rawValue != data {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasBoundsIsEqualForWidth() -> Bool {
-        let datas = self.boundsArray
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let width = datas.first?.width ?? 0
-        for (i, rect) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if width != rect.size.width {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasBoundsIsEqualForHeight() -> Bool {
-        let datas = self.boundsArray
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let height = datas.first?.height ?? 0
-        for (i, rect) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if height != rect.size.height {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasRotateIsEqual() -> Bool {
-        let datas = self.rotates
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first ?? 0
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if data != d {
-                return false
-            }
-        }
-        return true
-    }
-    
-    func editAreasOpacityIsEqual() -> Bool {
-        let datas = self.opacitys
-        if datas.isEmpty {
-            return false
-        }
-        if datas.count == 1 {
-            return true
-        }
-        let data = datas.first ?? 0
-        for (i, d) in datas.enumerated() {
-            if i == 0 {
-                continue
-            }
-            if data != d {
-                return false
-            }
-        }
-        return true
-    }
-}

+ 17 - 9
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -2678,6 +2678,9 @@
 		BB0B2CD82B04AE560088FFD8 /* LeftSideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0B2CD72B04AE560088FFD8 /* LeftSideView.xib */; };
 		BB0B2CD92B04AE560088FFD8 /* LeftSideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0B2CD72B04AE560088FFD8 /* LeftSideView.xib */; };
 		BB0B2CDA2B04AE560088FFD8 /* LeftSideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0B2CD72B04AE560088FFD8 /* LeftSideView.xib */; };
+		BB0B305F2D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0B305E2D098AD8003F54D3 /* CPDFEditArea_Extension.swift */; };
+		BB0B30602D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0B305E2D098AD8003F54D3 /* CPDFEditArea_Extension.swift */; };
+		BB0B30612D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0B305E2D098AD8003F54D3 /* CPDFEditArea_Extension.swift */; };
 		BB0FE0342B734DD1001E0F88 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0FE0212B734DD1001E0F88 /* AIConfigWindowController.xib */; };
 		BB0FE0352B734DD1001E0F88 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0FE0212B734DD1001E0F88 /* AIConfigWindowController.xib */; };
 		BB0FE0362B734DD1001E0F88 /* AIConfigWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB0FE0212B734DD1001E0F88 /* AIConfigWindowController.xib */; };
@@ -3840,9 +3843,6 @@
 		BB716D732CDDB73B009787ED /* KMHeaderFooterController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB716D6F2CDDB73B009787ED /* KMHeaderFooterController.xib */; };
 		BB716D742CDDB73B009787ED /* KMHeaderFooterController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB716D6F2CDDB73B009787ED /* KMHeaderFooterController.xib */; };
 		BB716D752CDDB73B009787ED /* KMHeaderFooterController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB716D6F2CDDB73B009787ED /* KMHeaderFooterController.xib */; };
-		BB71854A2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7185492C2B0DC500C1156B /* KMEditPDFModel.swift */; };
-		BB71854B2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7185492C2B0DC500C1156B /* KMEditPDFModel.swift */; };
-		BB71854C2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7185492C2B0DC500C1156B /* KMEditPDFModel.swift */; };
 		BB7256B32CDB816100B6CE64 /* KMBackgroundPropertyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7256B12CDB816100B6CE64 /* KMBackgroundPropertyController.swift */; };
 		BB7256B42CDB816100B6CE64 /* KMBackgroundPropertyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7256B12CDB816100B6CE64 /* KMBackgroundPropertyController.swift */; };
 		BB7256B52CDB816100B6CE64 /* KMBackgroundPropertyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7256B12CDB816100B6CE64 /* KMBackgroundPropertyController.swift */; };
@@ -6557,6 +6557,7 @@
 		BB0A55202A30968900B6E84B /* KMDesignBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMDesignBaseView.swift; sourceTree = "<group>"; };
 		BB0A823129C00400002C5C1B /* KMCommonEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMCommonEnum.swift; sourceTree = "<group>"; };
 		BB0B2CD72B04AE560088FFD8 /* LeftSideView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LeftSideView.xib; sourceTree = "<group>"; };
+		BB0B305E2D098AD8003F54D3 /* CPDFEditArea_Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFEditArea_Extension.swift; sourceTree = "<group>"; };
 		BB0FE0212B734DD1001E0F88 /* AIConfigWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AIConfigWindowController.xib; sourceTree = "<group>"; };
 		BB0FE0222B734DD1001E0F88 /* AIConfigWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AIConfigWindowController.swift; sourceTree = "<group>"; };
 		BB0FE0242B734DD1001E0F88 /* AITipIconView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AITipIconView.xib; sourceTree = "<group>"; };
@@ -7053,7 +7054,6 @@
 		BB716D672CDDB727009787ED /* KMHeaderPropertyController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderPropertyController.xib; sourceTree = "<group>"; };
 		BB716D6E2CDDB73B009787ED /* KMHeaderFooterController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHeaderFooterController.swift; sourceTree = "<group>"; };
 		BB716D6F2CDDB73B009787ED /* KMHeaderFooterController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderFooterController.xib; sourceTree = "<group>"; };
-		BB7185492C2B0DC500C1156B /* KMEditPDFModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMEditPDFModel.swift; sourceTree = "<group>"; };
 		BB7256B12CDB816100B6CE64 /* KMBackgroundPropertyController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBackgroundPropertyController.swift; sourceTree = "<group>"; };
 		BB7256B22CDB816100B6CE64 /* KMBackgroundPropertyController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMBackgroundPropertyController.xib; sourceTree = "<group>"; };
 		BB7256BB2CDC5B5300B6CE64 /* KMBackgroundController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBackgroundController.swift; sourceTree = "<group>"; };
@@ -9831,7 +9831,6 @@
 		AD3C6DFA2A1C48600010B1A7 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
-				BB7185492C2B0DC500C1156B /* KMEditPDFModel.swift */,
 				ADA910292A272CE2003352F0 /* KMEditPDFTextManager.swift */,
 			);
 			path = Manager;
@@ -11111,6 +11110,15 @@
 			path = Designs;
 			sourceTree = "<group>";
 		};
+		BB0B30632D098ADD003F54D3 /* CPDFEditArea */ = {
+			isa = PBXGroup;
+			children = (
+				BB96C4282CE6DDB2003F3668 /* CPDFListView+CPDFEditArea.swift */,
+				BB0B305E2D098AD8003F54D3 /* CPDFEditArea_Extension.swift */,
+			);
+			path = CPDFEditArea;
+			sourceTree = "<group>";
+		};
 		BB0C1E572CF6B26600A382AE /* Line */ = {
 			isa = PBXGroup;
 			children = (
@@ -12992,7 +13000,6 @@
 				F36AD77629642FE80015AD53 /* CPDFListView+UndoManager.m */,
 				9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */,
 				AD7D5CA82B906E36006562CD /* CPDFListView+Sync.swift */,
-				BB96C4282CE6DDB2003F3668 /* CPDFListView+CPDFEditArea.swift */,
 				BB451AE32CF5BEC5003E1565 /* CPDFListView+AnnotationsCompare.swift */,
 			);
 			path = CPDFListViewExtension;
@@ -14347,6 +14354,7 @@
 				BB60138B2AD3A94200A76FB2 /* CPDFSignatureAnnotation+PDFListView.swift */,
 				9FF371C62C69A9E1005F9CC5 /* CPDFPolygonAnnotation+PDFListView.swift */,
 				9FF371C72C69A9E1005F9CC5 /* CPDFPolylineAnnotation+PDFListView.swift */,
+				BB0B30632D098ADD003F54D3 /* CPDFEditArea */,
 				9FB220EF2B18639900A5B208 /* Form */,
 				F344A3B1293094DB003A4383 /* Signature */,
 				F3732326292F78200013862C /* Stamp */,
@@ -17072,6 +17080,7 @@
 				BB146FAE299DC0D100784A6A /* GTLRService.m in Sources */,
 				AD07BCD02D02CBB20075054B /* KMCompressFontsPanelTableCellView.swift in Sources */,
 				BB4A948D2B04726A00940F8B /* KMOCTool.m in Sources */,
+				BB0B305F2D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */,
 				BB0A551D2A30793F00B6E84B /* KMDesignTextField.swift in Sources */,
 				BB234F072BA3D798008B3754 /* KMAIIconGuideView.swift in Sources */,
 				BBD1F798296FF78C00343885 /* KMPageEditSettingBaseModel.swift in Sources */,
@@ -17557,7 +17566,6 @@
 				ADE3C1ED29A5AFB100793B13 /* KMRequestServerManager.swift in Sources */,
 				9F1FE4A229406E4700E952CA /* CTToolbarController.m in Sources */,
 				BB6B49AF2D02D054003ECD26 /* KMPDFSignatureInputView.swift in Sources */,
-				BB71854A2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */,
 				BB147041299DC0D200784A6A /* OIDClientMetadataParameters.m in Sources */,
 				ADDEEA6A2AD3CF3A00EF675D /* KMDrawSignatureView.swift in Sources */,
 				BB1A34A8295EA30100B80B3E /* NSBitmapImageRep_SKExtensions.m in Sources */,
@@ -18171,7 +18179,6 @@
 				ADBC2D29299DCA76006280C8 /* NSTextField+Layer.swift in Sources */,
 				9F0CB4702967E63100007028 /* KMPropertiesPanelNameSubVC.swift in Sources */,
 				9FD0FA3229CD947000F2AB0D /* KMOpacityPanel.swift in Sources */,
-				BB71854B2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */,
 				BB031B852C47BB090099F7AD /* KMUserListItemView.swift in Sources */,
 				BB146FCD299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
 				BB14701E299DC0D100784A6A /* OIDIDToken.m in Sources */,
@@ -18380,6 +18387,7 @@
 				BBB9B32F299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization.m in Sources */,
 				BBFD225E2CBE16AB00DA4ABD /* KMHistoryEmptyView.swift in Sources */,
 				BB8810D72B4F984000AFA63E /* JSONKit.m in Sources */,
+				BB0B30602D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */,
 				ADDF83242B391A5C00A81A4E /* CDSDrawView.m in Sources */,
 				BB4DFD5B2CFDA9E600026C8B /* KMStampListController.swift in Sources */,
 				ADFCEB722B4FC1410001EBAF /* KMAdsManager.swift in Sources */,
@@ -19846,6 +19854,7 @@
 				BB3D970C2B2FEAC8007094C8 /* KMPDFRedactViewController.swift in Sources */,
 				BB66472D2C06DD9C00924EE0 /* KMToolbarConfigTBItemView.swift in Sources */,
 				BBB7B48F2A0384E100B58A5A /* NSCollectionViewItem+KMExtension.swift in Sources */,
+				BB0B30612D098AD8003F54D3 /* CPDFEditArea_Extension.swift in Sources */,
 				BB146FFE299DC0D100784A6A /* OIDAuthState+Mac.m in Sources */,
 				BB96A0B22AFCD56100559E24 /* KMToolCompareWindowController.swift in Sources */,
 				BBCE57122A72712200508EFC /* NSWindowController+KMExtension.swift in Sources */,
@@ -20034,7 +20043,6 @@
 				BB19A7592CB7C724008204DC /* KMHistoryFileListItem.swift in Sources */,
 				9FA693AA2987C0590055488A /* KMStepperView.swift in Sources */,
 				9F1FE4F829406E4700E952CA /* CTFloatingBarBackingView.m in Sources */,
-				BB71854C2C2B0DC500C1156B /* KMEditPDFModel.swift in Sources */,
 				9F1FE49E29406E4700E952CA /* HoverCloseButton.m in Sources */,
 				BB3A81B22AC2B82A006FC66C /* KMPageSizeTool.swift in Sources */,
 				9FD0D2A52AD4ECA900DA3FF8 /* KMPDFEditAppendCustomView.swift in Sources */,

+ 0 - 48
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3794,22 +3794,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "19A27E70-8421-455C-8E61-B42CB7ACFCD3"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMPDFViewController/RightSideController/Views/EditPDF/KMEditImageController.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "521"
-            endingLineNumber = "521"
-            landmarkName = "componentGroupDidSelect(group:menuItemProperty:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -4258,38 +4242,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "78986EFD-8CD3-44E3-A35B-009A4EFFED15"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/InputNumber/ComponentInputNumber.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "310"
-            endingLineNumber = "310"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "328DCB47-940C-43CF-93D7-AC1AA5159CCD"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/InputNumber/ComponentStepper/ComponentStepper.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "144"
-            endingLineNumber = "144"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent