Revision: 15171
          http://sourceforge.net/p/skim-app/code/15171
Author:   hofman
Date:     2025-05-09 08:55:53 +0000 (Fri, 09 May 2025)
Log Message:
-----------
Let presentation view decide whether to redisplay. Scale to fill when resizing.

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2025-05-08 22:54:29 UTC (rev 15170)
+++ trunk/SKMainWindowController.m      2025-05-09 08:55:53 UTC (rev 15171)
@@ -2192,8 +2192,7 @@
         [presentationNotes addObject:annotation];
         if (page) {
             [self updateThumbnailAtPageIndex:[page pageIndex]];
-            if ([presentationView page] == page)
-                [presentationView updatedAnnotation];
+            [presentationView updatedAnnotationOnPage:page];
         }
     } else {
         [[undoManager prepareWithInvocationTarget:[notification object]] 
removeAnnotation:annotation];
@@ -2216,8 +2215,8 @@
                     [self snapshotNeedsUpdate:wc lowPriority:NO];
             }
             [secondaryPdfView addedAnnotation:annotation onPage:page];
-            if ([self interactionMode] == SKPresentationMode && 
[presentationView page] == page)
-                [presentationView updatedAnnotation];
+            if ([self interactionMode] == SKPresentationMode)
+                [presentationView updatedAnnotationOnPage:page];
         }
     }
 }
@@ -2234,8 +2233,7 @@
         [presentationNotes removeObject:annotation];
         if (page) {
             [self updateThumbnailAtPageIndex:[page pageIndex]];
-            if ([presentationView page] == page)
-                [presentationView updatedAnnotation];
+            [presentationView updatedAnnotationOnPage:page];
         }
     } else {
         [[undoManager prepareWithInvocationTarget:[notification object]] 
addAnnotation:annotation toPage:page];
@@ -2261,8 +2259,8 @@
                     [self snapshotNeedsUpdate:wc lowPriority:NO];
             }
             [secondaryPdfView removedAnnotation:annotation onPage:page];
-            if ([self interactionMode] == SKPresentationMode && 
[presentationView page] == page)
-                [presentationView updatedAnnotation];
+            if ([self interactionMode] == SKPresentationMode)
+                [presentationView updatedAnnotationOnPage:page];
         }
     }
 }
@@ -2286,8 +2284,10 @@
         }
         [secondaryPdfView removedAnnotation:annotation onPage:oldPage];
         [secondaryPdfView addedAnnotation:annotation onPage:newPage];
-        if ([self interactionMode] == SKPresentationMode && ([presentationView 
page] == oldPage || [presentationView page] == newPage))
-            [presentationView updatedAnnotation];
+        if ([self interactionMode] == SKPresentationMode) {
+            [presentationView updatedAnnotationOnPage:oldPage];
+            [presentationView updatedAnnotationOnPage:newPage];
+        }
     }
     
     [rightSideController.noteArrayController rearrangeObjects];
@@ -2728,8 +2728,8 @@
                 [pdfView updatedAnnotation:note forKey:keyPath 
fromValue:oldValue];
                 [secondaryPdfView updatedAnnotation:note];
                 
-                if ([self interactionMode] == SKPresentationMode && 
[presentationView page] == page)
-                    [presentationView updatedAnnotation];
+                if ([self interactionMode] == SKPresentationMode)
+                    [presentationView updatedAnnotationOnPage:page];
 
                 if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] && 
note == [pdfView currentAnnotation] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisplayNoteBoundsKey])
                     [self updateRightStatus];

Modified: trunk/SKPresentationView.h
===================================================================
--- trunk/SKPresentationView.h  2025-05-08 22:54:29 UTC (rev 15170)
+++ trunk/SKPresentationView.h  2025-05-09 08:55:53 UTC (rev 15171)
@@ -112,7 +112,7 @@
 - (void)didOpen;
 - (void)willClose;
 
-- (void)updatedAnnotation;
+- (void)updatedAnnotationOnPage:(PDFPage *)aPage;
 
 @end
 

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2025-05-08 22:54:29 UTC (rev 15170)
+++ trunk/SKPresentationView.m  2025-05-09 08:55:53 UTC (rev 15171)
@@ -260,7 +260,7 @@
         pvFlags.enableDrawing = NO == [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableDrawingInPresentationKey];
         
         [pageView 
setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawOnSetNeedsDisplay];
-        [pageView 
setLayerContentsPlacement:NSViewLayerContentsPlacementScaleProportionallyToFit];
+        [pageView 
setLayerContentsPlacement:NSViewLayerContentsPlacementScaleProportionallyToFill];
         
         [self addTrackingArea:[[NSTrackingArea alloc] initWithRect:NSZeroRect 
options:NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | 
NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect owner:self userInfo:nil]];
     }
@@ -272,8 +272,9 @@
     [pageView setNeedsDisplay:YES];
 }
 
-- (void)updatedAnnotation; {
-    [pageView setNeedsDisplay:YES];
+- (void)updatedAnnotationOnPage:(PDFPage *)aPage {
+    if (page == aPage)
+        [pageView setNeedsDisplay:YES];
 }
 
 #pragma mark Accessors
@@ -289,7 +290,7 @@
 - (void)setAutoScales:(BOOL)flag {
     if (flag != pvFlags.autoScales) {
         pvFlags.autoScales = flag;
-        [pageView setLayerContentsPlacement:flag ? 
NSViewLayerContentsPlacementScaleProportionallyToFit : 
NSViewLayerContentsPlacementCenter];
+        [pageView setLayerContentsPlacement:flag ? 
NSViewLayerContentsPlacementScaleProportionallyToFill : 
NSViewLayerContentsPlacementCenter];
         [pageView setNeedsDisplay:YES];
         [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPresentationViewAutoScalesChangedNotification 
object:self];
     }

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