Revision: 13682
http://sourceforge.net/p/skim-app/code/13682
Author: hofman
Date: 2023-10-18 21:02:33 +0000 (Wed, 18 Oct 2023)
Log Message:
-----------
better handling of Fit* destination on rotated pages
Modified Paths:
--------------
trunk/PDFDestination_SKExtensions.m
Modified: trunk/PDFDestination_SKExtensions.m
===================================================================
--- trunk/PDFDestination_SKExtensions.m 2023-10-17 22:39:25 UTC (rev 13681)
+++ trunk/PDFDestination_SKExtensions.m 2023-10-18 21:02:33 UTC (rev 13682)
@@ -54,7 +54,8 @@
CGFloat zoomX = kPDFDestinationUnspecifiedValue, zoomY =
kPDFDestinationUnspecifiedValue;
BOOL override = YES;
NSInteger type = 0;
- if (([page rotation] % 180) != 0)
+ NSInteger rotation = [page rotation];
+ if ((rotation % 180) != 0)
size = NSMakeSize(size.height, size.width);
// the -type property always returns 0, and not the value from the ivar
@try { type = [[self valueForKeyPath:RUNNING_BEFORE(10_12) ?
@"_pdfPriv.type" : @"_private.type"] integerValue]; }
@@ -146,14 +147,14 @@
break;
}
if (override) {
+ if (zoomX < zoomY)
+ bounds = NSInsetRect(bounds, 0.0, 0.5 * (1.0 - zoomY / zoomX)
* NSHeight(bounds));
+ else if (zoomX > zoomY)
+ bounds = NSInsetRect(bounds, 0.5 * (1.0 - zoomX / zoomY) *
NSWidth(bounds), 0.0);
if (point.x >= kPDFDestinationUnspecifiedValue)
- point.x = NSMinX(bounds);
+ point.x = rotation < 180 ? NSMinX(bounds) : NSMaxX(bounds);
if (point.y >= kPDFDestinationUnspecifiedValue)
- point.y = NSMaxY(bounds);
- if (zoomX < zoomY)
- point.y += 0.5 * (zoomY / zoomX - 1.0) * NSHeight(bounds);
- else if (zoomX > zoomY)
- point.x -= 0.5 * (zoomX / zoomY - 1.0) * NSWidth(bounds);
+ point.y = (rotation + 90) % 360 < 180 ? NSMaxY(bounds) :
NSMinY(bounds);
PDFDestination *destination = [[[PDFDestination alloc]
initWithPage:page atPoint:point] autorelease];
if (zoomX < kPDFDestinationUnspecifiedValue)
[destination setZoom:fmin(zoomX, zoomY)];
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