Revision: 9514
http://sourceforge.net/p/skim-app/code/9514
Author: hofman
Date: 2017-11-30 21:06:37 +0000 (Thu, 30 Nov 2017)
Log Message:
-----------
Shift image tooltip to remain inside screen frame
Modified Paths:
--------------
trunk/SKImageToolTipWindow.m
Modified: trunk/SKImageToolTipWindow.m
===================================================================
--- trunk/SKImageToolTipWindow.m 2017-11-30 19:01:52 UTC (rev 9513)
+++ trunk/SKImageToolTipWindow.m 2017-11-30 21:06:37 UTC (rev 9514)
@@ -97,7 +97,7 @@
- (void)showDelayed {
NSPoint thePoint = NSEqualPoints(point, NSZeroPoint) ? [NSEvent
mouseLocation] : point;
- NSRect contentRect = NSZeroRect;
+ NSRect contentRect = NSZeroRect, screenRect = [[NSScreen
screenForPoint:thePoint] frame];
NSImage *image = [context toolTipImage];
if (image) {
@@ -104,10 +104,12 @@
[self setBackgroundImage:image];
contentRect.size = [image size];
- contentRect.origin.x = thePoint.x;
+ contentRect.origin.x = fmin(thePoint.x, NSMaxX(screenRect) -
NSWidth(contentRect));
contentRect.origin.y = thePoint.y - WINDOW_OFFSET -
NSHeight(contentRect);
- contentRect = [self constrainFrameRect:contentRect toScreen:[NSScreen
screenForPoint:thePoint]];
- [self setFrame:[self frameRectForContentRect:contentRect] display:NO];
+ contentRect = [self frameRectForContentRect:contentRect];
+ if (NSMinY(contentRect) < NSMinX(screenRect))
+ contentRect.origin.y = thePoint.y + WINDOW_OFFSET;
+ [self setFrame:contentRect display:NO];
if ([self isVisible] && [self alphaValue] > CRITICAL_ALPHA_VALUE)
[self orderFront:self];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit