Bläddra i källkod

注释,选中页面上的文本后,点击工具栏形状图标,默认要在刚刚选择的文本上添加形状

OYXH\oyxh 2 år sedan
förälder
incheckning
367904549f

+ 27 - 19
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -764,25 +764,33 @@ namespace PDF_Master.ViewModels.Tools
             var drawRectTuple = DrawRectCreateAnnot();
             if (drawRectTuple != null)
             {
-                //annotArgs.PageIndex = drawRectTuple.Item1;
-                //annotArgs.ClientRect = drawRectTuple.Item2;
-                //PDFViewer.CreatePageAnnot(drawRectTuple.Item1, annotArgs);
-
-                LinkAnnotArgs linkArgs = new LinkAnnotArgs();
-                linkArgs.ClientRect = drawRectTuple.Item2;
-                linkArgs.URI = string.Empty;
-                linkArgs.LinkType = LINK_TYPE.GOTO;
-                linkArgs.DestIndex = drawRectTuple.Item1;
-                PDFViewer.CreatePageAnnot(drawRectTuple.Item1, linkArgs);
-                //BtnLinkIsChecked = true;
-                //List<AnnotHandlerEventArgs> lists = new List<AnnotHandlerEventArgs>();
-                //lists.Add(linkArgs);
-                //propertyPanel.IsAddLink = true;
-
-                //annotArgs = GetLink(lists);
-                //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                //PDFViewer.SetToolParam(annotArgs);
-                //viewContentViewModel.IsPropertyOpen = true;
+                if (annotArgs is LinkAnnotArgs linkAnnot)
+                {
+                    //annotArgs.PageIndex = drawRectTuple.Item1;
+                    //annotArgs.ClientRect = drawRectTuple.Item2;
+                    //PDFViewer.CreatePageAnnot(drawRectTuple.Item1, annotArgs);
+
+                    LinkAnnotArgs linkArgs = new LinkAnnotArgs();
+                    linkArgs.ClientRect = drawRectTuple.Item2;
+                    linkArgs.URI = string.Empty;
+                    linkArgs.LinkType = LINK_TYPE.GOTO;
+                    linkArgs.DestIndex = drawRectTuple.Item1;
+                    PDFViewer.CreatePageAnnot(drawRectTuple.Item1, linkArgs);
+                    //BtnLinkIsChecked = true;
+                    //List<AnnotHandlerEventArgs> lists = new List<AnnotHandlerEventArgs>();
+                    //lists.Add(linkArgs);
+                    //propertyPanel.IsAddLink = true;
+
+                    //annotArgs = GetLink(lists);
+                    //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    //PDFViewer.SetToolParam(annotArgs);
+                    //viewContentViewModel.IsPropertyOpen = true;
+                }
+                if (annotArgs is SquareAnnotArgs squareAnnot)
+                {
+                    squareAnnot.ClientRect = drawRectTuple.Item2;
+                    PDFViewer.CreatePageAnnot(drawRectTuple.Item1, squareAnnot);
+                }
             }
         }
 

+ 3 - 3
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -166,7 +166,6 @@ namespace PDF_Master.ViewModels.Tools
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
             }
         }
-
         //点击注释工具
         private void BtnMyTools_Click(CustomIconToggleBtn annotBtn)
         {
@@ -212,7 +211,7 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     events.GetEvent<LinkAnnotTipCloseEvent>().Publish(new LinkAnnotTipCloseArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode });
                 }
-                
+
             }
 
             if (dictVar["isTemplateAnnot"] == false && annotArgs == null)
@@ -1576,10 +1575,11 @@ namespace PDF_Master.ViewModels.Tools
             if (KeyEventsHelper.IsSingleKey(Key.Escape))
             {
                 //BtnHandIsChecked = true;
-                PDFViewer.SetMouseMode(MouseModes.PanTool);
+                
                 PDFViewer.ClearSelectAnnots();
                 StrAnnotToolChecked = "";
                 ShowPropertyPanel(false);
+                PDFViewer.SetMouseMode(MouseModes.PanTool);
             }
             else if (KeyEventsHelper.IsModifierKey(ModifierKeys.Shift, Key.None))
             {