فهرست منبع

注释-手绘 不显示悬浮虚线框、链接注释UI优化、形状注释优化

OYXH\oyxh 1 سال پیش
والد
کامیت
092181f7a3

BIN
PDF Office/Resources/PropertyPanel/no link.png


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

@@ -636,6 +636,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             {
                 if (CheckPageNumVaild(out int pageNum, PageNumTextContent))
                 {
+                    isSelected = false;
                     propertyPanel.IsAddLink = false;
 
                     if (LinkAnnotArgs.PageIndex == -1)
@@ -686,7 +687,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     BtnLocationIsEnabled = true;
                     ImagePreviewVisibility = Visibility.Collapsed;
                     BtnGOorBackVisibility = Visibility.Collapsed;
-                    isSelected = false;
+                    
                 }
             }
             else
@@ -1360,6 +1361,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 }
                 else
                 {
+                    
                     if (propertyPanel.annot.AnnotIndex == -1 && propertyPanel.annot.PageIndex == -1)
                     {
                         IsEmptyPanelVisibility = Visibility.Visible;

+ 12 - 9
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -377,14 +377,17 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         annotArgs = PropertyPanel.LastAnnotDict[AnnotArgsType.AnnotLine];
                         break;
                 }
-                annotArgs.PageIndex = -1;
-                annotArgs.AnnotIndex = -1;
-                annotArgs.ClientRect = Rect.Empty;
-                PropertyPanel.annot = annotArgs;
-                Annot = annotArgs;
-                PropertyPanel.annotlists = new List<AnnotHandlerEventArgs>();
-                PropertyPanel.annotlists.Add(PropertyPanel.annot);
-                PropertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(Annot, Annot.GetAnnotAttrib());
+                if (annotArgs != null)
+                {
+                    annotArgs.PageIndex = -1;
+                    annotArgs.AnnotIndex = -1;
+                    annotArgs.ClientRect = Rect.Empty;
+                    PropertyPanel.annot = annotArgs;
+                    Annot = annotArgs;
+                    PropertyPanel.annotlists = new List<AnnotHandlerEventArgs>();
+                    PropertyPanel.annotlists.Add(PropertyPanel.annot);
+                    PropertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(Annot, Annot.GetAnnotAttrib());
+                }
             }
         }
 
@@ -522,7 +525,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         if (annotLine.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && annotLine.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
                             BasicVm.AnnotTypeTitle = ArrowTitle;
                         else
-                            BasicVm.AnnotTypeTitle =LineTitle;
+                            BasicVm.AnnotTypeTitle = LineTitle;
                     }
                     break;
             }

+ 35 - 9
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -426,22 +426,44 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                     }
-                       
+
                     //PDFViewer.SetMouseMode(MouseModes.PanTool);
                     //HandToolIsCheckedEvent(false);
                     return;
                 }
                 else
                 {
-                    if (StrAnnotToolChecked != "Stamp" && StrAnnotToolChecked != "Freetext")
+                    if (StrAnnotToolChecked == "Rect" && PropertyPanel.IsSelectedTextAddShape == false)
                     {
                         AnnotHandlerEventArgs annotArgs = null;
                         //此处不能用这个方法更新创建注释的属性  会导致死循环
+                        //选择文字 点击矩形 会导致死循环
                         // FindAnnotTypeKey(StrAnnotToolChecked, ref annotArgs);
 
+                        PropertyPanel.annot = null;
+                        PropertyPanel.AnnotEvents = null;
+                        PropertyPanel.AnnotEvent = null;
+                        PropertyPanel.annotlists = null;
+                        switch (PropertyPanel.SharpsAnnot)
+                        {
+                            case "Rect":
+                                annotArgs = GetRect();
+                                break;
+
+                            case "Circle":
+                                annotArgs = GetCircle();
+                                break;
+
+                            case "Arrow":
+                                annotArgs = GetArrowLine("Arrow");
+                                break;
+
+                            case "Line":
+                                annotArgs = GetArrowLine("Line");
+                                break;
+                        }
                         return;
                     }
-                    return;
                 }
             }
 
