Revision: 13685
http://sourceforge.net/p/skim-app/code/13685
Author: hofman
Date: 2023-10-19 22:22:16 +0000 (Thu, 19 Oct 2023)
Log Message:
-----------
Separate method for boundingBox, used by Fit* destinations, which is outset by
2pt and restricted by the crop box.
Modified Paths:
--------------
trunk/PDFDestination_SKExtensions.m
trunk/PDFPage_SKExtensions.h
trunk/PDFPage_SKExtensions.m
Modified: trunk/PDFDestination_SKExtensions.m
===================================================================
--- trunk/PDFDestination_SKExtensions.m 2023-10-19 22:14:16 UTC (rev 13684)
+++ trunk/PDFDestination_SKExtensions.m 2023-10-19 22:22:16 UTC (rev 13685)
@@ -112,7 +112,7 @@
break;
}
case 5: // FitB
- bounds = [page foregroundRect];
+ bounds = [page boundingBox];
if (pdfView && NSIsEmptyRect(bounds) == NO) {
zoomX = size.width / NSWidth(bounds);
zoomY = size.height / NSHeight(bounds);
@@ -119,7 +119,7 @@
}
break;
case 6: // FitBH
- bounds = [page foregroundRect];
+ bounds = [page boundingBox];
@try { point.y = [[self valueForKeyPath:RUNNING_BEFORE(10_12)
? @"_pdfPriv.top" : @"_private.top"] doubleValue]; }
@catch (id e) { override = NO; }
if (override && pdfView && NSIsEmptyRect(bounds) == NO)
@@ -131,7 +131,7 @@
}
break;
case 7: // FitBV
- bounds = [page foregroundRect];
+ bounds = [page boundingBox];
@try { point.x = [[self valueForKeyPath:RUNNING_BEFORE(10_12)
? @"_pdfPriv.left" : @"_private.left"] doubleValue]; }
@catch (id e) { override = NO; }
if (override && pdfView && NSIsEmptyRect(bounds) == NO)
Modified: trunk/PDFPage_SKExtensions.h
===================================================================
--- trunk/PDFPage_SKExtensions.h 2023-10-19 22:14:16 UTC (rev 13684)
+++ trunk/PDFPage_SKExtensions.h 2023-10-19 22:22:16 UTC (rev 13685)
@@ -57,6 +57,7 @@
- (NSRect)foregroundRect;
- (NSRect)foregroundBox;
+- (NSRect)boundingBox;
- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box;
- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box
readingBar:(SKReadingBar *)readingBar;
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2023-10-19 22:14:16 UTC (rev 13684)
+++ trunk/PDFPage_SKExtensions.m 2023-10-19 22:22:16 UTC (rev 13685)
@@ -152,13 +152,13 @@
foregroundRect.origin = SKAddPoints(foregroundRect.origin,
bounds.origin);
}
[imageRep release];
- return NSIntersectionRect(NSInsetRect(foregroundRect, -2.0, -2.0), bounds);
+ return foregroundRect;
}
- (NSRect)foregroundBox {
NSRect rect = [self foregroundRect];
- CGFloat width = fmax([[NSUserDefaults standardUserDefaults]
floatForKey:SKAutoCropBoxMarginWidthKey] - 2.0, 0.0);
- CGFloat height = fmax([[NSUserDefaults standardUserDefaults]
floatForKey:SKAutoCropBoxMarginHeightKey] - 2.0, 0.0);
+ CGFloat width = fmax([[NSUserDefaults standardUserDefaults]
floatForKey:SKAutoCropBoxMarginWidthKey], 0.0);
+ CGFloat height = fmax([[NSUserDefaults standardUserDefaults]
floatForKey:SKAutoCropBoxMarginHeightKey], 0.0);
if (([self rotation] % 180) == 0)
rect = NSInsetRect(rect, -width, -height);
else
@@ -166,6 +166,10 @@
return NSIntersectionRect(rect, [self
boundsForBox:kPDFDisplayBoxMediaBox]);
}
+- (NSRect)boundingBox {
+ return NSIntersectionRect(NSInsetRect([self foregroundRect], -2.0, -2.0),
[self boundsForBox:kPDFDisplayBoxCropBox]);
+}
+
- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box {
return [self thumbnailWithSize:aSize forBox:box readingBar:nil];
}
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