Browse Source

ComPDFKit.Tool(Win) - 修复文字选择时若鼠标拖到页面范围外松开会将前面所有页面文字选中

liyuxuan 2 months ago
parent
commit
07e039d564
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.SelectText.cs

+ 4 - 1
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.SelectText.cs

@@ -51,7 +51,10 @@ namespace ComPDFKit.Tool
             }
             BaseLayer baseLayer = PDFViewer.GetViewForTag(selectTextTag);
             PDFViewer.GetMousePointToPage(out int pageindex, out Point pagepoint);
-            (baseLayer as SelectText).MoveDraw(new Point(DpiHelper.StandardNumToPDFNum(pagepoint.X / PDFViewer.CurrentRenderFrame.ZoomFactor), DpiHelper.StandardNumToPDFNum(pagepoint.Y / PDFViewer.CurrentRenderFrame.ZoomFactor)), pageindex, PDFViewer, new Point(10, 10), DoubleClick);
+            if(pageindex>=0)
+            {
+                (baseLayer as SelectText).MoveDraw(new Point(DpiHelper.StandardNumToPDFNum(pagepoint.X / PDFViewer.CurrentRenderFrame.ZoomFactor), DpiHelper.StandardNumToPDFNum(pagepoint.Y / PDFViewer.CurrentRenderFrame.ZoomFactor)), pageindex, PDFViewer, new Point(10, 10), DoubleClick);
+            }
         }
 
         public void DrawEndSelectText()