Browse Source

【注释】修复多选注释右键菜单错误

wanjun 9 months ago
parent
commit
6fd1224dd3

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

@@ -460,6 +460,21 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
         return nil;
     }
+    if([self.activeAnnotations count] > 1) {
+        NSMenu *menu = [[NSMenu alloc] init];
+        
+        [menu removeAllItems];
+        NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
+        [menu insertItem:deleteItem atIndex:0];
+        
+        NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:@selector(cut:) keyEquivalent:@"x"];
+        [menu insertItem:cutItem atIndex:0];
+
+        NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
+        [menu insertItem:copyItem atIndex:0];
+        return menu;
+    }
+
     NSMenu *menu = [super menuForEvent:event];
     if(!menu)
         menu = [[NSMenu alloc] init];