Browse Source

ComPDF.Tool(Win)-常规模式下字符在图片上,字符无法选择问题修复

liyijie 2 months ago
parent
commit
7a1c0e5d91
1 changed files with 13 additions and 10 deletions
  1. 13 10
      Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

+ 13 - 10
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

@@ -462,7 +462,7 @@ namespace ComPDFKit.Tool
             }
             else if ((currentModel == ToolType.Pan || currentModel == ToolType.Viewer))
             {
-                if (DrawDownSelectImage(true))
+                if (!IsText() && DrawDownSelectImage(true))
                 {
                     mouseEventObject.hitTestType = MouseHitTestType.ImageSelect;
                 }
@@ -484,7 +484,7 @@ namespace ComPDFKit.Tool
                         if (AnnotSelectGetCount() == 0 && hitWidget != null)
                         {
                             AnnotSelectAddItem(hitWidget.GetAnnotData());
-                            cacheHitTestAnnot=hitWidget;
+                            cacheHitTestAnnot = hitWidget;
                             SelectedAnnot();
                         }
 
@@ -602,7 +602,7 @@ namespace ComPDFKit.Tool
             }
             if (currentModel == ToolType.WidgetEdit)
             {
-                bool areaSelectAdd=AnnotSelectAreaSelect(true);
+                bool areaSelectAdd = AnnotSelectAreaSelect(true);
                 if (AnnotWidgetHitTest())
                 {
                     BaseWidget checkItem = PDFViewer?.AnnotHitTest() as BaseWidget;
@@ -612,7 +612,7 @@ namespace ComPDFKit.Tool
                 {
                     CleanSelectedRect();
                 }
-                if(IsMoved==false && AnnotSelectAreaHitTest()==false && AnnotWidgetHitTest()==false)
+                if (IsMoved == false && AnnotSelectAreaHitTest() == false && AnnotWidgetHitTest() == false)
                 {
                     AnnotSelectClean();
                 }
@@ -639,7 +639,7 @@ namespace ComPDFKit.Tool
                     }
                 }
             }
-          
+
             MouseEventObject mouseEventObject = new MouseEventObject
             {
                 mouseButtonEventArgs = e,
@@ -667,7 +667,7 @@ namespace ComPDFKit.Tool
                 AnnotSelectUpdate();
                 AnnotSelectDraw();
                 AnnotSelectSave();
-                AreaMoveData=new AnnotSelectAreaData();
+                AreaMoveData = new AnnotSelectAreaData();
             }
             IsMoved = false;
         }
@@ -741,7 +741,10 @@ namespace ComPDFKit.Tool
                     caheMoveAnnot = null;
                     if ((currentModel == ToolType.Pan || currentModel == ToolType.Viewer))
                     {
-                        DrawMoveSelectImage();
+                        if (GetTextSelectInfo() == null)
+                        {
+                            DrawMoveSelectImage();
+                        }
                     }
                 }
             }
@@ -784,7 +787,7 @@ namespace ComPDFKit.Tool
                 }
             }
 
-            if(currentModel==ToolType.WidgetEdit)
+            if (currentModel == ToolType.WidgetEdit)
             {
                 AnnotSelectAreaDraw();
                 if (!AnnotSelectMoveDraw())
@@ -792,7 +795,7 @@ namespace ComPDFKit.Tool
                     AnnotSelectAreaHover();
                 }
             }
-           
+
             MouseMoveHandler?.Invoke(this, mouseEventObject);
             PDFViewer.SetCustomMousePoint(Mouse.GetPosition(this).Y, Mouse.GetPosition(this).X);
             if (oldCursor != newCursor)
@@ -948,7 +951,7 @@ namespace ComPDFKit.Tool
                             default:
                                 break;
                         }
-                    } 
+                    }
                 }
             }
             else