Revision: 15959
          http://sourceforge.net/p/skim-app/code/15959
Author:   hofman
Date:     2026-01-05 15:25:22 +0000 (Mon, 05 Jan 2026)
Log Message:
-----------
fix alternate zoom to fit

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

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2026-01-04 22:42:22 UTC (rev 
15958)
+++ trunk/SKMainWindowController_Actions.m      2026-01-05 15:25:22 UTC (rev 
15959)
@@ -463,7 +463,7 @@
     PDFPage *page = [pdfView currentPage];
     NSRect pageRect = [pdfView boundsIncludingMarginsForPage:page];
     CGFloat width, height;
-    CGFloat scrollerWidth = [NSScroller effectiveScrollerWidth];
+    CGFloat scrollerWidth = 0.0;
     CGFloat scaleFactor;
     NSUInteger pageCount = [[pdfView document] pageCount];
     if (([page rotation] % 180) == 0) {
@@ -476,28 +476,16 @@
     frame.size.height -= [[pdfView embeddedScrollView] contentInsets].top;
     if ((displayMode & kPDFDisplaySinglePageContinuous) == 0) {
         // zoom to width
-        if (scrollerWidth > 0.0) {
-            NSUInteger numCols = 1;
-            if (displayMode == kPDFDisplayHorizontalContinuous) {
-                numCols = pageCount;
-            } else if (displayMode == kPDFDisplayTwoUp && pageCount > 1) {
-                NSUInteger pageIndex = [page pageIndex];
-                if ((pageIndex > 0 && pageIndex + 1 < pageCount) || [pdfView 
displaysAsBook] == (BOOL)(pageIndex % 2))
-                    numCols = 2;
-            }
-            if (NSWidth(frame) * height <= NSHeight(frame) * numCols * width)
-                scrollerWidth = 0.0;
-        }
+        if (NSWidth(frame) * height > NSHeight(frame) * width)
+            scrollerWidth = [NSScroller effectiveScrollerWidth];
         scaleFactor = ( NSWidth(frame) - scrollerWidth ) / width;
     } else {
         // zoom to height
-        if (scrollerWidth > 0.0) {
-            NSUInteger numRows = pageCount;
-            if (displayMode == kPDFDisplayTwoUpContinuous)
-                numRows = [pdfView displaysAsBook] ? (1 + pageCount) / 2 : 1 + 
pageCount / 2;
-            if (NSHeight(frame) * width <= NSWidth(frame) * numRows * height)
-                scrollerWidth = 0.0;
-        }
+        NSUInteger numCols = 1;
+        if (displayMode == kPDFDisplayTwoUpContinuous && pageCount > 1 + 
(NSUInteger)[pdfView displaysAsBook])
+            numCols = 2;
+        if (NSHeight(frame) * width * numCols > NSWidth(frame) * height)
+            scrollerWidth = [NSScroller effectiveScrollerWidth];
         scaleFactor = ( NSHeight(frame) - scrollerWidth ) / height;
     }
     [pdfView setScaleFactor:scaleFactor];

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