Bladeren bron

ComPDFKit.Tool(win)-橡皮擦删除时返回索引异常修复(undo队列导致新删的索引为-2)

liyijie 3 maanden geleden
bovenliggende
commit
88a62b00c6
1 gewijzigde bestanden met toevoegingen van 6 en 1 verwijderingen
  1. 6 1
      Demo/Examples/ComPDFKit.Tool/DrawTool/CreateCustomizeTool.cs

+ 6 - 1
Demo/Examples/ComPDFKit.Tool/DrawTool/CreateCustomizeTool.cs

@@ -272,6 +272,7 @@ namespace ComPDFKit.Tool.DrawTool
             GroupHistory historyGroup=new GroupHistory();
             CPDFDocument pdfDoc = PDFViewer?.GetDocument();
             List<AnnotParam> paramList = new List<AnnotParam>();
+            List<AnnotParam> paramNewList = new List<AnnotParam>();
             foreach (var item in annotControlList)
             {
                 InkAnnot ink = item as InkAnnot;
@@ -281,9 +282,11 @@ namespace ComPDFKit.Tool.DrawTool
                     CPDFAnnotation delAnnot = item.GetAnnotData().Annot;
                     AnnotHistory annotHistory = ParamConverter.CreateHistory(delAnnot);
                     AnnotParam annotParam = null;
+                    AnnotParam annotNewParam = null; 
                     if (pdfDoc != null)
                     {
                         annotParam = ParamConverter.CPDFDataConverterToAnnotParam(pdfDoc, delAnnot.Page.PageIndex, delAnnot);
+                        annotNewParam= ParamConverter.CPDFDataConverterToAnnotParam(pdfDoc, delAnnot.Page.PageIndex, delAnnot);
                         annotHistory.CurrentParam = annotParam;
                         annotHistory.Action=HistoryAction.Remove;
                         annotHistory.PDFDoc=pdfDoc;
@@ -295,6 +298,8 @@ namespace ComPDFKit.Tool.DrawTool
                         if(annotParam != null)
                         {
                             paramList.Add(annotParam);
+                            
+                            paramNewList.Add(annotNewParam);
                         }
                         historyGroup.Histories.Add(annotHistory);
                     }
@@ -307,7 +312,7 @@ namespace ComPDFKit.Tool.DrawTool
             }
             if(paramList.Count > 0)
             {
-                DeleteChanged?.Invoke(this, paramList);
+                DeleteChanged?.Invoke(this, paramNewList);
             }
         }
     }