Revision: 13930
          http://sourceforge.net/p/skim-app/code/13930
Author:   hofman
Date:     2023-12-19 15:39:53 +0000 (Tue, 19 Dec 2023)
Log Message:
-----------
always add main drag item at first, reuse main drag image for unloaded items

Modified Paths:
--------------
    trunk/SKThumbnailView.m

Modified: trunk/SKThumbnailView.m
===================================================================
--- trunk/SKThumbnailView.m     2023-12-19 15:30:44 UTC (rev 13929)
+++ trunk/SKThumbnailView.m     2023-12-19 15:39:53 UTC (rev 13930)
@@ -448,31 +448,28 @@
             
             NSMutableArray *dragItems = [NSMutableArray array];
             NSDraggingItem *dragItem = [[NSDraggingItem alloc] 
initWithPasteboardWriter:item];
+            NSImage *dragImage = [self draggingImage];
             
-            [dragItem setDraggingFrame:[self draggingFrame] contents:[self 
draggingImage]];
-            if (selectionIndexes == nil) {
-                [dragItems addObject:dragItem];
-            } else {
+            [dragItem setDraggingFrame:[self draggingFrame] 
contents:dragImage];
+            [dragItems addObject:dragItem];
+            if (selectionIndexes) {
                 [selectionIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, 
BOOL *stop){
-                    if (idx == pageIndex) {
-                        [dragItems addObject:dragItem];
+                    if (idx == pageIndex) return;
+                    NSPasteboardItem *dummyItem = [[NSPasteboardItem alloc] 
init];
+                    [dummyItem setData:[NSData data] 
forType:SKPasteboardTypeDummy];
+                    NSDraggingItem *dummyDragItem = [[NSDraggingItem alloc] 
initWithPasteboardWriter:dummyItem];
+                    NSRect rect;
+                    SKThumbnailView *view = (SKThumbnailView 
*)[[collectionView itemAtIndexPath:[NSIndexPath indexPathForItem:idx 
inSection:0]] view];
+                    if (view) {
+                        rect = [self convertRect:[view draggingFrame] 
fromView:view];
                     } else {
-                        NSPasteboardItem *dummyItem = [[NSPasteboardItem 
alloc] init];
-                        [dummyItem setData:[NSData data] 
forType:SKPasteboardTypeDummy];
-                        NSDraggingItem *dummyDragItem = [[NSDraggingItem 
alloc] initWithPasteboardWriter:dummyItem];
-                        NSRect rect;
-                        SKThumbnailView *view = (SKThumbnailView 
*)[[collectionView itemAtIndexPath:[NSIndexPath indexPathForItem:idx 
inSection:0]] view];
-                        if (view) {
-                            rect = [self convertRect:[view draggingFrame] 
fromView:view];
-                        } else {
-                            NSPoint point = [self convertRect:[collectionView 
frameForItemAtIndex:idx] fromView:collectionView].origin;
-                            rect = [self draggingFrame];
-                            rect.origin.x += point.x;
-                            rect.origin.y += point.y;
-                        }
-                        [dummyDragItem setDraggingFrame:rect contents:[view ?: 
self draggingImage]];
-                            [dragItems addObject:dummyDragItem];
+                        NSPoint point = [self convertRect:[collectionView 
frameForItemAtIndex:idx] fromView:collectionView].origin;
+                        rect = [self draggingFrame];
+                        rect.origin.x += point.x;
+                        rect.origin.y += point.y;
                     }
+                    [dummyDragItem setDraggingFrame:rect contents:[view 
draggingImage] ?: dragImage];
+                        [dragItems addObject:dummyDragItem];
                 }];
             }
             

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to