Revision: 15179
          http://sourceforge.net/p/skim-app/code/15179
Author:   hofman
Date:     2025-05-10 16:23:00 +0000 (Sat, 10 May 2025)
Log Message:
-----------
Separate method to preview page transitions, soit will also animat when the 
page label does not change and the previewer can wait until after the page was 
displayed.

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

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2025-05-10 15:51:27 UTC 
(rev 15178)
+++ trunk/SKPresentationOptionsSheetController.m        2025-05-10 16:23:00 UTC 
(rev 15179)
@@ -373,15 +373,18 @@
     
     DISPATCH_MAIN_AFTER_SEC(1.0, ^{
         
-        [previewView goToNextPage:nil];
+        [previewView animateToNextPage:^{
+            
+            DISPATCH_MAIN_AFTER_SEC(1.0 + [info duration], ^{
+                
+                if ([previewWindow isKeyWindow])
+                    [[self window] makeKeyWindow];
+                [previewWindow orderOut:nil];
+                
+            });
+                
+        }];
         
-        DISPATCH_MAIN_AFTER_SEC(1.0 + [info duration], ^{
-            
-            if ([previewWindow isKeyWindow])
-                [[self window] makeKeyWindow];
-            [previewWindow orderOut:nil];
-            
-        });
     });
 }
 

Modified: trunk/SKPresentationView.h
===================================================================
--- trunk/SKPresentationView.h  2025-05-10 15:51:27 UTC (rev 15178)
+++ trunk/SKPresentationView.h  2025-05-10 16:23:00 UTC (rev 15179)
@@ -58,6 +58,8 @@
 - (void)goToNextPage:(nullable id)sender;
 - (void)goToPreviousPage:(nullable id)sender;
 
+- (void)animateToNextPage:(void (^)(void))didDisplay;
+
 @end
 
 #pragma mark -

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2025-05-10 15:51:27 UTC (rev 15178)
+++ trunk/SKPresentationView.m  2025-05-10 16:23:00 UTC (rev 15179)
@@ -180,6 +180,19 @@
     return YES;
 }
 
+- (void)animateToNextPage:(void (^)(void))didDisplay {
+    PDFDocument *pdfDoc = [page document];
+    NSUInteger idx = [page pageIndex];
+    if (idx + 1 < [pdfDoc pageCount]) {
+        PDFPage *toPage = [pdfDoc pageAtIndex:idx + 1];
+        [transitionController animateView:self forRect:[self pageRect:page] 
toRect:[self pageRect:toPage] atIndex:idx forward:YES change:^(void 
(^done)(void)){
+            page = toPage;
+            [self displayPage:done ? ^{ done(); didDisplay(); } : didDisplay];
+            [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPresentationViewPageChangedNotification object:self];
+        }];
+    }
+}
+
 - (void)goToNextPage:(id)sender {
     PDFDocument *pdfDoc = [page document];
     NSUInteger idx = [page pageIndex];

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