Просмотр исходного кода

填写与签名-BUG,打印入口-异常修复

liyijie 1 год назад
Родитель
Сommit
9fbbdf0203
1 измененных файлов с 29 добавлено и 70 удалено
  1. 29 70
      PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

+ 29 - 70
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -55,6 +55,7 @@ using Prism.Services.Dialogs;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDF_Master.Model.FillAndSign;
 using System.Windows.Shapes;
+using Dropbox.Api.TeamLog;
 
 namespace PDF_Master.ViewModels.FillAndSign
 {
@@ -69,11 +70,7 @@ namespace PDF_Master.ViewModels.FillAndSign
         public List<List<Point>> ShapePoints = new List<List<Point>>();
         public string Shape = "HookShape";
         private bool IsFillAndSign
-        {
-            get;
-
-            set;
-        } = true;
+        {get;set;} = true;
         private PopMenu FreeHandAnnotPopMenu;
         private PopMenu FreeTextAnnotPopMenu;
         private PopMenu MultiAnnotPopMenu;
@@ -82,11 +79,13 @@ namespace PDF_Master.ViewModels.FillAndSign
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
         public static bool IsEdit = false;
         public static bool IsSignPoint = false;
-        public Brush SelectColor = new SolidColorBrush(Colors.GreenYellow);
+        public Brush SelectColor = new SolidColorBrush(Color.FromArgb(0xff, 0x26, 0x25, 0x29));
         public double FillOpacity = 1;
         public double LineWidth = 2;
         public double LineWidthMultiple = 1;
 
+        public bool IsClickNull=false;
+
         private string DateOrText = "";
 
         private bool _HookShapeIsCheck = false;
@@ -101,10 +100,10 @@ namespace PDF_Master.ViewModels.FillAndSign
         private void InitkeyShape()
         {
 
-            keyShape["HookShape"] = new List<List<Point>> { new List<Point> { new Point(2 ,12.2028), new Point(9.77817 ,19.981), new Point(22.5061 ,2.30333) } };
-            keyShape["ForkShape"] = new List<List<Point>> { new List<Point> { new Point(5,5), new Point(23,23)  }, new List<Point> { new Point(23, 5), new Point( 5,23) } };
+            keyShape["HookShape"] = new List<List<Point>> { new List<Point> { new Point(2, 12.2028), new Point(9.77817, 19.981), new Point(22.5061, 2.30333) } };
+            keyShape["ForkShape"] = new List<List<Point>> { new List<Point> { new Point(5, 5), new Point(23, 23) }, new List<Point> { new Point(23, 5), new Point(5, 23) } };
             keyShape["RectShape"] = new List<List<Point>> { new List<Point> { new Point(1.40002, 1.40002), new Point(20, 1.40002) }, new List<Point> { new Point(20, 1.40002), new Point(20, 20) }, new List<Point> { new Point(20, 20), new Point(1.40002, 20) }, new List<Point> { new Point(1.40002, 20), new Point(1.40002, 1.40002) } };
-            keyShape["LineShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 14) ,new Point(25.127, 14) } };
+            keyShape["LineShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 14), new Point(25.127, 14) } };
             keyShape["DotShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
 
 
@@ -198,16 +197,16 @@ namespace PDF_Master.ViewModels.FillAndSign
                 }
             }
         }
-
-        #endregion 事件聚合器
         private void InitFillAndSignProperty()
         {
 
             var FreehandDefault = GetAnnotDefault(AnnotArgsType.AnnotFreehand, "FillAndSign");
-            SelectColor = new SolidColorBrush(FreehandDefault.BorderColor != Color.FromArgb(0, 0, 0, 0) ? FreehandDefault.BorderColor : Colors.GreenYellow);
+            SelectColor = new SolidColorBrush(FreehandDefault.BorderColor != Color.FromArgb(0, 0, 0, 0) ? FreehandDefault.BorderColor : Color.FromArgb(0xff, 0x26, 0x25, 0x29));
             FillOpacity = FreehandDefault.Opacity > 0 ? FreehandDefault.Opacity : 1;
             LineWidth = FreehandDefault.Thickness > 0 ? FreehandDefault.Thickness : 2;
         }
+        #endregion 事件聚合器
+
         private System.Windows.Controls.Primitives.Popup popup = null;
         private async void AnnotColorPalette_Menu(object obj)
         {
@@ -376,7 +375,18 @@ namespace PDF_Master.ViewModels.FillAndSign
                         var FreehandDefault = GetAnnotDefault(AnnotArgsType.AnnotFreehand, "FillAndSign");
                         FreehandDefault.BorderColor = color;
                         FreehandDefault.Opacity = freeHand.Transparency;
+
                         FreehandDefault.Thickness = freeHand.LineWidth;
+                        foreach (var point in viewContentViewModel.FillAndSign)
+                        {
+                            if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
+                            {
+                                if (point.Shape == "DotShape")
+                                {
+                                    FreehandDefault.Thickness = FreehandDefault.Thickness / 5;
+                                }
+                            }
+                        }
                         FreehandDefault.SaveKey = "FillAndSign";
                         var isSolid = AnnotTransfer.IsSolidStyle(freeHand.LineDash);
                         if (isSolid)
@@ -801,15 +811,6 @@ namespace PDF_Master.ViewModels.FillAndSign
 
             //AddToPropertyPanel("ShapFillProperty", "Freehand", selectedArgs, annotAttribsList);
             return freehandArgs;
-        }
-        private bool ListPoint(List<List<Point>> leftpoints, List<List<Point>> rightpoints)
-        {
-
-            if (leftpoints.Count == rightpoints.Count)
-            {
-                if (leftpoints[0][0].X == rightpoints[0][0].X) { return true; }
-            }
-            return false;
         }
 
         /// <summary>
@@ -1310,7 +1311,7 @@ namespace PDF_Master.ViewModels.FillAndSign
             }
         }
 
