Browse Source

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

TangJinZhou 1 week ago
parent
commit
495cb2330e
1 changed files with 8 additions and 18 deletions
  1. 8 18
      Demo/Examples/ComPDFKit.Tool/CPDFViewerTool.xaml.cs

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

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