浏览代码

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

TangJinZhou 1 周之前
父节点
当前提交
495cb2330e
共有 1 个文件被更改,包括 8 次插入18 次删除
  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.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,