Revision: 15823
          http://sourceforge.net/p/skim-app/code/15823
Author:   hofman
Date:     2025-11-24 17:31:15 +0000 (Mon, 24 Nov 2025)
Log Message:
-----------
add some comments about whet we and Apple do

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

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2025-11-24 17:19:11 UTC (rev 15822)
+++ trunk/SKBasePDFView.m       2025-11-24 17:31:15 UTC (rev 15823)
@@ -390,7 +390,10 @@
     [super goToDestination:destination];
 }
 
-// this is bound to PageDown in PDFView
+// PDFView binds PageDown to scrollPageUp: and ArrowDown to scrollPageUp: and 
v.v. (wrong!)
+// the clipView is not flipped (wrong!)
+// ... at least until macOS 15, but macOS 26 seems to scroll in the wrong 
direction
+
 - (void)scrollPageUp:(id)sender {
     NSScrollView *scrollView = nil;
     NSClipView *clipView = nil;
@@ -398,6 +401,7 @@
     PDFPage *page = nil;
     
     if (([self displayMode] & kPDFDisplaySinglePageContinuous) == 0) {
+        // Apple scrolls to the bottom of the next page rather than the top
         page = [self currentPage];
     } else if (hasVerticalLayout(self)) {
         // Apple scrolls by too much, so correct for it
@@ -415,6 +419,7 @@
         CGFloat offset = fmax(height - [scrollView verticalPageScroll], 0.5 * 
height);
         NSRect docRect = [[scrollView documentView] frame];
         // check whether we have scrolled and in which direction
+        // consider all implementation details as they are wrong and can change
         if ([clipView isFlipped] == NO) {
             if (NSMinY([clipView bounds]) < NSMinY(bounds) - 1.0)
                 bounds.origin.y = fmax(NSMinY(docRect), NSMinY(bounds) - 
offset);
@@ -433,7 +438,7 @@
         [clipView scrollToPoint:bounds.origin];
         [scrollView reflectScrolledClipView:clipView];
     } else if (page) {
-        // Apple scrolls to the  bottom of the previouspage or the top of the 
next page rather than the bottom
+        // check whether we jumped pages
         if ([[self currentPage] pageIndex] > [page pageIndex])
             [self verticallyScrollToTop];
         else if ([[self currentPage] pageIndex] < [page pageIndex])
@@ -441,7 +446,6 @@
     }
 }
 
-// this is bound to PageUp in PDFView
 - (void)scrollPageDown:(id)sender {
     NSScrollView *scrollView = nil;
     NSClipView *clipView = nil;
@@ -449,6 +453,7 @@
     PDFPage *page = nil;
     
     if (([self displayMode] & kPDFDisplaySinglePageContinuous) == 0) {
+        // Apple scrolls to the top of the next page rather than the bottom
         page = [self currentPage];
     } else if (hasVerticalLayout(self)) {
         // Apple scrolls by too much, so correct for it
@@ -466,6 +471,7 @@
         CGFloat offset = fmax(height - [scrollView verticalPageScroll], 0.5 * 
height);
         NSRect docRect = [[scrollView documentView] frame];
         // check whether we have scrolled and in which direction
+        // consider all implementation details as they are wrong and can change
         if ([clipView isFlipped] == NO) {
             if (NSMinY([clipView bounds]) > NSMinY(bounds) + 1.0)
                 bounds.origin.y = fmin(NSMaxY(docRect) - height, 
NSMinY(bounds) + offset);
@@ -484,7 +490,7 @@
         [clipView scrollToPoint:bounds.origin];
         [scrollView reflectScrolledClipView:clipView];
     } else if (page) {
-        // Apple scrolls to the top of the next page or the bottom of the 
previous page rather than the bottom
+        // check whether we jumped pages
         if ([[self currentPage] pageIndex] < [page pageIndex])
             [self verticallyScrollToBottom];
         else if ([[self currentPage] pageIndex] > [page pageIndex])
@@ -492,7 +498,6 @@
     }
 }
 
-// this is bound to ArrowDown in PDFView
 - (void)scrollLineUp:(id)sender {
     PDFPage *page = ([self displayMode] & kPDFDisplaySinglePageContinuous) ? 
nil : [self currentPage];
     
@@ -499,7 +504,8 @@
     [super scrollLineUp:sender];
     
     if (page) {
-        // Apple scrolls to the  bottom of the previouspage or the top of the 
next page rather than the bottom
+        // Apple scrolls to the bottom of the next page rather than the top
+        // check whether we jumped pages
         if ([[self currentPage] pageIndex] > [page pageIndex])
             [self verticallyScrollToTop];
         else if ([[self currentPage] pageIndex] < [page pageIndex])
@@ -507,7 +513,6 @@
     }
 }
 
-// this is bound to ArrowUp in PDFView
 - (void)scrollLineDown:(id)sender {
     PDFPage *page = ([self displayMode] & kPDFDisplaySinglePageContinuous) ? 
nil : [self currentPage];
     
@@ -514,7 +519,8 @@
     [super scrollLineDown:sender];
     
     if (page) {
-        // Apple scrolls to the  bottom of the previouspage or the top of the 
next page rather than the bottom
+        // Apple scrolls to the top of the next page rather than the bottom
+        // check whether we jumped pages
         if ([[self currentPage] pageIndex] > [page pageIndex])
             [self verticallyScrollToTop];
         else if ([[self currentPage] pageIndex] < [page pageIndex])

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