瀏覽代碼

注释 - 修复右键菜单添加注释,超出页面范围时,改变注释范围

wanjun 1 年之前
父節點
當前提交
8771d9f324
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

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

@@ -42,6 +42,7 @@
 #import "CPDFChoiceWidgetAnnotation+PDFListView.h"
 #import "CPDFLineAnnotation+PDFListView.h"
 #import "NSPopover+PDFListView.h"
+#import "NSGeometry_SKExtensions.h"
 
 NSNotificationName const CPDFListViewSelectionChangedNotification = @"CPDFListViewSelectionChangedNotification";
 
@@ -305,6 +306,9 @@ NSNotificationName const CPDFListViewAnnotationsAttributeHasChangeNotification =
 
         if(annotationType == CAnnotationTypeAnchored)
             bounds = CGRectMake(bounds.origin.x, bounds.origin.y, size.width, size.height);
+        if (annotationType == CAnnotationTypeCircle || annotationType == CAnnotationTypeSquare || annotationType == CAnnotationTypeLine || annotationType == CAnnotationTypeArrow || annotationType == CAnnotationTypeAnchored) {
+            bounds = KMConstrainRect(bounds, [page boundsForBox:[self displayBox]]);
+        }
         
         if (isInitial)
             bounds = annotationType == CAnnotationTypeAnchored ? CPDFListViewRectFromCenterAndSize(bounds.origin, size) : CPDFListViewRectFromCenterAndSquareSize(bounds.origin, MIN_NOTE_SIZE);