Browse Source

[图片] - 上下最上、最下层移动

liujiajie 11 months ago
parent
commit
bffe899c73

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

@@ -4225,7 +4225,7 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     NSDictionary *dict = sender.representedObject;
     CPDFPage *page = dict[@"page"];
     CPDFAnnotation *annotation = dict[@"annotation"];
-    [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 1];
+    [self moveAnnotationOnPage:page annotation:annotation newIndex:[page.annotations indexOfObject:annotation] + 2];
 }
 
 - (IBAction)menuItemClick_SendBackward:(NSMenuItem *)sender {

+ 12 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Tool.m

@@ -539,8 +539,18 @@
     }
     
     [[[self undoManager] prepareWithInvocationTarget:self] moveAnnotationOnPage:aPage annotation:anAnnotation newIndex:originalIndex];
-    [aPage moveHierarchyWithAnnotation:anAnnotation atIndex:newIndex];
-    [self setNeedsDisplayAnnotationViewForVisiblePages];
+//    [aPage moveHierarchyWithAnnotation:anAnnotation atIndex:newIndex];
+//    [self setNeedsDisplayAnnotationViewForVisiblePages];
+    NSMutableArray *newAddArray = [NSMutableArray arrayWithArray:aPage.annotations];
+    for (CPDFAnnotation *anno in newAddArray) {
+        [aPage removeAnnotation:anno];
+    }
+    [newAddArray removeObject:anAnnotation];
+    [newAddArray insertObject:anAnnotation atIndex:newIndex];
+    for (NSUInteger i = 0; i < newAddArray.count; i++) {
+        [aPage addAnnotation:newAddArray[i]];
+    }
+    [self setNeedsDisplay:YES];
 }
 
 - (void)showHUDHint:(CPDFAnnotation *)newActiveAnnotation {