From faf5eb586ab335be1490dea6207144f7a4788fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Doncam=20Demian=20L=C3=B3pez=20Brante?= Date: Wed, 27 Dec 2017 18:51:44 -0800 Subject: [PATCH] Implement proper fullscreen enter and exit animations. --- Application/AppController.m | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/Application/AppController.m b/Application/AppController.m index 2b02a736c..798200245 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -472,16 +472,23 @@ NSRect contentRect = [contentView frame]; const NSSize windowSize = [contentView convertSize:[mainWindow frame].size fromView: nil]; - NSRect nowPlayingFrame = [[nowPlaying view] frame]; - nowPlayingFrame.size.width = windowSize.width; - [[nowPlaying view] setFrame: nowPlayingFrame]; - [contentView addSubview: [nowPlaying view]]; - [[nowPlaying view] setFrameOrigin: NSMakePoint(0.0, NSMaxY(contentRect) - nowPlayingFrame.size.height)]; + [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { + [context setDuration:0.25]; + NSRect nowPlayingFrame = [[nowPlaying view] frame]; + nowPlayingFrame.size.width = windowSize.width; + [[nowPlaying view] setFrame: nowPlayingFrame]; + [[nowPlaying view] setFrameOrigin: NSMakePoint(0.0, NSMaxY(contentRect) - nowPlayingFrame.size.height)]; + + NSRect mainViewFrame = [mainView frame]; + mainViewFrame.size.height -= nowPlayingFrame.size.height; + [[mainView animator] setFrame:mainViewFrame]; + + } completionHandler:^{ + + }]; + - NSRect mainViewFrame = [mainView frame]; - mainViewFrame.size.height -= nowPlayingFrame.size.height; - [mainView setFrame:mainViewFrame]; [[nowPlaying text] bind:@"value" toObject:currentEntryController withKeyPath:@"content.display" options:nil]; } @@ -495,11 +502,17 @@ NSRect nowPlayingFrame = [[nowPlaying view] frame]; NSRect mainViewFrame = [mainView frame]; mainViewFrame.size.height += nowPlayingFrame.size.height; - [mainView setFrame:mainViewFrame]; + //[mainView setFrame:mainViewFrame]; // [mainView setFrameOrigin:NSMakePoint(0.0, 0.0)]; - [[nowPlaying view] removeFromSuperview]; - nowPlaying = nil; + [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { + [context setDuration:0.25]; + [[mainView animator] setFrame:mainViewFrame]; + + } completionHandler:^{ + [[nowPlaying view] removeFromSuperview]; + nowPlaying = nil; + }]; } }