Revision: 13783
          http://sourceforge.net/p/skim-app/code/13783
Author:   hofman
Date:     2023-11-20 10:06:59 +0000 (Mon, 20 Nov 2023)
Log Message:
-----------
Workaround for reintroduced goToDestination: bug in more recent OS versions (I 
think since 12.0), implement scrolling to a point on a page ourselves.

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

Modified: trunk/PDFView_SKExtensions.m
===================================================================
--- trunk/PDFView_SKExtensions.m        2023-11-19 18:19:20 UTC (rev 13782)
+++ trunk/PDFView_SKExtensions.m        2023-11-20 10:06:59 UTC (rev 13783)
@@ -241,9 +241,19 @@
 
 - (void)goToPageAtIndex:(NSUInteger)pageIndex point:(NSPoint)point {
     PDFPage *page = [[self document] pageAtIndex:pageIndex];
-    PDFDestination *destination = [[PDFDestination alloc] initWithPage:page 
atPoint:point];
-    [self goToDestination:destination];
-    [destination release];
+    if (@available(macOS 12.0, *)) {
+        NSView *docView = [self documentView];
+        if (NSLocationInRange(pageIndex, [self displayedPageIndexRange]) == NO)
+            [self goToPage:page];
+        point = [self convertPoint:[self convertPoint:point fromPage:page] 
toView:docView];
+        if ([[[docView enclosingScrollView] contentView] isFlipped] == NO)
+            point.y -= [docView isFlipped] ? -NSHeight([docView visibleRect]) 
+ [[docView enclosingScrollView] contentInsets].top : NSHeight([docView 
visibleRect]) - [[docView enclosingScrollView] contentInsets].top;
+        [docView scrollPoint:point];
+    } else {
+        PDFDestination *destination = [[PDFDestination alloc] 
initWithPage:page atPoint:point];
+        [self goToDestination:destination];
+        [destination release];
+    }
 }
 
 - (void)goToCurrentPage:(PDFPage *)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

Reply via email to