Revision: 13678
          http://sourceforge.net/p/skim-app/code/13678
Author:   hofman
Date:     2023-10-15 21:15:58 +0000 (Sun, 15 Oct 2023)
Log Message:
-----------
Swap margins for rotated pages

Modified Paths:
--------------
    trunk/PDFPage_SKExtensions.m

Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m        2023-10-15 14:48:21 UTC (rev 13677)
+++ trunk/PDFPage_SKExtensions.m        2023-10-15 21:15:58 UTC (rev 13678)
@@ -156,7 +156,14 @@
 }
 
 - (NSRect)foregroundBox {
-    return NSIntersectionRect(NSInsetRect([self foregroundRect], 2.0 - 
[[NSUserDefaults standardUserDefaults] 
floatForKey:SKAutoCropBoxMarginWidthKey], 2.0 - [[NSUserDefaults 
standardUserDefaults] floatForKey:SKAutoCropBoxMarginHeightKey]), [self 
boundsForBox:kPDFDisplayBoxCropBox]);
+    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);
+    if (([self rotation] % 180) == 0)
+        rect = NSInsetRect(rect, -width, -height);
+    else
+        rect = NSInsetRect(rect, -height, -width);
+    return NSIntersectionRect(rect, [self boundsForBox:kPDFDisplayBoxCropBox]);
 }
 
 - (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box {

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

Reply via email to