Forráskód Böngészése

注释 - 修复bug,签名保存数据放在ViewContentViewModel

chenrongqian@kdanmobile.com 1 éve
szülő
commit
40420cef3d

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreehandAnnotPropertyViewModel.cs

@@ -358,7 +358,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.InkColor.A != item.InkColor.A || temp.InkColor.R != item.InkColor.R || temp.InkColor.G != item.InkColor.G || temp.InkColor.B != item.InkColor.B)
                         {
-                            BasicVm.FontColor = new SolidColorBrush(Colors.Transparent);
+                            BasicVm.FontColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                             isNoEqualsDir["Color"] = true;
                         }
                     }

+ 2 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -591,7 +591,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.FontColor.A != item.FontColor.A || temp.FontColor.R != item.FontColor.R || temp.FontColor.G != item.FontColor.G || temp.FontColor.B != item.FontColor.B)
                         {
-                            FontVm.FontColor = new SolidColorBrush(Colors.Transparent);
+                            FontVm.FontColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                             isNoEqualsDir["FontColor"] = true;
                         }
                     }
@@ -600,7 +600,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.BgColor.A != item.BgColor.A || temp.BgColor.R != item.BgColor.R || temp.BgColor.G != item.BgColor.G || temp.BgColor.B != item.BgColor.B)
                         {
-                            BasicVm.FillColor = new SolidColorBrush(Colors.Transparent);
+                            BasicVm.FillColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                             isNoEqualsDir["FillColor"] = true;
                         }
                     }

+ 2 - 2
PDF Office/ViewModels/PropertyPanel/AnnotPanel/SharpsAnnotPropertyViewModel.cs

@@ -442,7 +442,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.BgColor.A != item.BgColor.A || temp.BgColor.R != item.BgColor.R || temp.BgColor.G != item.BgColor.G || temp.BgColor.B != item.BgColor.B)
                         {
-                            BasicVm.FillColor = new SolidColorBrush(Colors.Transparent);
+                            BasicVm.FillColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                             isNoEqualsDir["FillColor"] = true;
                         }
                     }
@@ -451,7 +451,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.LineColor.A != item.LineColor.A || temp.LineColor.R != item.LineColor.R || temp.LineColor.G != item.LineColor.G || temp.LineColor.B != item.LineColor.B)
                         {
-                            BasicVm.BorderColor = new SolidColorBrush(Colors.Transparent);
+                            BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01,0xff,0xff,0xff));
                             isNoEqualsDir["LineColor"] = true;
                         }
                     }

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/StickyNotePropertyViewModel.cs

@@ -233,7 +233,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     {
                         if (temp.Color.A != item.Color.A || temp.Color.R != item.Color.R || temp.Color.G != item.Color.G || temp.Color.B != item.Color.B)
                         {
-                            SharpColor = new SolidColorBrush(Colors.Transparent);
+                            SharpColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                             isNoEqualsDir["SharpColor"] = true;
                         }
                     }

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextAnnotPropertyViewModel.cs

@@ -204,7 +204,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
                     }
                     else
                     {
-                        BasicVm.FontColor = new SolidColorBrush(Colors.Transparent);
+                        BasicVm.FontColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
                     }
                     
                 }

+ 62 - 24
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -267,7 +267,7 @@ namespace PDF_Office.ViewModels.Tools
                 return;
 
 
-            var signAnnot = AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
+            var signAnnot = viewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
             if (signAnnot == null)
             {
                 if (annot.EventType == AnnotArgsType.AnnotStamp)
@@ -294,13 +294,13 @@ namespace PDF_Office.ViewModels.Tools
 
             if (StrAnnotToolChecked == "Signature")
             {
-                if (AnnotSignatures == null)
-                    AnnotSignatures = new List<Tuple<int, int>>();
+                if (viewContentViewModel.AnnotSignatures == null)
+                    viewContentViewModel.AnnotSignatures = new List<Tuple<int, int>>();
 
-                var signAnnot = AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
+                var signAnnot = viewContentViewModel.AnnotSignatures.FirstOrDefault(temp => temp.Item1 == annot.PageIndex && temp.Item2 == annot.AnnotIndex);
                 if (signAnnot == null)
                 {
-                    AnnotSignatures.Add(new Tuple<int, int>(annot.PageIndex, annot.AnnotIndex));
+                    viewContentViewModel.AnnotSignatures.Add(new Tuple<int, int>(annot.PageIndex, annot.AnnotIndex));
                 }
             }
         }