@@ -508,7 +530,7 @@ namespace PDF_Master.ViewModels.Tools
                         }
                         else
                         {
-                            if (!string.IsNullOrEmpty(StrAnnotToolChecked)|| PropertyPanel.IsAddLink==true)
+                            if (!string.IsNullOrEmpty(StrAnnotToolChecked) || PropertyPanel.IsAddLink == true)
                             {
                                 GetSelectedAnnots(e);
                                 PDFViewer.SetToolParam(annot);
@@ -922,10 +944,9 @@ namespace PDF_Master.ViewModels.Tools
         /// <param name="e"></param>
         private void PDFViewer_SnapshotCommandHandler(object sender, SnapshotCommandArgs e)
         {
-            SnapshotEditToolArgs snapToolArgs=new SnapshotEditToolArgs ();
+            SnapshotEditToolArgs snapToolArgs = new SnapshotEditToolArgs();
             if (PDFViewer.ToolManager.CurrentAnnotArgs is SnapshotEditToolArgs)
             {
-
                 snapToolArgs = (SnapshotEditToolArgs)PDFViewer.ToolManager.CurrentAnnotArgs;
 
                 SnapshotEditMenuViewModel.SnapToolArgs = snapToolArgs;
@@ -1099,8 +1120,9 @@ namespace PDF_Master.ViewModels.Tools
                                 else
                                 {
                                     if (annot.EventType == AnnotArgsType.AnnotSquare || annot.EventType == AnnotArgsType.AnnotCircle ||
-                                annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp /*||
-                                annot.EventType == AnnotArgsType.AnnotSticky ||annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand*/)
+                                annot.EventType == AnnotArgsType.AnnotLine || annot.EventType == AnnotArgsType.AnnotStamp ||
+                                annot.EventType==AnnotArgsType.AnnotLink
+                                /*|| annot.EventType == AnnotArgsType.AnnotSticky ||annot.EventType == AnnotArgsType.AnnotFreeText || annot.EventType == AnnotArgsType.AnnotFreehand*/)
                                     {
                                         if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
                                         {
@@ -1185,7 +1207,7 @@ namespace PDF_Master.ViewModels.Tools
                                 int annotindex = editEvent.AnnotIndex;
                                 viewModel.DeleteModifiedAnnot(pageindex, annotindex);
                             }
-                            if(string.IsNullOrEmpty(StrAnnotToolChecked))
+                            if (string.IsNullOrEmpty(StrAnnotToolChecked))
                             {
                                 ExitAnnotationTool();
                                 viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
@@ -1291,6 +1313,10 @@ namespace PDF_Master.ViewModels.Tools
                         return;
                     }
                 }
+                if (StrAnnotToolChecked == "Freehand")
+                {
+                    return;
+                }
                 Rect hoverRect = new Rect(
                     e.PaintRect.Left - 2,
                     e.PaintRect.Top - 2,

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

@@ -856,18 +856,21 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 if (annotArgs is SquareAnnotArgs squareAnnot)
                 {
+                    PropertyPanel.IsSelectedTextAddShape = true;
                     squareAnnot.ClientRect = drawRectTuple.Item2;
                     PDFViewer.CreatePageAnnot(drawRectTuple.Item1, squareAnnot);
                     annotHandler = squareAnnot;
                 }
                 if (annotArgs is CircleAnnotArgs circleAnnot)
                 {
+                    PropertyPanel.IsSelectedTextAddShape = true;
                     circleAnnot.ClientRect = drawRectTuple.Item2;
                     PDFViewer.CreatePageAnnot(drawRectTuple.Item1, circleAnnot);
                     annotHandler = circleAnnot;
                 }
                 if (annotArgs is LineAnnotArgs lineAnnot)
                 {
+                    PropertyPanel.IsSelectedTextAddShape = true;
                     lineAnnot.ClientRect = drawRectTuple.Item2;
                     PDFViewer.CreatePageAnnot(drawRectTuple.Item1, lineAnnot);
                     annotHandler = lineAnnot;
@@ -1052,7 +1055,6 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             selectedArgs.Clear();
                             selectedArgs.Add(annotArgs);
-                            PropertyPanel.IsSelectedTextAddShape = true;
                         }
                     }
                 }
@@ -1148,7 +1150,6 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             selectedArgs.Clear();
                             selectedArgs.Add(annotArgs);
-                            PropertyPanel.IsSelectedTextAddShape = true;
                         }
                     }
                 }

+ 15 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -1712,25 +1712,36 @@ namespace PDF_Master.ViewModels.Tools
                             case AnnotArgsType.AnnotLine:
                             case AnnotArgsType.AnnotSquare:
                             case AnnotArgsType.AnnotCircle:
-
-                            case AnnotArgsType.AnnotSticky:
                             case AnnotArgsType.AnnotFreeText:
                                 Trace.WriteLine(StrAnnotToolChecked);
                                 if (PDFViewer.ToolManager.HasTool)
                                 {
                                     PDFViewer.RemoveTool(false);
                                 }
-                                else { ExitAnnotationTool(); }
+                                else
+                                {
+                                    ExitAnnotationTool();
+                                }
+                                break;
+
+                            case AnnotArgsType.AnnotSticky:
+                                if (annotArgs is StickyAnnotArgs stickyAnnotArgs)
+                                {
+                                    ExitAnnotationTool();
+                                }
                                 break;
 
                             case AnnotArgsType.AnnotHighlight:
                             case AnnotArgsType.AnnotUnderline:
                             case AnnotArgsType.AnnotStrikeout:
                             case AnnotArgsType.AnnotStamp:
-                            case AnnotArgsType.AnnotLink:
                             case AnnotArgsType.AnnotFreehand:
                             case AnnotArgsType.AnnotSelectTool:
                                 ExitAnnotationTool();
+                                break;
+
+                            case AnnotArgsType.AnnotLink:
+                                ExitAnnotationTool();
 
                                 events.GetEvent<LinkAnnotTipCloseEvent>().Publish(new LinkAnnotTipCloseArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode });
                                 break;

+ 5 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/LinkAnnotProperty.xaml

@@ -309,6 +309,7 @@
                     Command="{Binding BtnGOorBackPageCommand}"
                     Content="{Binding BtnGOorBackContent}"
                     FontSize="16"
+                    Width="80"
                     Style="{StaticResource btn.link}"
                     Tag="GO"
                     Visibility="{Binding BtnGOorBackVisibility}">
@@ -327,6 +328,7 @@
             <StackPanel
                 Name="EmptyPanel"
                 VerticalAlignment="Center"
+                Margin="0,180,0,0"
                 Visibility="{Binding IsEmptyPanelVisibility}">
                 <Image
                     Width="128"
@@ -336,7 +338,9 @@
                     Name="txtEmpty"
                     Margin="0,12,0,0"
                     FontFamily="Segoe UI"
-                    FontSize="16"
+                    FontSize="12"
+                    Width="168"
+                    Foreground="{StaticResource color.sys.text.neutral.lv3}"
                     Text="{Binding T_EmptyTitle}"
                     TextAlignment="Center" TextWrapping="Wrap" />
             </StackPanel>