Revision: 15961
          http://sourceforge.net/p/skim-app/code/15961
Author:   hofman
Date:     2026-01-05 15:49:45 +0000 (Mon, 05 Jan 2026)
Log Message:
-----------
explicitly include page margin for rewind calculation

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2026-01-05 15:34:35 UTC (rev 15960)
+++ trunk/SKPDFView.m   2026-01-05 15:49:45 UTC (rev 15961)
@@ -1538,16 +1538,21 @@
         NSClipView *clipView = [scrollView contentView];
         NSRect bounds = [clipView bounds];
         CGFloat inset = [clipView contentInsets].top;
+        CGFloat margin = 0.0;
         NSRect docRect = [[scrollView documentView] frame];
-        NSRect pageRect = [self convertRect:[self convertRect:[self 
boundsIncludingMarginsForPage:rewindPage] fromPage:rewindPage] toView:clipView];
+        NSRect pageRect = [self convertRect:[self convertRect:[rewindPage 
boundsForBox:[self displayBox]] fromPage:rewindPage] toView:clipView];
         if ((mode & (kPDFDisplayHorizontalContinuous | kPDFDisplayTwoUp)) && 
NSWidth(docRect) > NSWidth(bounds)) {
-            bounds.origin.x = fmin(fmax(fmin(NSMidX(pageRect) - 0.5 * 
NSWidth(bounds), NSMinX(pageRect)), NSMinX(docRect)), NSMaxX(docRect) - 
NSWidth(bounds));
+            if ([self displaysPageBreaks])
+                margin = [self convertSize:NSMakeSize([self 
pageBreakMargins].left * [self scaleFactor], 0.0) toView:clipView].width;
+            bounds.origin.x = fmin(fmax(fmin(NSMidX(pageRect) - 0.5 * 
NSWidth(bounds), NSMinX(pageRect) - margin), NSMinX(docRect)), NSMaxX(docRect) 
- NSWidth(bounds));
         }
         if ((mode & kPDFDisplaySinglePageContinuous) && NSHeight(docRect) > 
NSHeight(bounds) - inset) {
+            if ([self displaysPageBreaks])
+                margin = [self convertSize:NSMakeSize(0.0, [self 
pageBreakMargins].top * [self scaleFactor]) toView:clipView].height;
             if ([clipView isFlipped])
-                bounds.origin.y = fmin(fmax(fmin(NSMidY(pageRect) - 0.5 * 
(NSHeight(bounds) + inset), NSMinY(pageRect) - inset), NSMinY(docRect) - 
inset), NSMaxY(docRect) - NSHeight(bounds));
+                bounds.origin.y = fmin(fmax(fmin(NSMidY(pageRect) - 0.5 * 
(NSHeight(bounds) + inset), NSMinY(pageRect) - margin - inset), NSMinY(docRect) 
- inset), NSMaxY(docRect) - NSHeight(bounds));
             else
-                bounds.origin.y = fmin(fmax(fmax(NSMaxY(pageRect) - 
NSHeight(bounds) + inset, NSMidY(pageRect) - 0.5 * (NSHeight(bounds) - inset)), 
NSMinY(docRect)), NSMaxY(docRect) - NSHeight(bounds) + inset);
+                bounds.origin.y = fmin(fmax(fmax(NSMidY(pageRect) - 0.5 * 
(NSHeight(bounds) - inset), NSMaxY(pageRect) + margin - NSHeight(bounds) + 
inset), NSMinY(docRect)), NSMaxY(docRect) - NSHeight(bounds) + inset);
         }
         [clipView scrollPoint:bounds.origin];
     }

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