Revision: 14558
          http://sourceforge.net/p/skim-app/code/14558
Author:   hofman
Date:     2024-10-18 15:34:36 +0000 (Fri, 18 Oct 2024)
Log Message:
-----------
reset maxScaleFactor and autoScales after setting the PDFDocumnt in an override 
of the setter

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

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2024-10-18 14:38:35 UTC (rev 14557)
+++ trunk/SKBasePDFView.m       2024-10-18 15:34:36 UTC (rev 14558)
@@ -161,6 +161,16 @@
 
 #pragma mark Bug fixes
 
+- (void)setDocument:(PDFDocument *)document {
+    // setting the document sets the maxScaleFactor to an insane 100
+    [super setDocument:document];
+    BOOL autoScale = [self autoScales];
+    [self setMaxScaleFactor:20.0];
+    // setting the maxScaleFactor resets autoScales
+    if (autoScale != [self autoScales])
+        [self setAutoScales:autoScale];
+}
+
 - (void)goToRect:(NSRect)rect onPage:(PDFPage *)page {
     if (@available(macOS 10.14, *)) {
         [super goToRect:rect onPage:page];

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-10-18 14:38:35 UTC (rev 14557)
+++ trunk/SKMainWindowController.m      2024-10-18 15:34:36 UTC (rev 14558)
@@ -320,9 +320,6 @@
     pdfView = [[SKPDFView alloc] initWithFrame:[pdfContentView bounds]];
     [pdfView setTranslatesAutoresizingMaskIntoConstraints:NO];
     
-    if ([pdfView maxScaleFactor] < 20.0)
-        [pdfView setMaxScaleFactor:20.0];
-    
     // Set up the tool bar
     toolbarController = [[SKMainToolbarController alloc] init];
     [toolbarController setMainController:self];
@@ -1116,15 +1113,6 @@
 
     [self registerForDocumentNotifications];
     
-    BOOL autoScale = [pdfView autoScales];
-    [pdfView setMaxScaleFactor:20.0];
-    if (autoScale != [pdfView autoScales])
-        [pdfView setAutoScales:autoScale];
-    autoScale = [secondaryPdfView autoScales];
-    [secondaryPdfView setMaxScaleFactor:20.0];
-    if (autoScale != [secondaryPdfView autoScales])
-        [secondaryPdfView setAutoScales:autoScale];
-    
     [toolbarController updateMinMaxScale];
     
     if ([pdfDocument isLocked]) {

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