Browse Source

注释-优化联动,修改后的问题

OYXH\oyxh 1 year ago
parent
commit
47218a7940

+ 8 - 5
PDF Office/ViewModels/PropertyPanel/AnnotPanel/TextAnnotPropertyViewModel.cs

@@ -107,7 +107,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
         public AnnotAttribEvent AnnotEvent { get; set; }
         private AnnotHandlerEventArgs Annot;
-        private AnnotTransfer PropertyPanel;
+        public AnnotTransfer PropertyPanel;
         public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
         public DelegateCommand<object> SelectedOpacityChangedCommand { get; set; }
         public DelegateCommand<object> DefaultColorChangedCommand { get; set; }
@@ -316,7 +316,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     case AnnotArgsType.AnnotHighlight:
                         if (Annot is TextHighlightAnnotArgs)
                         {
-                            
+
                             var Hightlight = Annot as TextHighlightAnnotArgs;
                             if (ViewContentViewModel.IsSettingOut)
                             {
@@ -333,8 +333,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         {
                             var Underline = Annot as TextUnderlineAnnotArgs;
                             if (ViewContentViewModel.IsSettingOut)
-                            { UnderlineDefaultColor = new SolidColorBrush(Underline.Color); 
-                                ViewContentViewModel.IsSettingOut = false; }
+                            {
+                                UnderlineDefaultColor = new SolidColorBrush(Underline.Color);
+                                ViewContentViewModel.IsSettingOut = false;
+                            }
                             TextDefaultColor = UnderlineDefaultColor;
                             BasicVm.FillOpacity = Underline.Transparency;
                             BasicVm.FontColor = new SolidColorBrush(Underline.Color);
@@ -345,7 +347,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         {
                             var Strikeout = Annot as TextStrikeoutAnnotArgs;
                             if (ViewContentViewModel.IsSettingOut)
-                            { StrikeoutDefaultColor = new SolidColorBrush(Strikeout.Color);
+                            {
+                                StrikeoutDefaultColor = new SolidColorBrush(Strikeout.Color);
                                 ViewContentViewModel.IsSettingOut = false;
                             }
                             TextDefaultColor = StrikeoutDefaultColor;

+ 41 - 7
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -5,16 +5,19 @@ using ComPDFKit.PDFDocument.Action;
 using ComPDFKitViewer;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using ImTools;
 using PDF_Master.CustomControl;
 using PDF_Master.EventAggregators;
 using PDF_Master.Helper;
 using PDF_Master.Model.AnnotPanel;
+using PDF_Master.Model.BOTA;
 using PDF_Master.Model.FillAndSign;
 using PDF_Master.Properties;
 using PDF_Master.ViewModels.BOTA;
 using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
 using PDF_Master.ViewModels.Tools.AnnotManager;
 using PDF_Master.Views.BOTA;
+using PDF_Master.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -454,22 +457,50 @@ namespace PDF_Master.ViewModels.Tools
                     {
                         case "HighLight"://字体高亮
                             CleanPropertyPanel();
-                            GetHighLight();
+                            if (selectedAnnotation != null)
+                            {
+                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotHighlight)
+                                {
+                                    GetHighLight();
+                                }
+                            }
+                            else
+                            {
+                                GetHighLight();
+                            }
+
                             break;
 
                         case "UnderLine"://下划线
                             CleanPropertyPanel();
-                            GetUnderLine();
-                            break;
-
-                        case "Squiggly"://波浪线
                             CleanPropertyPanel();
-                            GetSquiggly();
+                            if (selectedAnnotation != null)
+                            {
+                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotUnderline)
+                                {
+                                    GetUnderLine();
+                                }
+                            }
+                            else
+                            {
+                                GetUnderLine();
+                            }
                             break;
 
                         case "Strikeout"://删除线
                             CleanPropertyPanel();
-                            GetStrikeout();
+
+                            if (selectedAnnotation != null)
+                            {
+                                if (selectedAnnotation.EventType == AnnotArgsType.AnnotStrikeout)
+                                {
+                                    GetStrikeout();
+                                }
+                            }
+                            else
+                            {
+                                GetStrikeout();
+                            }
                             break;
                     }
 
@@ -726,6 +757,8 @@ namespace PDF_Master.ViewModels.Tools
             PropertyPanel.annotlists = null;
         }
 
+
+
         /// <summary>
         /// 注释列表同步选中
         /// </summary>
@@ -753,6 +786,7 @@ namespace PDF_Master.ViewModels.Tools
 
                 if (viewModel != null)
                 {
+                    selectedAnnotation = viewModel.AnnotationListItems.FindFirst(a => a.PageIndex == pageindex[0] && a.AnnotIndex == annoteindex);
                     viewModel.ScrollToAnnot(pageindex[0], annoteindex, annotation.AnnotationList);
                 }
             }

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

@@ -242,11 +242,13 @@ namespace PDF_Master.ViewModels.Tools
         private string Unicode = "";
 
         //private bool isHiddenAnnot = true;
-        private bool isAddBookMark = true;
+        private bool isAddBookMark = true;
+
         /// <summary>
         /// 空白处-右键菜单-添加注释
         /// </summary>
         private bool IsNoSelectMenu = false;
+
         private bool isRightMenuAddAnnot = false;
 
         private PopMenu HightAnnotPopMenu;
@@ -307,6 +309,11 @@ namespace PDF_Master.ViewModels.Tools
         #endregion 注释 - 右键菜单
 
         #endregion 事件
+
+        /// <summary>
+        /// 注释列表选中注释
+        /// </summary>
+        private Model.BOTA.AnnotationHandlerEventArgs selectedAnnotation = null;
     }
 
     public enum AddAnnotType