Revision: 14490
          http://sourceforge.net/p/skim-app/code/14490
Author:   hofman
Date:     2024-09-28 15:44:26 +0000 (Sat, 28 Sep 2024)
Log Message:
-----------
fade only background of preview window for separate transitions

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

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2024-09-28 14:52:40 UTC 
(rev 14489)
+++ trunk/SKPresentationOptionsSheetController.m        2024-09-28 15:44:26 UTC 
(rev 14490)
@@ -295,13 +295,18 @@
         [previewWindow setHidesOnDeactivate:NO];
         [previewWindow setFloatingPanel:YES];
         [previewWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
-
-        NSVisualEffectView *contentView = [[NSVisualEffectView alloc] init];
-        [contentView setMaterial:NSVisualEffectMaterialPopover];
-        [contentView setState:NSVisualEffectStateActive];
-        [contentView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
-        [previewWindow setContentView:contentView];
+        [previewWindow setOpaque:NO];
+        [previewWindow setBackgroundColor:[NSColor clearColor]];
         
+        NSView *contentView = [previewWindow contentView];
+        
+        NSVisualEffectView *veView = [[NSVisualEffectView alloc] init];
+        [veView setMaterial:NSVisualEffectMaterialPopover];
+        [veView setState:NSVisualEffectStateActive];
+        [veView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
+        [veView setTranslatesAutoresizingMaskIntoConstraints:NO];
+        [contentView addSubviewWithConstraints:veView];
+        
         NSView *bgView = [[NSView alloc] init];
         CALayer *layer = [CALayer layer];
         [layer setBackgroundColor:CGColorGetConstantColor(kCGColorBlack)];
@@ -346,15 +351,25 @@
         }
     }
     BOOL shouldAnimate = [NSView shouldShowFadeAnimation];
+    id viewOrWindow = previewWindow;
+    NSView *titleView = nil;
+    if (separate && NSEqualRects(sourceRect, rect) == NO) {
+        viewOrWindow = [[[previewWindow contentView] subviews] firstObject];
+        titleView = [[[[previewWindow contentView] superview] subviews] 
lastObject];
+    }
     [previewWindow setFrame:sourceRect display:NO];
-    if (shouldAnimate)
-        [previewWindow setAlphaValue:0.0];
+    if (shouldAnimate) {
+        [viewOrWindow setAlphaValue:0.0];
+        [titleView setAlphaValue:0.0];
+    }
     [previewWindow makeKeyAndOrderFront:nil];
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-        if (shouldAnimate == NO)
+        if (shouldAnimate == NO) {
             [context setDuration:0.0];
-        else
-            [[previewWindow animator] setAlphaValue:1.0];
+        } else {
+            [[viewOrWindow animator] setAlphaValue:1.0];
+            [[titleView animator] setAlphaValue:1.0];
+        }
         [[previewWindow animator] setFrame:rect display:YES];
     } completionHandler:^{
         DISPATCH_MAIN_AFTER_SEC(1.0, ^{
@@ -361,16 +376,19 @@
             [previewView goToNextPage:nil];
             DISPATCH_MAIN_AFTER_SEC(1.0 + [info duration], ^{
                 if ([previewWindow isKeyWindow])
-                [[self window] makeKeyWindow];
+                    [[self window] makeKeyWindow];
                 [NSAnimationContext runAnimationGroup:^(NSAnimationContext 
*context){
-                    if (shouldAnimate == NO)
+                    if (shouldAnimate == NO) {
                         [context setDuration:0.0];
-                    else
-                        [[previewWindow animator] setAlphaValue:0.0];
+                    } else {
+                        [[viewOrWindow animator] setAlphaValue:0.0];
+                        [[titleView animator] setAlphaValue:0.0];
+                    }
                     [[previewWindow animator] setFrame:targetRect display:YES];
                 } completionHandler:^{
                     [previewWindow orderOut:nil];
-                    [previewWindow setAlphaValue:1.0];
+                    [viewOrWindow setAlphaValue:1.0];
+                    [titleView setAlphaValue:1.0];
                 }];
             });
         });

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