Browse Source

填写签名-多选移动无效

liyijie 1 year ago
parent
commit
9172968010

+ 36 - 20
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -1543,13 +1543,13 @@ namespace PDF_Master.ViewModels.FillAndSign
 
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
-            bool IsSign = false;
+            bool IsAdd = false;
             if (e != null && e.Count > 0)
             {
                 int i = 0;
                 Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
 
-                for ( i = 0; i < e.Count; i++)
+                for (i = 0; i < e.Count; i++)
                 {
                     AnnotEditEvent editEvent = e[i];
                     int pageindex = editEvent.PageIndex;
@@ -1558,17 +1558,17 @@ namespace PDF_Master.ViewModels.FillAndSign
                     {
                         case ActionType.Add:
 
-                           
-                                if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
-                                {
-                                    selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
-                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
-                                }
-                                else
-                                {
-                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
-                                }
-                            
+                            IsAdd = true;
+                            if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
+                            {
+                                selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
+                                selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            }
+                            else
+                            {
+                                selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            }
+
                             //if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand)
                             //{
                             //    //if (IsSelectShape)
@@ -1603,9 +1603,10 @@ namespace PDF_Master.ViewModels.FillAndSign
                                         PDFViewer.SelectAnnotation(pageindex, annotindex);
                                     }
                                 }
-                               
+
                             }
-                            if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand&&i==0) {
+                            if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand && i == 0)
+                            {
                                 PDFViewer.SelectAnnotation(pageindex, annotindex);
                             }
                             //else
@@ -1627,7 +1628,7 @@ namespace PDF_Master.ViewModels.FillAndSign
                             break;
                     }
                 }
-                if (i>1)
+                if (i > 1 && IsAdd)
                 {
                     PDFViewer.SelectAnnotation(selectAnnotDicts);
                 }
@@ -1807,7 +1808,7 @@ namespace PDF_Master.ViewModels.FillAndSign
 
             }
         }
-        private void ShowPropertyPanel(bool show = true)
+        public void ShowPropertyPanel(bool show = true)
         {
             viewContentViewModel.IsPropertyOpen = show;
         }
@@ -1859,7 +1860,20 @@ namespace PDF_Master.ViewModels.FillAndSign
         //        IsCopyShape = false;
         //    }
         //}
-
+        public void ExitAnnotationTool()
+        {
+            PDFViewer.DisableClearSelectAnnot(false);
+            PDFViewer.ClearSelectAnnots();
+            PDFViewer.SetMouseMode(MouseModes.PanTool);
+            if (PDFViewer.MouseMode != MouseModes.AnnotCreate)
+            {
+                PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                var annotArgs = new SelectToolArgs();
+                PDFViewer.SetToolParam(annotArgs);
+            }
+            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+            ShowPropertyPanel(false);
+        }
         #region Navigation
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -1880,14 +1894,16 @@ namespace PDF_Master.ViewModels.FillAndSign
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            
             IsFillAndSign = true;
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             BindingPDFViewerHandler();
+            ExitAnnotationTool();
             HookShapeIsCheck = true;
             HookShapeIsCheck = false;
-            ShowPropertyPanel(false);
-            PDFViewer.SetMouseMode(MouseModes.PanTool);
+            //ShowPropertyPanel(false);
+            //PDFViewer.SetMouseMode(MouseModes.PanTool);
             // InitCheckedEvent("RbtnTick");
             IsEdit = false;
 

+ 9 - 2
PDF Office/Views/FillAndSign/FillAndSignContent.xaml.cs

@@ -1,4 +1,6 @@
-using ComPDFKitViewer.PdfViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Master.ViewModels;
 using PDF_Master.ViewModels.Dialog.ConverterDialogs;
 using PDF_Master.ViewModels.FillAndSign;
 using System;
@@ -35,10 +37,15 @@ namespace PDF_Master.Views.FillAndSign
             if (a.IsChecked == true)
             {
                 a.IsChecked = false;
-                ((FillAndSignContentViewModel)this.DataContext).PDFViewer.SetMouseMode(MouseModes.PanTool);
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.DisableClearSelectAnnot(false);
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.ClearSelectAnnots();
+                ((FillAndSignContentViewModel)this.DataContext).ExitAnnotationTool();
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.SetMouseMode(MouseModes.PanTool);
+
                 e.Handled = true;
             }
             else { a.IsChecked = true; }
         }
+        
     }
 }

+ 1 - 3
PDF Office/Views/FillAndSign/PropertyPanel/ShapFillProperty.xaml

@@ -75,9 +75,7 @@
                     <RowDefinition />
                 </Grid.RowDefinitions>
                 <TextBlock Text="Color" VerticalAlignment="Center" Margin="0,0,0,12"/>
-                <CompositeControl:SlidContent x:Name="layerThick"  HorizontalAlignment="Right" 
-                                              
-                                              >
+                <CompositeControl:SlidContent x:Name="layerThick"  HorizontalAlignment="Right" InitValue="{Binding FillOpacity, Mode=OneWay}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedValueChanged">
                             <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick,Path=Value}"/>