Revision: 13407
http://sourceforge.net/p/skim-app/code/13407
Author: hofman
Date: 2023-03-31 14:50:02 +0000 (Fri, 31 Mar 2023)
Log Message:
-----------
Use edge of crop box for destination point when a coordinate is not specified.
PDFKit does not really support these cases.
Modified Paths:
--------------
trunk/SKImageToolTipContext.m
trunk/SKPDFView.m
trunk/SKReadingBar.m
Modified: trunk/SKImageToolTipContext.m
===================================================================
--- trunk/SKImageToolTipContext.m 2023-03-30 14:37:13 UTC (rev 13406)
+++ trunk/SKImageToolTipContext.m 2023-03-31 14:50:02 UTC (rev 13407)
@@ -106,6 +106,7 @@
BOOL isScaled = fabs(scale - 1.0) > 0.01;
PDFPage *page = [self page];
+ NSPoint point = [self point];
NSRect bounds = [page boundsForBox:kPDFDisplayBoxCropBox];
CGFloat size = isScaled ? ceil(scale * fmax(NSWidth(bounds),
NSHeight(bounds))) : 0.0;
NSImage *pageImage = [page thumbnailWithSize:size
forBox:kPDFDisplayBoxCropBox shadowBlurRadius:0.0 highlights:selections];
@@ -118,10 +119,14 @@
[scaleTransform scaleBy:size / fmax(NSWidth(bounds),
NSHeight(bounds))];
[transform appendTransform:scaleTransform];
}
+ if (fabs(point.x - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.x = [page rotation] < 180 ? NSMinX([page
boundsForBox:kPDFDisplayBoxCropBox]) : NSMaxX([page
boundsForBox:kPDFDisplayBoxCropBox]);
+ if (fabs(point.y - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.y = (([page rotation] + 90) % 360) < 180 ? NSMaxY([page
boundsForBox:kPDFDisplayBoxCropBox]) : NSMinY([page
boundsForBox:kPDFDisplayBoxCropBox]);
sourceRect.size.width = [[NSUserDefaults standardUserDefaults]
doubleForKey:SKToolTipWidthKey];
sourceRect.size.height = [[NSUserDefaults standardUserDefaults]
doubleForKey:SKToolTipHeightKey];
- sourceRect.origin = SKAddPoints([transform transformPoint:[self point]],
offset);
+ sourceRect.origin = SKAddPoints([transform transformPoint:point], offset);
sourceRect.origin.y -= NSHeight(sourceRect);
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2023-03-30 14:37:13 UTC (rev 13406)
+++ trunk/SKPDFView.m 2023-03-31 14:50:02 UTC (rev 13407)
@@ -4969,7 +4969,12 @@
PDFDestination *destination = [annotation linkDestination];
if ([destination page]) {
page = [destination page];
- point = [self convertPoint:[destination point] fromPage:page];
+ point = [destination point];
+ if (fabs(point.x - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.x = [page rotation] < 180 ? NSMinX([page
boundsForBox:kPDFDisplayBoxCropBox]) : NSMaxX([page
boundsForBox:kPDFDisplayBoxCropBox]);
+ if (fabs(point.y - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.y = (([page rotation] + 90) % 360) < 180 ?
NSMaxY([page boundsForBox:kPDFDisplayBoxCropBox]) : NSMinY([page
boundsForBox:kPDFDisplayBoxCropBox]);
+ point = [self convertPoint:point fromPage:page];
point.y -= 0.5 * DEFAULT_SNAPSHOT_HEIGHT;
}
}
Modified: trunk/SKReadingBar.m
===================================================================
--- trunk/SKReadingBar.m 2023-03-30 14:37:13 UTC (rev 13406)
+++ trunk/SKReadingBar.m 2023-03-31 14:50:02 UTC (rev 13407)
@@ -312,6 +312,10 @@
if (dest) {
aPage = [dest page];
point = [dest point];
+ if (fabs(point.x - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.x = [aPage rotation] < 180 ? NSMinX([aPage
boundsForBox:kPDFDisplayBoxCropBox]) : NSMaxX([aPage
boundsForBox:kPDFDisplayBoxCropBox]);
+ if (fabs(point.y - kPDFDestinationUnspecifiedValue) <= 0.0)
+ point.y = (([aPage rotation] + 90) % 360) < 180 ?
NSMaxY([aPage boundsForBox:kPDFDisplayBoxCropBox]) : NSMinY([aPage
boundsForBox:kPDFDisplayBoxCropBox]);
}
} else if ([location isKindOfClass:[SKLine class]]) {
aPage = [(SKLine *)location page];
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