Revision: 15871
          http://sourceforge.net/p/skim-app/code/15871
Author:   hofman
Date:     2025-12-15 16:50:25 +0000 (Mon, 15 Dec 2025)
Log Message:
-----------
fix initial scroll point for split pdf

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

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2025-12-15 09:56:57 UTC (rev 
15870)
+++ trunk/SKMainWindowController_Actions.m      2025-12-15 16:50:25 UTC (rev 
15871)
@@ -1096,10 +1096,10 @@
         
     } else {
         
-        NSRect frame = [pdfSplitView bounds];
+        NSRect frame = [pdfView bounds];
         
         if (lastSplitPDFHeight <= 0.0)
-            lastSplitPDFHeight = floor(DEFAULT_SPLIT_PDF_FACTOR * 
NSHeight(frame));
+            lastSplitPDFHeight = floor(DEFAULT_SPLIT_PDF_FACTOR * 
(NSHeight(frame) - titleBarHeight));
         
         CGFloat position = NSHeight(frame) - lastSplitPDFHeight - 
[pdfSplitView dividerThickness];
         NSPoint point = frame.origin;
@@ -1120,8 +1120,16 @@
             [secondaryPdfView setInterpolationQuality:[[NSUserDefaults 
standardUserDefaults] integerForKey:SKInterpolationQualityKey]];
             [secondaryPdfView setSynchronizeZoom:YES];
             [secondaryPdfView setDocument:[pdfView document]];
-            point.y += fixedAtBottom ? -lastSplitPDFHeight : NSHeight(frame) - 
position - [pdfSplitView dividerThickness];
+            point.y += fixedAtBottom ? -lastSplitPDFHeight : 
lastSplitPDFHeight + [pdfSplitView dividerThickness];
             page = [pdfView pageForPoint:point nearest:YES];
+            point = [pdfView convertPoint:point toPage:page];
+            [pdfSplitView setPosition:position ofDividerAtIndex:0];
+            [secondaryPdfView goToPage:page];
+            point = [secondaryPdfView convertPoint:[secondaryPdfView 
convertPoint:point fromPage:page] toView:[secondaryPdfView documentView]];
+            [[secondaryPdfView documentView] scrollPoint:point];
+            [secondaryPdfView layoutDocumentView];
+            [pdfSplitView setPosition:NSHeight(frame) - [pdfSplitView 
dividerThickness] ofDividerAtIndex:0];
+            [secondaryPdfView resetHistory];
             
         } else {
             [secondaryPdfView setHidden:YES];
@@ -1129,17 +1137,6 @@
         }
         
         [pdfSplitView setPosition:position ofDividerAtIndex:0 animate:YES];
-        
-        if (page) {
-            [secondaryPdfView goToPage:page];
-            point = [secondaryPdfView convertPoint:[secondaryPdfView 
convertPoint:[pdfView convertPoint:point toPage:page] fromPage:page] 
toView:[secondaryPdfView documentView]];
-            if ([[[secondaryPdfView scrollView] contentView] isFlipped] == 
fixedAtBottom)
-                point.y -= ([[secondaryPdfView documentView] isFlipped] == 
fixedAtBottom ? 1.0 : -1.0) * NSHeight([[secondaryPdfView documentView] 
visibleRect]);
-            [[secondaryPdfView documentView] scrollPoint:point];
-            [secondaryPdfView layoutDocumentView];
-            if (createNew)
-                [secondaryPdfView resetHistory];
-        }
     }
     
     [[self window] recalculateKeyViewLoop];

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