瀏覽代碼

【综合】偶现页面重复切换问题修正

niehaoyu 9 月之前
父節點
當前提交
6054822558

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Thumbnail.swift

@@ -109,7 +109,9 @@ extension KMLeftSideViewController {
         }
         
         Task { @MainActor in
+            self.stopRepeatLoad = true
             self.thumbnailTableView.selectRowIndexes(indexs, byExtendingSelection: false)
+            self.stopRepeatLoad = false
             self.thumbnailTableView.scrollRowToVisible(indexs.first ?? 0)
         }
     }

+ 8 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -79,6 +79,8 @@ class KMLeftSideViewController: KMSideViewController {
     @IBOutlet weak var emptySearchBox: NSBox!
     @IBOutlet weak var emptySearchLabel: NSTextField!
     
+    var stopRepeatLoad: Bool = false
+    
     lazy var leftSideEmptyVC: KMLeftSideEmptyFileViewController = {
         let vc = KMLeftSideEmptyFileViewController(nibName: "KMLeftSideEmptyFileViewController", bundle: nil)
         vc.view.wantsLayer = true
@@ -1194,7 +1196,12 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
     }
     
     func tableViewSelectionDidChange(_ notification: Notification) {
-        self.delegate?.controller?(controller: self, listViewSelectionDidChange: notification.object, info: nil)
+        if self.stopRepeatLoad == true {
+            
+        } else {
+            self.delegate?.controller?(controller: self, listViewSelectionDidChange: notification.object, info: nil)
+        }
+        
         
         if self.findTableView.isEqual(to: notification.object) {
             //            [self updateFindResultHighlightsForDirection:NSDirectSelection];