Revision: 15149
          http://sourceforge.net/p/skim-app/code/15149
Author:   hofman
Date:     2025-05-04 09:38:18 +0000 (Sun, 04 May 2025)
Log Message:
-----------
Copy selections and set highlight color in meethod drawing tool tip

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

Modified: trunk/SKImageToolTipContext.m
===================================================================
--- trunk/SKImageToolTipContext.m       2025-05-04 09:11:54 UTC (rev 15148)
+++ trunk/SKImageToolTipContext.m       2025-05-04 09:38:18 UTC (rev 15149)
@@ -108,6 +108,11 @@
     if (labelColor == nil)
         labelColor = [NSColor colorWithGenericGamma22White:0.55 alpha:0.8];
     
+    if (selections) {
+        selections = [[NSArray alloc] initWithArray:selections copyItems:YES];
+        [selections setValue:[NSColor findHighlightColor] forKey:@"color"];
+    }
+    
     BOOL isScaled = fabs(scale - 1.0) > 0.01;
     PDFPage *page = [self page];
     NSPoint point = [[self effectiveDestinationForView:nil] point];
@@ -190,10 +195,7 @@
 @implementation PDFSelection (SKImageToolTipContext)
 
 - (NSImage *)toolTipImageWithScale:(CGFloat)scale {
-    PDFSelection *sel = [self copy];
-    [sel setColor:[NSColor findHighlightColor]];
-    NSArray *selections = @[sel];
-    return [[self destination] toolTipImageWithScale:scale 
selections:selections label:nil];
+    return [[self destination] toolTipImageWithScale:scale selections:@[self] 
label:nil];
 }
 
 @end
@@ -202,9 +204,7 @@
 @implementation SKGroupedSearchResult (SKImageToolTipContext)
 
 - (NSImage *)toolTipImageWithScale:(CGFloat)scale {
-    NSArray *selections = [[NSArray alloc] initWithArray:[self matches] 
copyItems:YES];
-    [selections setValue:[NSColor findHighlightColor] forKey:@"color"];
-    return [[[selections firstObject] destination] toolTipImageWithScale:scale 
selections:selections label:[self label]];
+    return [[[[self matches] firstObject] destination] 
toolTipImageWithScale:scale selections:[self matches] label:[self label]];
 }
 
 @end

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to