Browse Source

【Form表单】Form表单添加控制区域范围,

niehaoyu 8 months ago
parent
commit
c4a0c968af

+ 6 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -3643,6 +3643,12 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                     defaultSize = CGSizeMake(130, 40);
                 }
                 defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultSize.width, defaultSize.height) : NSMakeSize(defaultSize.height, defaultSize.width);
+                if (defaultSize.width/2.0 + pagePoint.x > page.bounds.size.width) {
+                    pagePoint.x = page.bounds.size.width - defaultSize.width/2.0 - 10;
+                }
+                if (defaultSize.height/2.0 + pagePoint.y > page.bounds.size.height) {
+                    pagePoint.y = page.bounds.size.height - defaultSize.height/2.0 - 10;
+                }
                 
                 annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSize(NSMakePoint(round(pagePoint.x), round(pagePoint.y)), defaultSize)];
                 [self showEditableFormAnnotationEditor:annotation];

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

@@ -103,6 +103,7 @@ static NSString *CPDFListViewAnnotationPropertiesObservationContext = @"CPDFList
             if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewAnnotationAttributeHasChange:withAnnotation:)])
                 [self.pdfListViewDelegate PDFListViewAnnotationAttributeHasChange:self withAnnotation:note];
             
+            [self.window makeFirstResponder:nil];
             dispatch_async(dispatch_get_main_queue(), ^{
                 [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewAnnotationsAttributeHasChangeNotification object:@{@"keyPath": keyPath, @"object": note}];
             });

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -490,6 +490,7 @@ let KMColorPickerViewHeight: CGFloat = 64
         opacityComboBox.stringValue = "\(Int(opacity * 100))%"
         
         if annotationModel?.annotations != nil {
+            noteTextView.string = ""
             let contextString = annotation.string() ?? ""
             noteTextView.string = contextString
             noteTextView.textColor = NSColor.labelColor