Procházet zdrojové kódy

ComPDFKit.Tool(win) - 优化CPDFViewer的IsRendering状态判断

TangJinZhou před 1 týdnem
rodič
revize
495cb2330e

+ 8 - 18
Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

@@ -14,7 +14,6 @@ using ComPDFKitViewer.Widget;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
@@ -320,10 +319,6 @@ namespace ComPDFKit.Tool
 
         protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
         {
-            if (PDFViewer.IsRendering)
-            {
-                return;
-            }
             if (isContinueCreateTextEdit)
             {
                 if (lastSelectedRect != null)
@@ -336,7 +331,7 @@ namespace ComPDFKit.Tool
                 }
             }
 
-            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null)
+            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null || PDFViewer.IsRendering)
             {
                 return;
             }
@@ -583,12 +578,7 @@ namespace ComPDFKit.Tool
 
         protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
         {
-            if (!PDFViewer.IsRendering)
-            {
-               // return;
-            }
-
-            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null)
+            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null || PDFViewer.IsRendering)
             {
                 return;
             }
@@ -622,12 +612,7 @@ namespace ComPDFKit.Tool
 
         protected override async void OnMouseMove(MouseEventArgs e)
         { 
-
-            if (PDFViewer.IsRendering)
-            {
-                return; 
-            }
-            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null)
+            if (PDFViewer == null || PDFViewer.CurrentRenderFrame == null || PDFViewer.IsRendering)
             {
                 return;
             }
@@ -745,6 +730,11 @@ namespace ComPDFKit.Tool
 
         protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
         {
+            if(PDFViewer.IsRendering)
+            {
+                return;
+            }
+
             MouseEventObject mouseEventObject = new MouseEventObject
             {
                 mouseButtonEventArgs = e,