Revision: 12939
          http://sourceforge.net/p/skim-app/code/12939
Author:   hofman
Date:     2022-06-24 13:52:05 +0000 (Fri, 24 Jun 2022)
Log Message:
-----------
Always reduce visibleContentRect by scrollView's contentInset. Implement 
methodinPDFView category.

Modified Paths:
--------------
    trunk/PDFView_SKExtensions.h
    trunk/PDFView_SKExtensions.m
    trunk/SKPDFView.m
    trunk/SKSnapshotPDFView.h
    trunk/SKSnapshotPDFView.m

Modified: trunk/PDFView_SKExtensions.h
===================================================================
--- trunk/PDFView_SKExtensions.h        2022-06-24 09:40:03 UTC (rev 12938)
+++ trunk/PDFView_SKExtensions.h        2022-06-24 13:52:05 UTC (rev 12939)
@@ -46,6 +46,7 @@
 @property (nonatomic, readonly) NSArray *displayedPages;
 @property (nonatomic, readonly) CGFloat minimumScaleFactor;
 @property (nonatomic, readonly) CGFloat maximumScaleFactor;
+@property (nonatomic, readonly) NSRect visibleContentRect;
 
 - (BOOL)isPageAtIndexDisplayed:(NSUInteger)pageIndex;
 

Modified: trunk/PDFView_SKExtensions.m
===================================================================
--- trunk/PDFView_SKExtensions.m        2022-06-24 09:40:03 UTC (rev 12938)
+++ trunk/PDFView_SKExtensions.m        2022-06-24 13:52:05 UTC (rev 12939)
@@ -71,7 +71,7 @@
 
 @implementation PDFView (SKExtensions)
 
-@dynamic physicalScaleFactor, scrollView, displayedPages, minimumScaleFactor, 
maximumScaleFactor, drawsActiveSelections;
+@dynamic physicalScaleFactor, scrollView, displayedPages, minimumScaleFactor, 
maximumScaleFactor, visibleContentRect, drawsActiveSelections;
 
 static inline CGFloat physicalScaleFactorForView(NSView *view) {
     NSScreen *screen = [[view window] screen];
@@ -268,6 +268,14 @@
     return 0.1;
 }
 
+- (NSRect)visibleContentRect {
+    NSScrollView *scrollView = [self scrollView];
+    NSView *clipView = [scrollView contentView];
+    NSRect rect = [self convertRect:[clipView bounds] fromView:clipView];
+    rect.size.height -= [scrollView contentInsets].top;
+    return rect;
+}
+
 - (CGFloat)maximumScaleFactor {
     if ([self respondsToSelector:@selector(maxScaleFactor)])
         return [self maxScaleFactor];

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-06-24 09:40:03 UTC (rev 12938)
+++ trunk/SKPDFView.m   2022-06-24 13:52:05 UTC (rev 12939)
@@ -374,11 +374,6 @@
     [self stopPacer];
 }
 
-- (NSRect)visibleContentRect {
-    NSView *clipView = [[self scrollView] contentView];
-    return [clipView convertRect:[clipView visibleRect] toView:self];
-}
-
 - (void)resetHistory {
     if ([self respondsToSelector:@selector(currentHistoryIndex)])
         minHistoryIndex = [self currentHistoryIndex];

Modified: trunk/SKSnapshotPDFView.h
===================================================================
--- trunk/SKSnapshotPDFView.h   2022-06-24 09:40:03 UTC (rev 12938)
+++ trunk/SKSnapshotPDFView.h   2022-06-24 13:52:05 UTC (rev 12939)
@@ -57,7 +57,6 @@
 
 @property (nonatomic) BOOL autoFits;
 @property (nonatomic) BOOL shouldAutoFit;
-@property (nonatomic, readonly) NSRect visibleContentRect;
 
 - (void)resetHistory;
 

Modified: trunk/SKSnapshotPDFView.m
===================================================================
--- trunk/SKSnapshotPDFView.m   2022-06-24 09:40:03 UTC (rev 12938)
+++ trunk/SKSnapshotPDFView.m   2022-06-24 13:52:05 UTC (rev 12939)
@@ -73,7 +73,6 @@
 @implementation SKSnapshotPDFView
 
 @synthesize autoFits, shouldAutoFit;
-@dynamic visibleContentRect;
 
 #define SKPDFContentViewChangedNotification 
@"SKPDFContentViewChangedNotification"
 
@@ -254,14 +253,6 @@
     [super setDelegate:newDelegate];
 }
 
-- (NSRect)visibleContentRect {
-    NSScrollView *scrollView = [self scrollView];
-    NSView *clipView = [scrollView contentView];
-    NSRect rect = [self convertRect:[clipView bounds] fromView:clipView];
-    rect.size.height -= [scrollView contentInsets].top;
-    return rect;
-}
-
 - (void)handlePDFViewFrameChangedNotification:(NSNotification *)notification {
     if ([self autoFits]) {
         NSRect clipRect = [self visibleContentRect];

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