Bladeren bron

注释 13511 矩形、圆

OYXH\oyxh 1 jaar geleden
bovenliggende
commit
712fc537b1

+ 1 - 0
PDF Office/ViewModels/Tools/AnnotManager/AnnotTransfer.cs

@@ -22,6 +22,7 @@ namespace PDF_Master.ViewModels.Tools.AnnotManager
         public bool IsAddLink = false;
         public bool IsLocationLink = false;
         public bool IsSelectedTextAddLink = false;
+        public bool IsSelectedTextAddShape = false;
         public AnnotAttribEvent AnnotEvent { get; set; }
         public List<AnnotAttribEvent> AnnotEvents = new List<AnnotAttribEvent>();
 

+ 28 - 16
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -798,11 +798,6 @@ namespace PDF_Master.ViewModels.Tools
             {
                 if (annotArgs is LinkAnnotArgs linkAnnot)
                 {
-                    //annotArgs.PageIndex = drawRectTuple.Item1;
-                    //annotArgs.ClientRect = drawRectTuple.Item2;
-                    //PDFViewer.CreatePageAnnot(drawRectTuple.Item1, annotArgs);
-
-                    //LinkAnnotArgs linkArgs = new LinkAnnotArgs();
                     linkAnnot.ClientRect = drawRectTuple.Item2;
                     linkAnnot.URI = string.Empty;
                     linkAnnot.LinkType = LINK_TYPE.GOTO;
@@ -810,16 +805,6 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.CreatePageAnnot(drawRectTuple.Item1, linkAnnot);
 
                     annotHandler = linkAnnot;
-
-                    //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)
                 {
@@ -827,6 +812,18 @@ namespace PDF_Master.ViewModels.Tools
                     PDFViewer.CreatePageAnnot(drawRectTuple.Item1, squareAnnot);
                     annotHandler = squareAnnot;
                 }
+                if (annotArgs is CircleAnnotArgs circleAnnot)
+                {
+                    circleAnnot.ClientRect = drawRectTuple.Item2;
+                    PDFViewer.CreatePageAnnot(drawRectTuple.Item1, circleAnnot);
+                    annotHandler = circleAnnot;
+                }
+                if (annotArgs is LineAnnotArgs lineAnnot)
+                {
+                    lineAnnot.ClientRect = drawRectTuple.Item2;
+                    PDFViewer.CreatePageAnnot(drawRectTuple.Item1, lineAnnot);
+                    annotHandler = lineAnnot;
+                }
             }
             return annotHandler;
         }
@@ -996,7 +993,14 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     selectedArgs = new List<AnnotHandlerEventArgs>();
                     selectedArgs.Add(squareArgs);
-                    CreateAnnotFromSelectPageText(squareArgs);
+                    //CreateAnnotFromSelectPageText(squareArgs);
+                    AnnotHandlerEventArgs annotHandler = CreateAnnotFromSelectPageText(squareArgs);
+                    if (annotHandler is SquareAnnotArgs annotArgs)
+                    {
+                        selectedArgs.Clear();
+                        selectedArgs.Add(annotArgs);
+                        PropertyPanel.IsSelectedTextAddShape = true;
+                    }
                 }
             }
             else
@@ -1076,12 +1080,20 @@ namespace PDF_Master.ViewModels.Tools
                     circleAnnotArgs.LineWidth = circleAnnot.LineWidth;
                     circleAnnotArgs.Transparency = circleAnnot.Transparency;
                     circleAnnotArgs.LineDash = circleAnnot.LineDash;
+                    circleAnnotArgs.ClientRect = Rect.Empty;
                 }
 
                 if (circleAnnotArgs != null)
                 {
                     selectedArgs = new List<AnnotHandlerEventArgs>();
                     selectedArgs.Add(circleAnnotArgs);
+                    AnnotHandlerEventArgs annotHandler = CreateAnnotFromSelectPageText(circleAnnotArgs);
+                    if (annotHandler is CircleAnnotArgs annotArgs)
+                    {
+                        selectedArgs.Clear();
+                        selectedArgs.Add(annotArgs);
+                        PropertyPanel.IsSelectedTextAddShape = true;
+                    }
                 }
             }
             else

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

@@ -207,6 +207,11 @@ namespace PDF_Master.ViewModels.Tools
                     PropertyPanel.IsSelectedTextAddLink = false;
                     PDFViewer.SelectAnnotation(PropertyPanel.annot.PageIndex, PropertyPanel.annot.AnnotIndex);
                 }
+                if (PropertyPanel.IsSelectedTextAddShape)
+                {
+                    PropertyPanel.IsSelectedTextAddShape = false;
+                    PDFViewer.SelectAnnotation(PropertyPanel.annot.PageIndex, PropertyPanel.annot.AnnotIndex);
+                }
             }
             else
             {
@@ -1590,7 +1595,6 @@ namespace PDF_Master.ViewModels.Tools
                 if (StrAnnotToolChecked != "Freetext")
                 {
                     ExitAnnotationTool();
-                    
                 }
                 else if (StrAnnotToolChecked == "Freetext")
                 {