Revision: 9121
          http://sourceforge.net/p/skim-app/code/9121
Author:   hofman
Date:     2016-09-22 23:51:48 +0000 (Thu, 22 Sep 2016)
Log Message:
-----------
go to destination rather than visible rect when reloading document, hopefully 
that works better on 10.12

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2016-09-22 23:48:07 UTC (rev 9120)
+++ trunk/SKMainWindowController.m      2016-09-22 23:51:48 UTC (rev 9121)
@@ -732,16 +732,19 @@
     if ([pdfView document] != document) {
         
         NSUInteger pageIndex = NSNotFound, secondaryPageIndex = NSNotFound;
-        NSRect visibleRect = NSZeroRect, secondaryVisibleRect = NSZeroRect;
+        NSPoint point, secondaryPoint;
+        PDFDestination *dest;
         NSArray *snapshotDicts = nil;
         NSDictionary *openState = nil;
         
         if ([pdfView document]) {
-            pageIndex = [[pdfView currentPage] pageIndex];
-            visibleRect = [pdfView convertRect:[pdfView convertRect:[[pdfView 
documentView] visibleRect] fromView:[pdfView documentView]] toPage:[pdfView 
currentPage]];
+            dest = [pdfView currentDestination];
+            pageIndex = [[dest page] pageIndex];
+            point = [dest point];
             if (secondaryPdfView) {
-                secondaryPageIndex = [[secondaryPdfView currentPage] 
pageIndex];
-                secondaryVisibleRect = [secondaryPdfView 
convertRect:[secondaryPdfView convertRect:[[secondaryPdfView documentView] 
visibleRect] fromView:[secondaryPdfView documentView]] toPage:[secondaryPdfView 
currentPage]];
+                dest = [secondaryPdfView currentDestination];
+                secondaryPageIndex = [[dest page] pageIndex];
+                secondaryPoint = [dest point];
             }
             openState = [self expansionStateForOutline:[[pdfView document] 
outlineRoot]];
             
@@ -806,12 +809,12 @@
             [[pdfView window] disableFlushWindow];
             if (page) {
                 [pdfView display];
-                [pdfView goToRect:visibleRect onPage:page];
+                [pdfView goToDestination:[[[PDFDestination alloc] 
initWithPage:[document pageAtIndex:pageIndex] atPoint:point] autorelease]];
             }
             if (secondaryPage) {
                 if ([secondaryPdfView window])
                     [secondaryPdfView display];
-                [secondaryPdfView goToRect:secondaryVisibleRect 
onPage:secondaryPage];
+                [secondaryPdfView goToDestination:[[[PDFDestination alloc] 
initWithPage:[document pageAtIndex:secondaryPageIndex] atPoint:secondaryPoint] 
autorelease]];
             }
             [[pdfView window] enableFlushWindow];
             [[pdfView window] flushWindowIfNeeded];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to