Ver código fonte

【测量】补充在测量模式下ESC关闭弹窗

wanjun 6 meses atrás
pai
commit
65dd4e7f5f

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -346,4 +346,6 @@ enum {
 
 - (void)PDFListViewAnnotationMeasureInfoChange:(CPDFListView *)pdfListView withAnnotation:(CPDFAnnotation *)annotation;
 
+- (void)PDFListViewMeasureCancel:(CPDFListView *)pdfListView;
+
 @end

+ 4 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+KeyEvent.m

@@ -163,6 +163,10 @@
             newOrigin.x = self.documentView.documentView.frame.size.width;
         }
         [self.documentView.documentView scrollPoint:newOrigin];
+    } else if(theEvent.keyCode == 53) {
+        if (self.pdfListViewDelegate && [self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMeasureCancel:)]) {
+            [self.pdfListViewDelegate PDFListViewMeasureCancel:self];
+        }
     }
 }
 

+ 5 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -1447,6 +1447,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
 //            self.rightSideViewController.view.isHidden = true
             self.rightSideViewController.isHidden = true
             self.closeRightPane()
+            cancelMeasureType()
         }
         let aType = annotationType
         if aType.isMarkup() || aType == .anchored || aType == .freeText || aType.isSquare() || aType == .link {
@@ -1895,6 +1896,10 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
             handlePolygonAnnotation(polygonAnnotation)
         }
     }
+    
+    func pdfListViewMeasureCancel(_ pdfListView: CPDFListView!) {
+        cancelMeasureType()
+    }
       
       private func handleLineAnnotation(_ annotation: CPDFLineAnnotation) {
           if perimeterMeasureInfoWindowController?.window?.isVisible == true {