Browse Source

BUG-链接

OYXH\oyxh 2 years ago
parent
commit
aead999674

+ 3 - 4
PDF Office/ViewModels/PropertyPanel/AnnotPanel/LinkAnnotPropertyViewModel.cs

@@ -770,7 +770,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                         //viewContentViewModel.LinkAnnotTipVisibility = Visibility.Collapsed;
                         viewContentViewModel.TipVisible = Visibility.Collapsed;
 
-                       
                         //没有选择注释工具、也不是右键添加注释
                         //在阅读页,选择注释后,点击按钮
                         //需要设置相关参数
@@ -779,11 +778,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                             pdfViewer.SetMouseMode(MouseModes.PanTool);
                             propertyPanel.IsLocationLink = false;
                         }
-                        await System.Threading.Tasks.Task.Delay(5);
+                        //await System.Threading.Tasks.Task.Delay(5);
                         pdfViewer.GoToPage(historyPageIndex);
 
-                        //await System.Threading.Tasks.Task.Delay(5);
-                        SelectAnnotation();
+                        await System.Threading.Tasks.Task.Delay(5);
+                        pdfViewer.SelectAnnotation(LinkAnnotArgs.PageIndex, LinkAnnotArgs.AnnotIndex);
 
                         BtnLocationIsChecked = false;
                         //}

+ 5 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -232,7 +232,11 @@ namespace PDF_Office.ViewModels.Tools
                 case AnnotArgsType.AnnotLink:
                     //viewContentViewModel.IsCreateLink = false;
                     //e.IsAnnotCreateReset= true;
-                    propertyPanel.IsAddLink = false;
+                    if (btnLinkIsChecked == false)
+                    {
+                        propertyPanel.IsAddLink = false;
+                    }
+
                     GetLink(e.AnnotItemsList, e);
                     break;
 

+ 80 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -945,6 +945,84 @@ namespace PDF_Office.ViewModels.Tools
 
         #region 菜单
 
+        /// <summary>
+        /// 空白处-右键菜单-添加注释
+        /// </summary>
+        /// <param name="sender"></param>
+        private void AddAnnotation_Click(object sender)
+        {
+            if (sender is MenuItem menuItem)
+            {
+                AnnotHandlerEventArgs annotHandler = null;
+                string str = menuItem.Tag.ToString();
+                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                propertyPanel.IsAddLink = false;
+                propertyPanel.IsLocationLink = false;
+                if (str == AddAnnotType.AnnotFreehand.ToString())
+                {
+                    annotHandler = GetFreehand();
+                }
+                if (str == AddAnnotType.AnnotFreeText.ToString())
+                {
+                    annotHandler = GetFreetext();
+                }
+                if (str == AddAnnotType.AnnotSticky.ToString())
+                {
+                    annotHandler = GetStickyNote();
+                }
+                if (str == AddAnnotType.AnnotSquare.ToString())
+                {
+                    annotHandler = GetRect();
+                }
+                if (str == AddAnnotType.AnnotCircle.ToString())
+                {
+                    annotHandler = GetCircle();
+                }
+                if (str == AddAnnotType.AnnotArrow.ToString())
+                {
+                    annotHandler = GetArrowLine("Arrow");
+                }
+                if (str == AddAnnotType.AnnotLine.ToString())
+                {
+                    annotHandler = GetArrowLine("Line");
+                }
+                if (str == AddAnnotType.AnnotLink.ToString())
+                {
+                    propertyPanel.IsAddLink = true;
+                    annotHandler = GetLink();
+                }
+                if (str == AddAnnotType.AnnotStamp.ToString())
+                {
+                    annotHandler = GetStamp();
+                }
+                if (str == AddAnnotType.AnnotAutograph.ToString())
+                {
+                    annotHandler = GetSignature();
+                }
+                if (annotHandler != null)
+                {
+                    annotHandler.Author = Settings.Default.AppProperties.Description.Author;
+                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    PDFViewer.SetToolParam(annotHandler);
+                    ShowPropertyPanel(true);
+
+                    #region 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+
+                    //isRightMenuAddAnnot = true;
+                    //if (str != AddAnnotType.AnnotLink.ToString())
+                    //{
+                    //    ShowPropertyPanel(false);
+                    //}
+                    //else
+                    //{
+                    //    ShowPropertyPanel(true);
+                    //}
+
+                    #endregion 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
+                }
+            }
+        }
+
         /// <summary>
         /// 选择文本、图片,右键菜单
         /// </summary>