-        private async void  PDFViewer_AnnotHoverHandler(object sender, AnnotHoverData e)
+        private void PDFViewer_AnnotHoverHandler(object sender, AnnotHoverData e)
         {
             if (e != null && e.DrawContext != null)
             {
@@ -1321,51 +1322,7 @@ namespace PDF_Master.ViewModels.FillAndSign
                     e.PaintRect.Height + 4);
                 Pen hoverPen = new Pen(new SolidColorBrush(Color.FromArgb(0xff, 0x11, 0x8A, 0xff)), 1);
                 hoverPen.DashStyle = DashStyles.Dash;
-                e.DrawContext?.DrawRectangle(null, hoverPen, hoverRect);
-
-            ////Todo: 目前ComPDFKit.Viewer没有e.Annot参数
-            ////便签,显示ToolTip内容
-            //    if (e.Annot != null && e.Annot.Type == C_ANNOTATION_TYPE.C_ANNOTATION_INK)
-            //    {
-                    
-            //        {
-
-            //            var item = new ColorDropBoxPop();
-            //            //item.DataContext = (sender as Ellipse).DataContext;
-            //            item.ColorSelected -= AnnotMenu_ColorSelected;
-            //            item.ColorSelected += AnnotMenu_ColorSelected;
-
-            //            if (popup == null)
-            //            { popup = new System.Windows.Controls.Primitives.Popup(); }
-            //            else { popup.IsOpen = false; }
-
-            //            ContentControl window = null;
-            //            if (PDFViewer.Parent as ContentControl != null)
-            //                window = PDFViewer.Parent as ContentControl;
-            //            else
-            //                window = App.Current.MainWindow;
-
-            //            popup.Child = item;
-            //            popup.PlacementRectangle = new Rect(Mouse.GetPosition(window), new Size(item.Width, item.Height));
-            //            popup.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
-            //            popup.PlacementTarget = window;
-            //            popup.IsOpen = true;
-
-            //            Window parentWnd = Window.GetWindow(App.Current.MainWindow);
-            //            if (parentWnd != null)
-            //            {
-            //                parentWnd.MouseDown -= parentWnd_MouseDown;
-            //                parentWnd.MouseDown += parentWnd_MouseDown;
-            //            }
-                       
-            //                while (popup!= null &&  popup.IsOpen)
-            //                await Task.Delay(20);
-
-            //            parentWnd.MouseDown -= parentWnd_MouseDown;
-            //            popup = null;
-            //        }
-
-            //    }
+                e.DrawContext?.DrawRectangle(null, hoverPen, hoverRect);
             }
 
             CloseAnnotToolTip();
@@ -1628,6 +1585,7 @@ namespace PDF_Master.ViewModels.FillAndSign
         {
             if (e != null)
             {
+                IsClickNull=false;
                 var annot = e.AnnotItemsList[0];
                 if (annot != null)
                 {
@@ -1715,8 +1673,9 @@ namespace PDF_Master.ViewModels.FillAndSign
             }
             else
             {
-                if(PDFViewer.MouseMode != MouseModes.AnnotCreate)
-                viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+                if (PDFViewer.MouseMode != MouseModes.AnnotCreate) { viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); }
+
+                else { IsClickNull = true; }
             }
         }
         //private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
@@ -1841,7 +1800,7 @@ namespace PDF_Master.ViewModels.FillAndSign
                         }
                         if (isDifferen)
                         {
-                            ShowPropertyPanel(true); AddToPropertyPanel("SignatureAnnotProperty"); return;
+                            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return;
                         }
                         viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return;
                     }