Kaynağa Gözat

Merge branch 'develop' of git.kdan.cc:Mac_PDF/PDF_Office into develop

tangchao 1 yıl önce
ebeveyn
işleme
0c81c1b922

+ 3 - 1
PDF Office/PDF Office/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -205,7 +205,9 @@ NSNotificationName const CPDFListViewActiveAnnotationsChangeNotification = @"CPD
 
 - (void)setAnnotationType:(CAnnotationType)annotationType {
     if (_annotationType != annotationType) {
-        
+        if(CAnnotationTypeLink == annotationType || CAnnotationTypeLink == _annotationType)
+            [self setNeedsDisplayAnnotationViewForVisiblePages];
+
         _annotationType = annotationType;
         
         if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewChangedAnnotationType:forAnnotationType:)])

+ 17 - 3
PDF Office/PDF Office/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -216,7 +216,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
         !self.popOver &&
         newActiveAnnotation.toolTipsString.length > 0 &&
         ([newActiveAnnotation isKindOfClass:[CPDFTextAnnotation class]] || [newActiveAnnotation isKindOfClass:[CPDFLinkAnnotation class]] || [newActiveAnnotation isKindOfClass:[CPDFWidgetAnnotation class]])) {
-        [self performSelector:@selector(showHUDHint:) withObject:newActiveAnnotation afterDelay:1.0];
+        [self performSelector:@selector(showHUDHint:) withObject:newActiveAnnotation afterDelay:0.3];
     } else if ([self isSupportSelectAnnotation] && newActiveAnnotation && [newActiveAnnotation isKindOfClass:[CPDFRedactAnnotation class]] && (self.hoverAnnotation == newActiveAnnotation)) {
         [(CPDFRedactAnnotation *)newActiveAnnotation setDrawRedactionsAsRedacted:YES];
         [self setNeedsDisplayAnnotationViewForPage:page];
@@ -1965,7 +1965,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                 } else {
                     CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc]initWithAnnotationType:self.annotationType];
                     CGRect bounds = CGRectZero;
-                    CGFloat defaultWidth = annotationModel.noteWidth;
+                    CGFloat defaultWidth = annotation.bounds.size.width;
                     CGFloat defaultHeight = annotationModel.noteHeight;
                     NSSize defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultWidth, defaultHeight) : NSMakeSize(defaultHeight, defaultWidth);
 
@@ -3012,8 +3012,15 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
         }
         
         if (self.aCopyAnnotations.count > 0 ) {
+            CPDFAnnotation * an  = self.aCopyAnnotations.firstObject;
+            CGRect selectAnnotationBounds = an.bounds;
+            for (CPDFAnnotation *annotation in self.aCopyAnnotations) {
+                selectAnnotationBounds = CPDFListViewIntersectionAndSetRect(annotation.bounds, selectAnnotationBounds);
+            }
+            
             for (CPDFAnnotation * an in self.aCopyAnnotations) {
-                NSRect bounds = CGRectMake(pagePoint.x, pagePoint.y-[an bounds].size.height, [an bounds].size.width,  [an bounds].size.height);
+                CGPoint point = CPDFListViewSubstractPoints(an.bounds.origin, selectAnnotationBounds.origin);
+                NSRect bounds = CGRectMake(pagePoint.x + point.x, pagePoint.y-[an bounds].size.height+point.y, [an bounds].size.width,  [an bounds].size.height);
                 bounds = CPDFListViewConstrainRect(bounds, [page boundsForBox:[self displayBox]],[CPDFListViewConfig defaultManager].annotationBorderOffset.floatValue);
                 CGSize pageSize = [page boundsForBox:CPDFDisplayCropBox].size;
                 
@@ -3348,6 +3355,13 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                 break;
          
         }
+        
+        if ([self.activeAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
+            CPDFFreeTextAnnotation *freeTextAnnotation  = self.activeAnnotation;
+            if([self isEditWithCurrentFreeText:freeTextAnnotation])
+                [self commitEditAnnotationFreeText:freeTextAnnotation];
+        }
+        
         CPDFAnnotationModel *annotationModel = [[CPDFAnnotationModel alloc] initWithPDFAnnotations:self.activeAnnotations];
         annotationModel.fontName = fontName;
         [self setNeedsDisplayAnnotation:self.activeAnnotation];

+ 5 - 0
PDF Office/PDF Office/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+UndoManager.m

@@ -127,6 +127,11 @@ static NSString *CPDFListViewAnnotationPropertiesObservationContext = @"CPDFList
         if ([self.notes containsObject:annotation]) {
             [self.notes removeObject:annotation];
         }
+        
+        if([self.activeAnnotations containsObject:annotation]) {
+            [self removeActiveAnnotations:@[annotation]];
+            [self setNeedsDisplayAnnotationViewForPage:annotation.page];
+        }
     }
 }
 

+ 2 - 1
PDF Office/PDF Office/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -695,7 +695,8 @@ extension KMMainViewController {
         
     @objc func exportCorpImage(sender:NSMenuItem) {
         let rect = NSIntegralRect(listView.currentSelectionRect())
-        let page : CPDFPage = listView.currentSelectionPage() ?? listView.currentPage()
+        let orgPage : CPDFPage = listView.currentSelectionPage() ?? listView.currentPage()
+        let page : CPDFPage = orgPage.copy() as! CPDFPage
         page.setBounds(rect, for: .cropBox)
         let image = page.thumbnail(of: rect.size) ?? NSImage()
         let data = image.tiffRepresentation