Revision: 12964
          http://sourceforge.net/p/skim-app/code/12964
Author:   hofman
Date:     2022-06-27 09:07:13 +0000 (Mon, 27 Jun 2022)
Log Message:
-----------
Move reading bar initially to selection if on current page

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-06-27 08:43:10 UTC (rev 12963)
+++ trunk/SKPDFView.m   2022-06-27 09:07:13 UTC (rev 12964)
@@ -984,7 +984,15 @@
         userInfo = [NSDictionary dictionaryWithObjectsAndKeys:page, 
SKPDFViewOldPageKey, nil];
     } else {
         page = [self currentPage];
-        SKReadingBar *aReadingBar = [[SKReadingBar alloc] initWithPage:page 
line:0 delegate:self];
+        NSInteger line = 0;
+        PDFSelection *sel = [self currentSelection];
+        if ([[sel pages] containsObject:page]) {
+            NSRect rect = [sel boundsForPage:page];
+            NSPoint point = [page lineDirectionAngle] < 180 ? 
NSMakePoint(NSMinX(rect) + 1.0, NSMinY(rect) + 1.0) : NSMakePoint(NSMaxY(rect) 
- 1.0, NSMaxY(rect) - 1.0);
+            line = [page indexOfLineRectAtPoint:point lower:YES];
+        }
+        SKReadingBar *aReadingBar = [[SKReadingBar alloc] initWithPage:page 
line:line delegate:self];
+        page = [readingBar page];
         bounds = [aReadingBar currentBoundsForBox:[self displayBox]];
         [self goToRect:NSInsetRect([aReadingBar currentBounds], 0.0, -20.0) 
onPage:page];
         [self setReadingBar:aReadingBar];

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