Revision: 14764 http://sourceforge.net/p/skim-app/code/14764 Author: hofman Date: 2024-11-30 10:27:09 +0000 (Sat, 30 Nov 2024) Log Message: ----------- Always use the same offset for previews of a destination target, also for links
Modified Paths: -------------- trunk/SKImageToolTipContext.m Modified: trunk/SKImageToolTipContext.m =================================================================== --- trunk/SKImageToolTipContext.m 2024-11-29 10:40:14 UTC (rev 14763) +++ trunk/SKImageToolTipContext.m 2024-11-30 10:27:09 UTC (rev 14764) @@ -92,12 +92,12 @@ @interface PDFDestination (SKImageToolTipContextExtension) -- (NSImage *)toolTipImageWithOffset:(NSPoint)offset scale:(CGFloat)scale selections:(NSArray *)selections label:(NSString *)label; +- (NSImage *)toolTipImageWithScale:(CGFloat)scale selections:(NSArray *)selections label:(NSString *)label; @end @implementation PDFDestination (SKImageToolTipContext) -- (NSImage *)toolTipImageWithOffset:(NSPoint)offset scale:(CGFloat)scale selections:(NSArray *)selections label:(NSString *)label { +- (NSImage *)toolTipImageWithScale:(CGFloat)scale selections:(NSArray *)selections label:(NSString *)label { static NSDictionary *labelAttributes = nil; static NSColor *labelColor = nil; if (labelAttributes == nil) @@ -127,9 +127,10 @@ sourceRect.size.width = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipWidthKey]; sourceRect.size.height = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipHeightKey]; - sourceRect.origin = SKAddPoints([transform transformPoint:point], offset); - sourceRect.origin.y -= NSHeight(sourceRect); - + sourceRect.origin = [transform transformPoint:point]; + sourceRect.origin.x -= 50.0; + sourceRect.origin.y -= NSHeight(sourceRect) - 20.0; + if ([pageSelection hasCharacters]) selBounds = NSIntersectionRect(NSInsetRect([pageSelection boundsForPage:page], -2.0, -2.0), bounds); else @@ -177,7 +178,7 @@ } - (NSImage *)toolTipImageWithScale:(CGFloat)scale { - return [self toolTipImageWithOffset:NSMakePoint(-50.0, 20.0) scale:scale selections:nil label:nil]; + return [self toolTipImageWithScale:scale selections:nil label:nil]; } @end @@ -189,7 +190,7 @@ PDFSelection *sel = [self copy]; [sel setColor:[NSColor findHighlightColor]]; NSArray *selections = @[sel]; - return [[self destination] toolTipImageWithOffset:NSMakePoint(-50.0, 20.0) scale:scale selections:selections label:nil]; + return [[self destination] toolTipImageWithScale:scale selections:selections label:nil]; } @end @@ -200,7 +201,7 @@ - (NSImage *)toolTipImageWithScale:(CGFloat)scale { NSArray *selections = [[NSArray alloc] initWithArray:[self matches] copyItems:YES]; [selections setValue:[NSColor findHighlightColor] forKey:@"color"]; - return [[[selections firstObject] destination] toolTipImageWithOffset:NSMakePoint(-50.0, 20.0) scale:scale selections:selections label:[self label]]; + return [[[selections firstObject] destination] toolTipImageWithScale:scale selections:selections label:[self label]]; } @end @@ -211,7 +212,7 @@ - (NSImage *)toolTipImageWithScale:(CGFloat)scale { if ([self isLink]) { - NSImage *image = [[self destination] toolTipImageWithOffset:NSZeroPoint scale:scale selections:nil label:nil]; + NSImage *image = [[self destination] toolTipImageWithScale:scale selections:nil label:nil]; if (image == nil) { NSURL *url = [self URL]; if (url) { 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