Revision: 15826
          http://sourceforge.net/p/skim-app/code/15826
Author:   hofman
Date:     2025-11-25 10:05:53 +0000 (Tue, 25 Nov 2025)
Log Message:
-----------
get pageIndex once

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

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2025-11-25 10:03:25 UTC (rev 15825)
+++ trunk/SKBasePDFView.m       2025-11-25 10:05:53 UTC (rev 15826)
@@ -398,11 +398,11 @@
     NSScrollView *scrollView = nil;
     NSClipView *clipView = nil;
     NSRect bounds = NSZeroRect;
-    PDFPage *page = nil;
+    NSUInteger pageIndex = NSNotFound;
     
     if (([self displayMode] & kPDFDisplaySinglePageContinuous) == 0) {
         // Apple scrolls to the bottom of the next page rather than the top
-        page = [self currentPage];
+        pageIndex = [[self currentPage] pageIndex];
     } else if (hasVerticalLayout(self)) {
         // Apple scrolls by too much, so correct for it
         scrollView = [self scrollView];
@@ -431,11 +431,12 @@
             return;
         [clipView scrollToPoint:bounds.origin];
         [scrollView reflectScrolledClipView:clipView];
-    } else if (page) {
+    } else if (pageIndex != NSNotFound) {
         // check whether we jumped pages
-        if ([[self currentPage] pageIndex] > [page pageIndex])
+        NSUInteger currentPageIndex = [[self currentPage] pageIndex];
+        if (currentPageIndex > pageIndex)
             [self verticallyScrollToTop];
-        else if ([[self currentPage] pageIndex] < [page pageIndex])
+        else if (currentPageIndex < pageIndex)
             [self verticallyScrollToBottom];
     }
 }
@@ -444,11 +445,11 @@
     NSScrollView *scrollView = nil;
     NSClipView *clipView = nil;
     NSRect bounds = NSZeroRect;
-    PDFPage *page = nil;
+    NSUInteger pageIndex = NSNotFound;
     
     if (([self displayMode] & kPDFDisplaySinglePageContinuous) == 0) {
         // Apple scrolls to the top of the next page rather than the bottom
-        page = [self currentPage];
+        pageIndex = [[self currentPage] pageIndex];
     } else if (hasVerticalLayout(self)) {
         // Apple scrolls by too much, so correct for it
         scrollView = [self scrollView];
@@ -477,11 +478,12 @@
             return;
         [clipView scrollToPoint:bounds.origin];
         [scrollView reflectScrolledClipView:clipView];
-    } else if (page) {
+    } else if (pageIndex != NSNotFound) {
         // check whether we jumped pages
-        if ([[self currentPage] pageIndex] < [page pageIndex])
+        NSUInteger currentPageIndex = [[self currentPage] pageIndex];
+        if (currentPageIndex < pageIndex)
             [self verticallyScrollToBottom];
-        else if ([[self currentPage] pageIndex] > [page pageIndex])
+        else if (currentPageIndex > pageIndex)
             [self verticallyScrollToTop];
     }
 }

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