Browse Source

【fix】【内容编辑】多选图片,悬浮菜单,替换功能需要禁用

tangchao 8 months ago
parent
commit
250497aafa

+ 22 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/EditPDF/KMImageNameEditPDFReplaceDisabled.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "filename" : "Icon.pdf",
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "filename" : "Icon 1.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/EditPDF/KMImageNameEditPDFReplaceDisabled.imageset/Icon 1.pdf


BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/EditPDF/KMImageNameEditPDFReplaceDisabled.imageset/Icon.pdf


+ 1 - 0
PDF Office/PDF Master/Class/PDFTools/EditPDF/Controller/KMEditPDFPopToolBarController.swift

@@ -332,6 +332,7 @@ extension KMEditPDFPopToolBarController: KMEditPDFToolbarViewDelegate {
             colorView.popToolTip = NSLocalizedString("Crop", comment: "")
         } else if itemKey == .replace {
             viewC.image = NSImage(named: "KMImageNameEditPDFReplace")!
+            viewC.image_disabled = NSImage(named: "KMImageNameEditPDFReplaceDisabled")!
             colorView.popToolTip = NSLocalizedString("Replace", comment: "")
         } else if itemKey == .export {
             viewC.image = NSImage(named: "KMImageNameEditPDFExport")!

+ 2 - 0
PDF Office/PDF Master/Class/PDFTools/EditPDF/Window/KMEditPDFPopToolBarWindow.swift

@@ -142,6 +142,8 @@ import Cocoa
                         model.itemKey = key
                         if key == .crop {
                             model.isEnabled = !self.isMultiple
+                        } else if key == .replace {
+                            model.isEnabled = !self.isMultiple
                         }
                         datas.append(model)
                     }

+ 9 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditImagePropertyViewController.swift

@@ -356,11 +356,11 @@ class KMEditImagePropertyViewController: NSViewController {
         replaceVC?.stringValue = NSLocalizedString("Replace", comment: "")
         replaceVC?.borderColor = KMAppearance.Interactive.s0Color()
         replaceVC?.borderColor_hov = KMAppearance.Interactive.s0Color()
-        replaceVC?.borderColor_disabled = KMAppearance.Interactive.s0Color()
+//        replaceVC?.borderColor_disabled = KMAppearance.Interactive.s0Color()
         replaceVC?.background = KMAppearance.Layout.l1Color()
         replaceVC?.background_hov = KMAppearance.Layout.l1Color()
         replaceVC?.background_focus = KMAppearance.Layout.l1Color()
-        replaceVC?.background_disabled = KMAppearance.Layout.l1Color()
+//        replaceVC?.background_disabled = KMAppearance.Layout.l1Color()
         replaceVC?.textColor = KMAppearance.Layout.h1Color()
         replaceVC?.textColor_hov = KMAppearance.Layout.h1Color()
         replaceVC?.textColor_focus = KMAppearance.Layout.h1Color()
@@ -484,6 +484,7 @@ class KMEditImagePropertyViewController: NSViewController {
                 self.opacityTitleLabel.isHidden = false
                 self.whVC?.state = self._getKeepProportionsButtonState() ? .Act : .Norm
                 self.cropVC?.state = .Norm
+                self.replaceVC?.state = .Norm
             } else if imagesAreas.count > 1 && imagesAreas.count == areas.count { //多选图片
                 self.headerBox.isHidden = false
                 self.headerBoxHeight.constant = 176
@@ -507,6 +508,7 @@ class KMEditImagePropertyViewController: NSViewController {
                 
                 self.whVC?.state = .Disabled
                 self.cropVC?.state = .Disabled
+                self.replaceVC?.state = .Disabled
                 
                 if let data = self.handdler?.editAreasOpacityIsEqual(), data {
                     self.opacitySlider.isEnabled = true
@@ -806,6 +808,11 @@ extension KMEditImagePropertyViewController {
     }
     
     @IBAction func replaceImageAction(_ sender: NSButton) {
+        let state = self.replaceVC?.state ?? .None
+        if state == .Disabled {
+            return
+        }
+        
         if self.listView.selectImageAreas == nil {
             return
         }