瀏覽代碼

【链接注释】- 输入目标预览图与GO按钮时时刷新

liaoxiaoyue 1 年之前
父節點
當前提交
122895fa27

+ 15 - 12
PDF Office/PDF Office/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationLinkViewController.m

@@ -432,16 +432,7 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
                 }
                 return;
             }
-            NSUInteger dexPage = [self.inputUrlTextField.stringValue integerValue];
-            if ((dexPage >0 || dexPage < _pageCount) && _pageRecord.length > 0) {
-                self.pageImageThumible.hidden = NO;
-                self.goButton.hidden = NO;
-                NSInteger goPage = [self.inputUrlTextField.stringValue integerValue] - 1;
-                CPDFPage *page = [_pdfview.document pageAtIndex:goPage];
-                self.pageImageThumible.image = [page thumbnailOfSize:[page boundsForBox:CPDFDisplayMediaBox].size];
-            } else {
-                [_pdfview setIsSetLinkDestinationArea:YES];
-            }
+            [_pdfview setIsSetLinkDestinationArea:YES];
         }
             break;
         case KMAnnotationLinkType_URL:
@@ -513,6 +504,18 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
 
         [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
         [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
+        
+        ///显示预览图
+        if ((dexPage >0 || dexPage < _pageCount) && _pageRecord.length > 0) {
+            self.pageImageThumible.hidden = NO;
+            self.goButton.hidden = NO;
+            NSInteger goPage = [self.inputUrlTextField.stringValue integerValue] - 1;
+            CPDFPage *page = [_pdfview.document pageAtIndex:goPage];
+            self.pageImageThumible.image = [page thumbnailOfSize:[page boundsForBox:CPDFDisplayMediaBox].size];
+        } else {
+            self.pageImageThumible.hidden = YES;
+            self.goButton.hidden = YES;
+        }
     } else if (_linkType == KMAnnotationLinkType_URL) {
         [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
 //        NSString *linkUrlPath = [self judgeWebURL:_urlRecord];
@@ -546,7 +549,7 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
 //                self.errorLabel.hidden = YES;
 //                NSInteger goPage = [self.inputUrlTextField.stringValue integerValue];
 //                CPDFDestination *destination = [[CPDFDestination alloc] initWithDocument:_pdfview.document pageIndex:(goPage-1)];
-//                
+//
 //                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:destination];
 //                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
 //            }
@@ -559,7 +562,7 @@ typedef NS_ENUM(NSUInteger, KMAnnotationLinkType) {
 //                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setDestination:nil];
 //
 //                NSString *linkUrlPath = [self judgeWebURL:self.urlRecord];
-//                
+//
 //                [(CPDFLinkAnnotation *)_pdfview.activeAnnotation setURL:linkUrlPath];
 //                [_pdfview setNeedsDisplayAnnotationViewForPage:_pdfview.activeAnnotation.page];
 //                self.goButton.hidden = NO;