Quellcode durchsuchen

ComPDFKit.Tool(Win) - 表单多选移动框选调整

liyuxuan vor 2 Monaten
Ursprung
Commit
8ac90a1121

+ 4 - 3
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.AnnotSelector.cs

@@ -190,16 +190,16 @@ namespace ComPDFKit.Tool
             drawDC.Close();
         }
 
-        private void AnnotSelectAreaSelect(bool onlyWidget=false,bool onlyAnnot = false)
+        private bool AnnotSelectAreaSelect(bool onlyWidget=false,bool onlyAnnot = false)
         {
             if (!AllowMultiSelect)
             {
-                return;
+                return false;
             }
 
             if (AreaDrawData.HitPageIndex < 0 || PDFViewer == null || Selector == null)
             {
-                return;
+                return false;
             }
 
             PDFViewer.CanHorizontallyScroll = true;
@@ -233,6 +233,7 @@ namespace ComPDFKit.Tool
 
                 Selector.Draw();
             }
+            return true;
         }
 
         private BaseAnnot AnnotSelectGetAnnot()

+ 6 - 2
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

@@ -602,7 +602,7 @@ namespace ComPDFKit.Tool
             }
             if (currentModel == ToolType.WidgetEdit)
             {
-                AnnotSelectAreaSelect(true);
+                bool areaSelectAdd=AnnotSelectAreaSelect(true);
                 if (AnnotWidgetHitTest())
                 {
                     BaseWidget checkItem = PDFViewer?.AnnotHitTest() as BaseWidget;
@@ -612,6 +612,10 @@ namespace ComPDFKit.Tool
                 {
                     CleanSelectedRect();
                 }
+                if(IsMoved==false && AnnotSelectAreaHitTest()==false && AnnotWidgetHitTest()==false)
+                {
+                    AnnotSelectClean();
+                }
                 if (AnnotSelectGetCount() == 1)
                 {
                     cacheHitTestAnnot = AnnotSelectGetAnnot();
@@ -621,7 +625,7 @@ namespace ComPDFKit.Tool
                         SelectedRect selectedRect = CommonHelper.FindVisualChild<SelectedRect>(baseLayer as CustomizeLayer);
                         if (selectedRect != null)
                         {
-                            if (IsMoved)
+                            if (IsMoved && areaSelectAdd == false)
                             {
                                 selectedRect.UpdateAnnotData(cacheHitTestAnnot.GetAnnotData());
                             }

+ 1 - 1
Demo/Examples/ComPDFKit.Tool/DrawTool/AnnotSelector.cs

@@ -21,7 +21,7 @@ namespace ComPDFKit.Tool.DrawTool
         private double RectPadding = 4;
         public AnnotSelector()
         {
-            DrawPen = new Pen(new SolidColorBrush(Color.FromRgb(119, 180, 227)), 2);
+            DrawPen = new Pen(new SolidColorBrush(Color.FromArgb(255, 71, 126, 222)), 2);
             DrawBrush = new SolidColorBrush(Color.FromArgb(40, 119, 180, 227));
         }
         public override void Draw()