浏览代码

【综合】整理代码

tangchao 5 月之前
父节点
当前提交
846156674a

+ 10 - 5
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -2138,7 +2138,9 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                     if idx == 1 { // comment
                         data.isExpand = !data.isExpand
                         data.animated = true
-                        self?.noteOutlineView.reloadItem(data)
+                        data.annoModel?.isExpand = data.isExpand
+//                        self?.noteOutlineView.reloadItem(data)
+                        self?.noteOutlineView.reloadData()
                     } else if idx == 2 { //
                         self?.noteReplyHanddler.showStatePopView(sender: param.first as! NSView, anno: data.anno)
                     } else if idx == 3 { // reply
@@ -2149,7 +2151,7 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
 //                            }
                             return
                         }
-                        if let con = data.replyModel?.replyAnno?.contents, con.isEmpty == false {
+                        if let con = data.replyModel?.replyAnno?.contents, con.isEmpty == false { // 编辑
                             let model = data.replyModel
                             model?.replyAnno?.contents = content
                             model?.replyAnno?.setUserName(KMPreference.shared.author)
@@ -2168,6 +2170,9 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                             model.annoModel = data.annoModel
                             data.annoModel?.replyAnnos.append(model)
                             self?.noteOutlineView.reloadData()
+//                            if let row = self?.noteOutlineView.row(forItem: data) {
+//                                self?.noteOutlineView.scrollRowToVisible(row)
+//                            }
 //                            self?.noteOutlineView.ks_reloadData()
 //                            DispatchQueue.main.async {
                                 //                            }
@@ -2217,14 +2222,14 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                     if data.isKind(of: CPDFMarkupAnnotation.self) {
                         if (!cell.isFold) {
 //                            self.allFoldNotes.append(data)
-                            model?.isExpand = model?.foldType == .unfold
+//                            model?.isExpand = model?.foldType == .unfold
                         } else {
                             cell.imageViewHeightConstraint.constant = 18.0 + 8
-                            model?.isExpand = true
+//                            model?.isExpand = true
                         }
                     } else {
                         cell.imageViewHeightConstraint.constant = 18.0 + 8
-                        model?.isExpand = true
+//                        model?.isExpand = true
                     }
                 }
             }