Revision: 15955
http://sourceforge.net/p/skim-app/code/15955
Author: hofman
Date: 2026-01-04 16:03:45 +0000 (Sun, 04 Jan 2026)
Log Message:
-----------
fix determining number of columns, i.p. in horizontal mode
Modified Paths:
--------------
trunk/SKMainWindowController_Actions.m
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2026-01-03 19:08:09 UTC (rev
15954)
+++ trunk/SKMainWindowController_Actions.m 2026-01-04 16:03:45 UTC (rev
15955)
@@ -463,7 +463,7 @@
PDFPage *page = [pdfView currentPage];
NSRect pageRect = [pdfView boundsIncludingMarginsForPage:page];
CGFloat width, height;
- CGFloat scrollerWidth = 0.0;
+ CGFloat scrollerWidth = [NSScroller effectiveScrollerWidth];
CGFloat scaleFactor;
NSUInteger pageCount = [[pdfView document] pageCount];
if (([page rotation] % 180) == 0) {
@@ -476,17 +476,28 @@
frame.size.height -= [[pdfView scrollView] contentInsets].top;
if ((displayMode & kPDFDisplaySinglePageContinuous) == 0) {
// zoom to width
- NSUInteger numCols = (displayMode == kPDFDisplayTwoUp && pageCount > 1
&& ([pdfView displaysAsBook] == NO || pageCount > 2)) ? 2 : 1;
- if (NSWidth(frame) * height > NSHeight(frame) * numCols * width)
- scrollerWidth = [NSScroller effectiveScrollerWidth];
+ 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;
+ }
scaleFactor = ( NSWidth(frame) - scrollerWidth ) / width;
} else {
// zoom to height
- NSUInteger numRows = pageCount;
- if (displayMode == kPDFDisplayTwoUpContinuous)
- numRows = [pdfView displaysAsBook] ? (1 + pageCount) / 2 : 1 +
pageCount / 2;
- if (NSHeight(frame) * width > NSWidth(frame) * numRows * height)
- scrollerWidth = [NSScroller effectiveScrollerWidth];
+ 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;
+ }
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