Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions JNWAnimatableWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,24 @@ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen {
#pragma mark Convenince Window Methods

- (void)orderOutWithDuration:(CFTimeInterval)duration timing:(CAMediaTimingFunction *)timing animations:(void (^)(CALayer *))animations {


// let setup finished then start animate
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
[self setupIfNeeded];
} completionHandler:^{
// The fake window is in the exact same position as the real one, so we can safely order ourself out.
[super orderOut:nil];
[self performAnimations:animations withDuration:duration timing:timing];
}];

/*
[self setupIfNeeded];

// The fake window is in the exact same position as the real one, so we can safely order ourself out.
[super orderOut:nil];
[self performAnimations:animations withDuration:duration timing:timing];
*/
}

- (void)orderOutWithAnimation:(CAAnimation *)animation {
Expand All @@ -272,6 +285,20 @@ - (void)orderOutWithAnimation:(CAAnimation *)animation {

- (void)makeKeyAndOrderFrontWithDuration:(CFTimeInterval)duration timing:(CAMediaTimingFunction *)timing
setup:(void (^)(CALayer *))setup animations:(void (^)(CALayer *))animations {

// let setup finished then start animate
[NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {
[self setupIfNeededWithSetupBlock:setup];
} completionHandler:^{
// Avoid unnecessary layout passes if we're already visible when this method is called. This could take place if the window
// is still being animated out, but the user suddenly changes their mind and the window needs to come back on screen again.
if (!self.isVisible)
[super makeKeyAndOrderFront:nil];

[self performAnimations:animations withDuration:duration timing:timing];
}];

/*
[self setupIfNeededWithSetupBlock:setup];

// Avoid unnecessary layout passes if we're already visible when this method is called. This could take place if the window
Expand All @@ -280,6 +307,7 @@ - (void)makeKeyAndOrderFrontWithDuration:(CFTimeInterval)duration timing:(CAMedi
[super makeKeyAndOrderFront:nil];

[self performAnimations:animations withDuration:duration timing:timing];
*/
}

- (void)makeKeyAndOrderFrontWithAnimation:(CAAnimation *)animation initialOpacity:(CGFloat)opacity {
Expand Down