From e9ae8063db75ac5e9644bde4fe9842de0b9ab59e Mon Sep 17 00:00:00 2001 From: cacaodev Date: Fri, 13 Mar 2015 18:52:05 +0100 Subject: [PATCH] Allow nil completionFunction and fix fallback == nil --- AppKit/CoreAnimation/CPAnimationContext.j | 4 ++-- AppKit/CoreAnimation/CPViewAnimator.j | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AppKit/CoreAnimation/CPAnimationContext.j b/AppKit/CoreAnimation/CPAnimationContext.j index 256b07ad9..a096525a2 100644 --- a/AppKit/CoreAnimation/CPAnimationContext.j +++ b/AppKit/CoreAnimation/CPAnimationContext.j @@ -130,7 +130,7 @@ CPLog.debug(_cmd + "context stack =" + _CPAnimationContextStack); var animByKeyPath = _animationsByObject.get(anObject); if (!animByKeyPath) { - var newAnimByKeyPath = [CPDictionary dictionaryWithObject:resolvedAction forKey:aKeyPath]; + var newAnimByKeyPath = @{aKeyPath:resolvedAction}; _animationsByObject.put(anObject, newAnimByKeyPath); } else @@ -163,7 +163,7 @@ CPLog.debug(_cmd + "context stack =" + _CPAnimationContextStack); { if (needsFrameTimer) [self stopFrameUpdaterWithIdentifier:objectId]; - else + else if (animationCompletion) animationCompletion(); if (_completionHandlerAgent) diff --git a/AppKit/CoreAnimation/CPViewAnimator.j b/AppKit/CoreAnimation/CPViewAnimator.j index b15071c08..e9ef83098 100644 --- a/AppKit/CoreAnimation/CPViewAnimator.j +++ b/AppKit/CoreAnimation/CPViewAnimator.j @@ -65,9 +65,10 @@ var animation = [_target animationForKey:aKeyPath], context = [CPAnimationContext currentContext]; - if ((!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || ![_CPObjectAnimator supportsCSSAnimations]) && fallback !== nil) + if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || ![_CPObjectAnimator supportsCSSAnimations]) { - fallback(); + if (fallback) + fallback(); } else {