Revision: 13940
http://sourceforge.net/p/skim-app/code/13940
Author: hofman
Date: 2023-12-20 14:57:16 +0000 (Wed, 20 Dec 2023)
Log Message:
-----------
don't set empty drag image, check dragging item to see whether it has a darg
image
Modified Paths:
--------------
trunk/SKThumbnailView.m
Modified: trunk/SKThumbnailView.m
===================================================================
--- trunk/SKThumbnailView.m 2023-12-20 10:41:24 UTC (rev 13939)
+++ trunk/SKThumbnailView.m 2023-12-20 14:57:16 UTC (rev 13940)
@@ -423,6 +423,8 @@
#pragma mark Event handling
- (NSImage *)draggingImage {
+ if ([imageView image] == nil)
+ return nil;
NSRect rect = [imageView bounds];
NSImage *dragImage = [[NSImage alloc] initWithSize:rect.size];
[dragImage addRepresentation:[imageView
bitmapImageRepCachingDisplayInRect:rect]];
@@ -448,13 +450,17 @@
NSMutableArray *dragItems = [NSMutableArray array];
NSDraggingItem *dragItem = [[NSDraggingItem alloc]
initWithPasteboardWriter:item];
- __block BOOL selectLeaderIndex = NO;
+ NSImage *dragImage = [self draggingImage];
- [dragItem setDraggingFrame:[self draggingFrame] contents:[self
draggingImage]];
+ if (dragImage == nil) {
+ [imageView setImage:[thumbnail image]];
+ dragImage = [self draggingImage];
+ }
+
+ [dragItem setDraggingFrame:[self draggingFrame]
contents:dragImage];
if (selectionIndexes == nil) {
[dragItems addObject:dragItem];
} else {
- NSUInteger firstIndex = [selectionIndexes firstIndex];
[selectionIndexes enumerateIndexesUsingBlock:^(NSUInteger idx,
BOOL *stop){
if (idx == pageIndex) {
[dragItems addObject:dragItem];
@@ -464,22 +470,18 @@
NSDraggingItem *dummyDragItem = [[NSDraggingItem
alloc] initWithPasteboardWriter:dummyItem];
NSRect rect;
SKThumbnailView *view = (SKThumbnailView
*)[[collectionView itemAtIndexPath:[NSIndexPath indexPathForItem:idx
inSection:0]] view];
- if (view) {
+ if (view)
rect = [self convertRect:[view draggingFrame]
fromView:view];
- if (idx == firstIndex)
- selectLeaderIndex = YES;
- } else {
+ else
rect = [self draggingFrame];
- }
[dummyDragItem setDraggingFrame:rect contents:[view
draggingImage]];
[dragItems addObject:dummyDragItem];
}
}];
}
-
NSDraggingSession *session = [self
beginDraggingSessionWithItems:dragItems event:theEvent source:self];
[session setDraggingFormation:NSDraggingFormationStack];
- if (selectLeaderIndex)
+ if (selectionIndexes && [[[[dragItems firstObject]
imageComponents] firstObject] contents])
[session setDraggingLeaderIndex:0];
}
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