@@ -1002,7 +1080,8 @@ namespace PDF_Office.ViewModels.Tools
 
                     case "StickyNote"://便签
                         StickyAnnotArgs stickyAnnotArgs = (StickyAnnotArgs)GetStickyNote();
-                        stickyAnnotArgs.ClientRect = annotCommand.TextRect;
+                        //stickyAnnotArgs.ClientRect = annotCommand.TextRect;
+                        stickyAnnotArgs.ClientRect = new Rect(annotCommand.TextRect.X, annotCommand.TextRect.Y - annotCommand.TextRect.Height, annotCommand.TextRect.Width, annotCommand.TextRect.Height);
                         stickyAnnotArgs.StickyNote = annotCommand.Text;
                         PDFViewer.CreatePageAnnot(annotCommand.PageIndex, stickyAnnotArgs);
                         break;

+ 0 - 76
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -218,83 +218,7 @@ namespace PDF_Office.ViewModels.Tools
             }
         }
 
-        /// <summary>
-        /// 空白处-右键菜单-添加注释
-        /// </summary>
-        /// <param name="sender"></param>
-        private void AddAnnotation_Click(object sender)
-        {
-            if (sender is MenuItem menuItem)
-            {
-                AnnotHandlerEventArgs annotHandler = null;
-                string str = menuItem.Tag.ToString();
-                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
-                propertyPanel.IsAddLink = false;
-                propertyPanel.IsLocationLink = false;
-                if (str == AddAnnotType.AnnotFreehand.ToString())
-                {
-                    annotHandler = GetFreehand();
-                }
-                if (str == AddAnnotType.AnnotFreeText.ToString())
-                {
-                    annotHandler = GetFreetext();
-                }
-                if (str == AddAnnotType.AnnotSticky.ToString())
-                {
-                    annotHandler = GetStickyNote();
-                }
-                if (str == AddAnnotType.AnnotSquare.ToString())
-                {
-                    annotHandler = GetRect();
-                }
-                if (str == AddAnnotType.AnnotCircle.ToString())
-                {
-                    annotHandler = GetCircle();
-                }
-                if (str == AddAnnotType.AnnotArrow.ToString())
-                {
-                    annotHandler = GetArrowLine("Arrow");
-                }
-                if (str == AddAnnotType.AnnotLine.ToString())
-                {
-                    annotHandler = GetArrowLine("Line");
-                }
-                if (str == AddAnnotType.AnnotLink.ToString())
-                {
-                    propertyPanel.IsAddLink = true;
-                    annotHandler = GetLink();
-                }
-                if (str == AddAnnotType.AnnotStamp.ToString())
-                {
-                    annotHandler = GetStamp();
-                }
-                if (str == AddAnnotType.AnnotAutograph.ToString())
-                {
-                    annotHandler = GetSignature();
-                }
-                if (annotHandler != null)
-                {
-                    annotHandler.Author = Settings.Default.AppProperties.Description.Author;
-                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                    PDFViewer.SetToolParam(annotHandler);
-                    ShowPropertyPanel(true);
-
-                    #region 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
-
-                    //isRightMenuAddAnnot = true;
-                    //if (str != AddAnnotType.AnnotLink.ToString())
-                    //{
-                    //    ShowPropertyPanel(false);
-                    //}
-                    //else
-                    //{
-                    //    ShowPropertyPanel(true);
-                    //}
 
-                    #endregion 设计重新调整,阅读页空白处,右键菜单,添加链接需要显示,其他和pro mac一样的效果,不显示属性栏
-                }
-            }
-        }
 
         #endregion Command实现