Browse Source

综合-注释

OYXH\oyxh 2 years ago
parent
commit
bf641df4e3

BIN
PDF Office/ComPDFKit.Viewer.dll


+ 33 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -36,6 +36,7 @@ using PDF_Master.Views.BOTA;
 using ImTools;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDF_Master.EventAggregators;
+using DryIoc;
 
 namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 {
@@ -609,7 +610,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 if (CheckPageNumVaild(out int pageNum, PageNumTextContent))
                 {
                     //isSelected = true;
-
+                    historyPageIndex = LinkAnnotArgs.PageIndex;
                     AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
                     AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
                     AnnotAttribEvent?.UpdateAnnot();
@@ -940,14 +941,17 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         {
             int pageIndex = Convert.ToInt32(PageNumTextContent) - 1;
 
+            Rect rect = LinkAnnotArgs.GetLinkCreateArea();
+
             if (btnGOorBack.Tag.ToString() == "GO")
             {
+                pdfViewer.GoToPage(pageIndex);
+
                 //AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
                 //AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageIndex);
                 //AnnotAttribEvent?.UpdateAnnot();
 
                 historyPageIndex = LinkAnnotArgs != null ? LinkAnnotArgs.PageIndex : backPageIndex;
-                pdfViewer.GoToPage(pageIndex);
 
                 ChangeBtnGOorBack("BACK", btnGOorBack);
             }
@@ -957,6 +961,33 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 {
                     SelectAnnotation();
                     pdfViewer.GoToPage(historyPageIndex);
+
+                    double vertical = pdfViewer.GetVerticalOffset();
+                    double height = 0;
+                    CPDFDocument doc = pdfViewer.Document;
+                    CPDFPage docPage = doc.PageAtIndex(historyPageIndex, false);
+                    double y = docPage.PageSize.Height - rect.Top;
+                    double zoom = pdfViewer.ZoomFactor;
+                    double y1 = (rect.Y / 2) * zoom;
+                    if (historyPageIndex < pageIndex)
+                    {
+                        if (docPage.PageSize.Height / 2 < rect.Top)
+                        {
+                            //double y1 = (rect.Y / 2) * zoom;
+                            height = vertical + y1 + y * zoom;
+                            pdfViewer.ScrollToVerticalOffset(height);
+                        }
+                    }
+                    else
+                    {
+                        if (docPage.PageSize.Height / 2 < rect.Top)
+                        {
+                            height = vertical + y1 - y * zoom;
+                            pdfViewer.ScrollToVerticalOffset(height);
+                        }
+                    }
+
+                    //pdfViewer.SelectAnnotation(historyPageIndex, LinkAnnotArgs.AnnotIndex);
                     ChangeBtnGOorBack("GO", btnGOorBack);
                 }
             }

+ 2 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Layout.cs

@@ -188,7 +188,7 @@ namespace PDF_Master.ViewModels.Tools
                                 SetMenuItemVisibility(menuItem1, "ReadModel", "UnReadModel", viewContentViewModel.mainViewModel.IsBookMode);
                                 menuItem1.Click -= ReadModel_Click;
                                 menuItem1.Click += ReadModel_Click;
-                                
+
                                 break;
 
                             case "UnReadModel":
@@ -462,6 +462,7 @@ namespace PDF_Master.ViewModels.Tools
             separator.Height = 1;
             separator.BorderBrush = new SolidColorBrush(Color.FromArgb(0x33, 0x00, 0x00, 0x00));
             separator.BorderThickness = new Thickness(1);
+            separator.Margin = new Thickness(-30, 0, 0, 0);
             return separator;
         }