Revision: 14485
          http://sourceforge.net/p/skim-app/code/14485
Author:   hofman
Date:     2024-09-26 15:48:25 +0000 (Thu, 26 Sep 2024)
Log Message:
-----------
Also animate closing preview window, also fade it in/out

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

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2024-09-26 15:32:28 UTC 
(rev 14484)
+++ trunk/SKPresentationOptionsSheetController.m        2024-09-26 15:48:25 UTC 
(rev 14485)
@@ -333,19 +333,35 @@
     [previewWindow setFrame:rect display:NO];
     [previewWindow center];
     rect = [previewWindow frame];
-    NSRect sourceRect;
+    NSRect sourceRect, targetRect;
     if (separate) {
         sourceRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:0 row:idx]];
         sourceRect = NSOffsetRect(NSInsetRect(sourceRect, -6.0, -6.0 - 0.5 * 
titleHeight), 0.0, 0.5 * titleHeight);
+        targetRect = [tableView convertRectToScreen:[tableView 
frameOfCellAtColumn:1 row:idx]];
+        targetRect = NSOffsetRect(NSInsetRect(targetRect, -6.0, -6.0 - 0.5 * 
titleHeight), 0.0, 0.5 * titleHeight);
     } else {
-        sourceRect = [[stylePopUpButton superview] 
convertRectToScreen:[[stylePopUpButton superview] bounds]];
+        targetRect = sourceRect = [[stylePopUpButton superview] 
convertRectToScreen:[[stylePopUpButton superview] bounds]];
     }
     [previewWindow setFrame:sourceRect display:NO];
+    [previewWindow setAlphaValue:0.0];
     [previewWindow makeKeyAndOrderFront:nil];
-    [previewWindow setFrame:rect display:YES animate:YES];
-    
-    [previewView performSelector:@selector(goToNextPage:) withObject:nil 
afterDelay:1.0];
-    [previewWindow performSelector:@selector(orderOut:) withObject:nil 
afterDelay:2.0 + [info duration]];
+    [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+        [[previewWindow animator] setFrame:rect display:YES animate:YES];
+        [[previewWindow animator] setAlphaValue:1.0];
+    } completionHandler:^{
+        DISPATCH_MAIN_AFTER_SEC(1.0, ^{
+            [previewView goToNextPage:nil];
+            DISPATCH_MAIN_AFTER_SEC(1.0 + [info duration], ^{
+                [NSAnimationContext runAnimationGroup:^(NSAnimationContext 
*context){
+                    [[previewWindow animator] setFrame:targetRect display:YES];
+                    [[previewWindow animator] setAlphaValue:0.0];
+                } completionHandler:^{
+                    [previewWindow orderOut:nil];
+                    [previewWindow setAlphaValue:1.0];
+                }];
+            });
+        });
+    }];
 }
 
 - (void)setSeparate:(BOOL)newSeparate {

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