Revision: 12833
          http://sourceforge.net/p/skim-app/code/12833
Author:   hofman
Date:     2022-04-08 14:25:12 +0000 (Fri, 08 Apr 2022)
Log Message:
-----------
Don't scroll past end of last page

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

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2022-04-08 09:00:30 UTC (rev 12832)
+++ trunk/SKBasePDFView.m       2022-04-08 14:25:12 UTC (rev 12833)
@@ -257,7 +257,6 @@
 }
 
 - (void)horizontallyGoToPage:(PDFPage *)page {
-    NSClipView *clipView = [[self scrollView] contentView];
     NSRect bounds = [page boundsForBox:[self displayBox]];
     if ([self displaysPageBreaks]) {
 #pragma clang diagnostic push
@@ -266,8 +265,11 @@
 #pragma clang diagnostic pop
         bounds = NSInsetRect(bounds, -margin, -margin);
     }
-    bounds = [self convertRect:[self convertRect:bounds fromPage:page] 
toView:clipView];
-    [clipView scrollToPoint:NSMakePoint(NSMinX(bounds), NSMinY([clipView 
bounds]))];
+    NSClipView *clipView = [[self scrollView] contentView];
+    CGFloat x = NSMinX([self convertRect:[self convertRect:bounds 
fromPage:page] toView:clipView]);
+    bounds = [clipView bounds];
+    bounds.origin.x = x;
+    [clipView scrollToPoint:[clipView constrainBoundsRect:bounds].origin];
 }
 
 #pragma clang diagnostic pop

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to