Explorar o código

修复bug - 橡皮擦快捷键,手型工具默认不选中,创建超链接

chenrongqian@kdanmobile.com hai 1 ano
pai
achega
7d45f3578c

+ 26 - 20
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -148,7 +148,6 @@ namespace PDF_Master.ViewModels.Tools
                             Point pagePoint = new Point(0, 0);
                             //Todo:等黎总需要更新ComPDFKit.dll
                             //PDFViewer.ConvertViewPointToPage(point, out pageIndex, out pagePoint);
-
                             if (pagePoint.X >= rect.Left  && pagePoint.X <= rect.Right  && pagePoint.Y >= rect.Top  && pagePoint.Y <= rect.Bottom)
                                 PopAnnotNoteText(CurrentSelectedAnnot);
 
@@ -349,6 +348,7 @@ namespace PDF_Master.ViewModels.Tools
         {
             if (e != null)
             {
+               
                 CurrentSelectedAnnot = null;
                 var annot = e.AnnotItemsList[0];
                 if (annot != null)
@@ -1216,25 +1216,7 @@ namespace PDF_Master.ViewModels.Tools
                                         BtnMyTools_Click(btn);
                                         break;
                                     }
-                                    EraseArgs eraseArgs = new EraseArgs();
-                                    eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
-                                    eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
-                                    eraseArgs.Thickness = 10;
-                                    DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotErase);
-                                    if (annotProperty != null)
-                                    {
-                                        eraseArgs.Thickness = annotProperty.Thickness;
-                                    }
-
-                                    PDFViewer.ClearSelectAnnots(false);
-                                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                                    PDFViewer.SetToolParam(eraseArgs);
-
-                                    List<AnnotHandlerEventArgs> eraseArgsList = new List<AnnotHandlerEventArgs>();
-                                    if (eraseArgs != null)
-                                        eraseArgsList.Add(eraseArgs);
-
-                                    AddToPropertyPanel("FreehandAnnotProperty", "Freehand", eraseArgsList);
+                                    CreateEraseArgs();
                                 }
                             }
                             break;
@@ -1255,6 +1237,30 @@ namespace PDF_Master.ViewModels.Tools
             }
         }
 
+
+        private void CreateEraseArgs()
+        {
+            EraseArgs eraseArgs = new EraseArgs();
+            eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
+            eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
+            eraseArgs.Thickness = 10;
+            DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotErase);
+            if (annotProperty != null)
+            {
+                eraseArgs.Thickness = annotProperty.Thickness;
+            }
+
+            PDFViewer.ClearSelectAnnots(false);
+            PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+            PDFViewer.SetToolParam(eraseArgs);
+
+            List<AnnotHandlerEventArgs> eraseArgsList = new List<AnnotHandlerEventArgs>();
+            if (eraseArgs != null)
+                eraseArgsList.Add(eraseArgs);
+
+            AddToPropertyPanel("FreehandAnnotProperty", "Freehand", eraseArgsList);
+        }
+
         #endregion BindingEvent事件
     }
 }

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

@@ -347,6 +347,7 @@ namespace PDF_Master.ViewModels.Tools
                 {
                     selectedArgs = new List<AnnotHandlerEventArgs>();
                     selectedArgs.Add(linkArgs);
+                    CreateAnnotFromSelectPageText(linkArgs);
                 }
             }
             AddToPropertyPanel("LinkAnnotProperty", "Link", selectedArgs, annotAttribEvent);

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

@@ -1557,6 +1557,13 @@ namespace PDF_Master.ViewModels.Tools
                 if (tuple.Item1 == Key.L)
                     BtnLinkIsChecked = false;
 
+                if(tuple.Item2 == "Eraser")
+                {
+                    CreateEraseArgs();
+                    StrAnnotToolChecked = "Freehand";
+                    return;
+                }
+
                 AnnotHandlerEventArgs annotArgs = null;
                 StrAnnotToolChecked = tuple.Item2;
                 FindAnnotTypeKey(tuple.Item2, ref annotArgs);
@@ -1632,6 +1639,8 @@ namespace PDF_Master.ViewModels.Tools
                     tag = "Arrow";
                 else if (AnnotToolDir[Key.L])
                     tag = "Line";
+                else if(AnnotToolDir[Key.E])
+                    tag = "Eraser";
             }
 
             if (tag == "")
@@ -1668,7 +1677,10 @@ namespace PDF_Master.ViewModels.Tools
             BindingPDFViewerHandler();
             BindingEvent();
             LoaedStickyNotePopup();
-            BtnHandIsChecked = (PDFViewer.MouseMode == MouseModes.Scroll ? true : false);
+            //获取当前是否为滚动状态
+            // BtnHandIsChecked = (PDFViewer.MouseMode == MouseModes.Scroll ? true : false);
+            BtnHandIsChecked = false;
+            HandToolIsCheckedEvent(false);
         }
 
         #endregion Navigation