Browse Source

链接-定位问题

OYXH\oyxh 1 year ago
parent
commit
452aaf4efe
1 changed files with 14 additions and 7 deletions
  1. 14 7
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

+ 14 - 7
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -2,6 +2,7 @@
 using ComPDFKit.PDFAnnotation;
 using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFDocument.Action;
+using ComPDFKit.PDFPage;
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
@@ -230,9 +231,17 @@ namespace PDF_Master.ViewModels.Tools
                         CPDFGoToAction gotoAction = action as CPDFGoToAction;
                         CPDFDestination dest = gotoAction.GetDestination(PDFViewer.Document);
                         if (dest != null)
-                        {
-                            PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(0, 0));
-                        }
+                        {
+                            CPDFPage docPage = PDFViewer.Document.PageAtIndex(dest.PageIndex, false);
+                            if (docPage != null)
+                            {
+                                PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(dest.Position_X, docPage.PageSize.Height - dest.Position_Y));
+                            }
+                            else
+                            {
+                                PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(dest.Position_X, dest.Position_Y));
+                            }
+                        }
                     }
                     break;
 
@@ -757,8 +766,6 @@ namespace PDF_Master.ViewModels.Tools
             PropertyPanel.annotlists = null;
         }
 
-
-
         /// <summary>
         /// 注释列表同步选中
         /// </summary>
@@ -1810,10 +1817,10 @@ namespace PDF_Master.ViewModels.Tools
                             //创建注释后,修改注释属性,可用于下次创建的注释
                             if (PropertyPanel != null && PropertyPanel.annot != null && PDFViewer.MouseMode == MouseModes.AnnotCreate)
                             {
-                                if (StrAnnotToolChecked == "Rect" )
+                                if (StrAnnotToolChecked == "Rect")
                                 {
                                     if (PropertyPanel.SharpsAnnot == key.Key || (PropertyPanel.SharpsAnnot != key.Key && key.Key == "Arrow"))
-                                    PDFViewer.SetToolParam(PropertyPanel.annot);
+                                        PDFViewer.SetToolParam(PropertyPanel.annot);
                                     PropertyPanel.SaveLastAnnot();
                                 }
                             }