Revision: 15956
http://sourceforge.net/p/skim-app/code/15956
Author: hofman
Date: 2026-01-04 18:31:47 +0000 (Sun, 04 Jan 2026)
Log Message:
-----------
fix calculation for performFit
Modified Paths:
--------------
trunk/SKMainWindowController_Actions.m
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2026-01-04 16:03:45 UTC (rev
15955)
+++ trunk/SKMainWindowController_Actions.m 2026-01-04 18:31:47 UTC (rev
15956)
@@ -898,39 +898,48 @@
PDFDisplayMode displayMode = [[self pdfView] displayMode];
BOOL horizontal = [[self pdfView] displayDirection] ==
kPDFDisplayDirectionHorizontal && displayMode ==
kPDFDisplaySinglePageContinuous;
- CGFloat scaleFactor = [[self pdfView] scaleFactor];
- BOOL autoScales = [[self pdfView] autoScales];
+ NSUInteger pageCount = [[[self pdfView] document] pageCount];
BOOL isSingleRow;
- if (displayMode == kPDFDisplaySinglePage || displayMode ==
kPDFDisplayTwoUp || horizontal)
+ if ((displayMode & kPDFDisplaySinglePageContinuous) == 0 || horizontal)
isSingleRow = YES;
else if (displayMode == kPDFDisplaySinglePageContinuous || [[self pdfView]
displaysAsBook])
- isSingleRow = [[[self pdfView] document] pageCount] <= 1;
+ isSingleRow = pageCount <= 1;
else
- isSingleRow = [[[self pdfView] document] pageCount] <= 2;
+ isSingleRow = pageCount <= 2;
NSRect frame = [[self window] frame];
NSSize size, oldSize = [[self pdfView] frame].size;
NSRect documentRect = [[[self pdfView] documentView] convertRect:[[[self
pdfView] documentView] bounds] toView:nil];
PDFPage *page = [[self pdfView] currentPage];
- NSRect pageRect = [pdfView boundsIncludingMarginsForPage:page];
+ NSRect pageRect;
+ CGFloat scrollerWidth = [NSScroller effectiveScrollerWidth];
+ if ((displayMode & kPDFDisplaySinglePageContinuous) != 0)
+ pageRect = [pdfView boundsIncludingMarginsForPage:page];
+
oldSize.height -= [[[self pdfView] scrollView] contentInsets].top;
// Calculate the new size for the pdfView
- size.width = NSWidth(documentRect);
- if (autoScales)
- size.width /= scaleFactor;
- if (isSingleRow) {
+ if (horizontal && pageCount > 1)
+ size.width = NSWidth([[self pdfView] convertRect:pageRect
fromPage:page]);
+ else
+ size.width = NSWidth(documentRect);
+ if (isSingleRow)
size.height = NSHeight(documentRect);
- if (horizontal && [[[self pdfView] document] pageCount] > 1)
- size.width = NSWidth([[self pdfView] convertRect:pageRect
fromPage:page]) + [NSScroller effectiveScrollerWidth];
- } else {
+ else
size.height = NSHeight([[self pdfView] convertRect:pageRect
fromPage:page]);
- size.width += [NSScroller effectiveScrollerWidth];
+ if ([[self pdfView] autoScales]) {
+ CGFloat scaleFactor = [[self pdfView] scaleFactor];
+ size.width /= scaleFactor;
+ size.height /= scaleFactor;
}
- if (autoScales)
- size.height /= scaleFactor;
+ if (scrollerWidth > 0.0) {
+ if (isSingleRow == NO)
+ size.width += scrollerWidth;
+ else if (horizontal && pageCount > 1)
+ size.height += scrollerWidth;
+ }
// Calculate the new size for the window
size.width = ceil(NSWidth(frame) + size.width - oldSize.width);
@@ -942,7 +951,7 @@
[[self window] setFrame:frame display:[[self window] isVisible]];
- if (displayMode == kPDFDisplaySinglePageContinuous || displayMode ==
kPDFDisplayTwoUpContinuous)
+ if ((displayMode & kPDFDisplaySinglePageContinuous) != 0)
[[self pdfView] goToRect:pageRect onPage:page];
}
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