@@ -779,6 +779,43 @@ namespace PDF_Office.ViewModels.Tools
         {
             if (e != null && e.Count > 0)
             {
+                Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
+                int count = 0;
+                foreach (var item in e)
+                {
+                    if(item.EditAction == ActionType.Add)
+                    selectAnnotDicts.Add(count, new List<int>() { item.PageIndex, item.AnnotIndex });
+                    count++;
+                }
+                if(selectAnnotDicts.Count > 0)
+                {
+                    var annot = e[0].EditAnnotArgs;
+                    if (
+                       annot.EventType == AnnotArgsType.AnnotSquare ||
+                       annot.EventType == AnnotArgsType.AnnotCircle ||
+                       annot.EventType == AnnotArgsType.AnnotLine ||
+                       annot.EventType == AnnotArgsType.AnnotStamp ||
+                       annot.EventType == AnnotArgsType.AnnotFreeText
+                       )
+                    {
+                        PDFViewer.ClearSelectAnnots();
+                        if (StrAnnotToolChecked != "Signature")
+                        {
+                            PDFViewer.SelectAnnotation(selectAnnotDicts);
+                        }
+                        else
+                        {
+                            AddAnnotSignature(annot);
+                            PDFViewer.SelectAnnotation(selectAnnotDicts);
+                        }
+                    }
+                }
+                
+
+
+
+
+
                 for (int i = 0; i < e.Count; i++)
                 {
                     AnnotEditEvent editEvent = e[i];
@@ -800,25 +837,25 @@ namespace PDF_Office.ViewModels.Tools
                                 }
                             }
 
-                            var annot = e[0].EditAnnotArgs;
-                            if (
-                               annot.EventType == AnnotArgsType.AnnotSquare ||
-                               annot.EventType == AnnotArgsType.AnnotCircle ||
-                               annot.EventType == AnnotArgsType.AnnotLine ||
-                               annot.EventType == AnnotArgsType.AnnotStamp
-                               )
-                            {
-                                PDFViewer.ClearSelectAnnots();
-                                if (StrAnnotToolChecked != "Signature")
-                                {
-                                    PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
-                                }
-                                else
-                                {
-                                    AddAnnotSignature(annot);
-                                    PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
-                                } 
-                            }
+                            //var annot = e[0].EditAnnotArgs;
+                            //if (
+                            //   annot.EventType == AnnotArgsType.AnnotSquare ||
+                            //   annot.EventType == AnnotArgsType.AnnotCircle ||
+                            //   annot.EventType == AnnotArgsType.AnnotLine ||
+                            //   annot.EventType == AnnotArgsType.AnnotStamp
+                            //   )
+                            //{
+                            //    PDFViewer.ClearSelectAnnots();
+                            //    if (StrAnnotToolChecked != "Signature")
+                            //    {
+                            //        PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
+                            //    }
+                            //    else
+                            //    {
+                            //        AddAnnotSignature(annot);
+                            //        PDFViewer.SelectAnnotation(annot.PageIndex, annot.AnnotIndex);
+                            //    } 
+                            //}
 
                             
                             break;
@@ -897,6 +934,7 @@ namespace PDF_Office.ViewModels.Tools
         {
             if (sender != null && PDFViewer.ToolTip != null && PDFViewer.Parent != null)
             {
+                //鼠标移到注释之外,关闭ToolTip浮窗
                 var newPoint = e.GetPosition(PDFViewer.Parent as ContentControl);
                 var isOutw = newPoint.X > (oldRect.X + oldRect.Width + 4);
                 var isOuth = newPoint.Y > (oldRect.Y + oldRect.Height + 4);

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

@@ -644,7 +644,7 @@ namespace PDF_Office.ViewModels.Tools
                 {
                     if (obj.Action == "Clear")
                     {
-                        AnnotSignatures.Clear();
+                        viewContentViewModel.AnnotSignatures.Clear();
                     }
                 }
             }

+ 0 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -143,7 +143,6 @@ namespace PDF_Office.ViewModels.Tools
         private AnnotTransfer propertyPanel = new AnnotTransfer();
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
         private Dictionary<string, string> ToolTipDict = new Dictionary<string, string>();
-        private List<Tuple<int, int>> AnnotSignatures = new List<Tuple<int, int>>();
         private StickyNotePopup customStickyPopup;
         string Unicode = "";
 

+ 1 - 1
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -252,7 +252,7 @@ namespace PDF_Office.ViewModels
 
         //若point不赋值或从列表中找不到point,系统会提供默认值为(0,0)的新point,所以改用Tuple<int,int>
         public List<FillAndSignIsShape> FillAndSign = new List<FillAndSignIsShape>();
-
+        public List<Tuple<int, int>> AnnotSignatures = new List<Tuple<int, int>>();
         /// <summary>
         /// 文档的密码
         /// </summary>