Explorar o código

【左边栏】- 旋转缩略图后,选中状态保持不变

liaoxiaoyue hai 1 ano
pai
achega
480f0dae26

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

@@ -129,6 +129,7 @@ class KMLeftSideViewController: NSViewController, KMThumbnailViewControllerDeleg
         case .BookMark: do {
             self.bookViewController.listView = self.listView
             self.contentBox.contentView = self.bookViewController.view
+            self.bookViewController.reloadData()
         }
             break
         case .Annotation: do {

+ 4 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -396,6 +396,7 @@ class KMThumbnailViewController: NSViewController {
     
     @IBAction func rotatePageItemAction(menu:NSMenuItem) {
         let indexs = self.thumbnailView.collectionView.selectionIndexes
+        let indexPaths = self.thumbnailView.collectionView.selectionIndexPaths
         if indexs.count >= 0 {
             let newDocument = self.thumbnailView.document
             for index in indexs {
@@ -412,11 +413,13 @@ class KMThumbnailViewController: NSViewController {
             }
             self.listView.layoutDocumentView()
             self.thumbnailView.reloadData()
+            self.thumbnailView.collectionView.selectItems(at: indexPaths, scrollPosition: .top)
         }
     }
     
     @IBAction func leftRotatePageItemAction(menu:NSMenuItem) {
         let indexs = self.thumbnailView.collectionView.selectionIndexes
+        let indexPaths = self.thumbnailView.collectionView.selectionIndexPaths
         if indexs.count >= 0 {
             let newDocument = self.thumbnailView.document
             for index in indexs {
@@ -433,6 +436,7 @@ class KMThumbnailViewController: NSViewController {
             }
             self.listView.layoutDocumentView()
             self.thumbnailView.reloadData()
+            self.thumbnailView.collectionView.selectItems(at: indexPaths, scrollPosition: .top)
         }
     }