Browse Source

链接注释-调整

OYXH\oyxh 1 year ago
parent
commit
93676021c7

+ 15 - 8
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -656,9 +656,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
                     if (viewContentViewModel.IsRightMenuSelectedTextAddLink == false)
                     {
-                        AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
-                        AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
-                        AnnotAttribEvent?.UpdateAnnot();
+                        int index = (int)AnnotAttribEvent.Attribs[AnnotAttrib.LinkDestIndx];
+                        if (index != (pageNum - 1))
+                        {
+                            AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
+                            AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
+                            AnnotAttribEvent?.UpdateAnnot();
+                        }
+
                         LinkAnnotArgs?.InvokeLinkSaveCalled(this, EventArgs.Empty);
                     }
                     else
@@ -679,7 +684,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         pdfViewer.SetToolParam(annotArgs);
                         return;
                     }
-
+                    pdfViewer.SelectAnnotation(LinkAnnotArgs.PageIndex, LinkAnnotArgs.AnnotIndex);
                     //SelectAnnotation();
                 }
                 else
@@ -1055,8 +1060,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 if (historyPageIndex != -1)
                 {
                     pdfViewer.GoToPage(historyPageIndex);
-                    SelectAnnotation();
-
+                    //SelectAnnotation();
+                    pdfViewer.SelectAnnotation(LinkAnnotArgs.PageIndex, LinkAnnotArgs.AnnotIndex);
                     BackToPage(historyPageIndex, pageIndex);
 
                     ChangeBtnGOorBack("GO", btnGOorBack);
@@ -1088,7 +1093,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 {
                     if (historyPageIndex < pageIndex)
                     {
-                        height = vertical + (rect.Bottom * zoom);
+                        //height = vertical + (rect.Bottom * zoom);
+                        height = vertical + (paintrect.Top * zoom);
                         pdfViewer.ScrollToVerticalOffset(height);
                     }
                     else
@@ -1116,7 +1122,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 {
                     if (historyPageIndex < pageIndex)
                     {
-                        height = vertical + (paintrect.Bottom * zoom);
+                        //height = vertical + (paintrect.Bottom * zoom);
+                        height = vertical + (paintrect.Top * zoom);
                         pdfViewer.ScrollToVerticalOffset(height);
                     }
                     else