Procházet zdrojové kódy

【2025】【页面编辑】选中时cell未变化问题

dinglingui před 5 dny
rodič
revize
bc2a1c3c95

+ 10 - 0
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailBaseViewController.swift

@@ -249,6 +249,16 @@ class KMNThumbnailBaseViewController: KMNBaseViewController,NSCollectionViewDele
         collectionView.setDraggingSourceOperationMask(.every, forLocal: false)
         collectionView.setDraggingSourceOperationMask(.every, forLocal: true)
         
+        collectionView.collectionSelectChanges = {
+            if self.isChangeIndexPaths == false {
+                let indexpathsz = self.collectionView.selectionIndexPaths
+                let dex:IndexSet = KMNTools.indexpathsToIndexs(indexpaths: indexpathsz)
+                let selectedIndexPathsString = KMNTools.parseIndexSet(indexSet: dex)
+                
+                self.thumbnailBaseViewDelegate?.changeIndexPathsThumbnailViewControlle?(pageEditVC: self, selectionIndexPaths: indexpathsz, selectionStrings: selectedIndexPathsString)
+            }
+        }
+        
         refreshDatas()
     }
     

+ 8 - 1
PDF Office/PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailCollectionView.swift

@@ -10,7 +10,8 @@ import Cocoa
 class KMNThumbnailCollectionView: NSCollectionView {
     var menuClickedAction: ((_ clickPoint: NSPoint) -> NSMenu)?
     
-    
+    var collectionSelectChanges: (() -> Void)?
+
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
         
@@ -46,4 +47,10 @@ class KMNThumbnailCollectionView: NSCollectionView {
         return super.menu(for: event)
     }
     
+    override var selectionIndexPaths: Set<IndexPath> {
+        didSet {
+            collectionSelectChanges?()
+        }
+    }
+    
 }