Parcourir la source

【综合】内容编辑悬浮窗口UI没有及时刷选状态的问题修复

tangchao il y a 4 mois
Parent
commit
e727076dac

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

@@ -171,6 +171,14 @@ import Cocoa
                             }
                         }
                         datas.append(model)
+                        
+                        if key == .fontAdd || key == .fontReduce {
+                            if let item = self._fetchCurrentItem(itemKey: key) {
+                                if item.isEnabled != model.isEnabled {
+                                    needUpdateData = true
+                                }
+                            }
+                        }
                     }
                     
                     if needUpdateData {
@@ -293,6 +301,18 @@ import Cocoa
     
     // MARK: - Private Methods
     
+    private func _fetchCurrentItem(itemKey: KMEditPDFToolbarItemKey) -> KMEditPDFToolbarModel? {
+        guard let contentC = self.contentViewController as? KMEditPDFPopToolBarController else {
+            return nil
+        }
+        for model in contentC.datas {
+            if model.itemKey == itemKey {
+                return model
+            }
+        }
+        return nil
+    }
+    
     private func _fontSizeItemIsEnabled() -> Bool {
         if self.model.editAreasFontSizeIsEqual() {
             if let fontSize = self.model.fontSizes.first, fontSize == -1 {