Files
cappuccino/AppKit/CoreAnimation/_CPObjectAnimator.j
T
bedaltonandcacaodev 53a52da709 Fixed: _CPObjectAnimator initialize method did not match superclass return (#2743)
* Fixed: _CPObjectAnimator initialize method did not match superclass return

_CPObject animator labeled return type as BOOL, not only is this value not returned, but the super class CPProxy's initialize method returns void. Changed return type to void in _CPObject animator, to match superclass
2018-08-03 08:28:05 +02:00

93 lines
2.1 KiB
Plaintext

@import <Foundation/CPProxy.j>
@import "CPAnimationContext.j"
var _supportsCSSAnimations = null;
@protocol CPAnimatablePropertyContainer <CPObject>
+ (id)defaultAnimationForKey:(CPString)key;
- (id)animationForKey:(CPString)key;
- (id)animator;
- (CPDictionary)animations;
- (void)setAnimations:(CPDictionary)animations;
@end
@implementation _CPObjectAnimator : CPProxy
{
id <CPAnimatablePropertyContainer> _target;
}
+ (void)initialize
{
if ([self class] !== [_CPObjectAnimator class])
return;
var compat = (CPBrowserCSSProperty("animation") !== nil);
CPSetPlatformFeature(CPCSSAnimationFeature, compat);
}
- (id)initWithTarget:(id)aTarget
{
_target = aTarget;
return self;
}
- (id)animator
{
return self;
}
- (BOOL)isEqual:(id)anObject
{
return [_target isEqual:anObject];
}
- (id)forwardingTargetForSelector:(SEL)aSelector
{
return _target;
}
- (CPMethodSignature)methodSignatureForSelector:(SEL)aSelector
{
return [_target methodSignatureForSelector:aSelector];
}
- (void)forwardInvocation:(CPInvocation)anInvocation
{
var target = [self forwardingTargetForSelector:[anInvocation selector]];
[anInvocation invokeWithTarget:target];
return;
}
- (void)doesNotRecognizeSelector:(SEL)aSelector
{
[CPException raise:CPInvalidArgumentException reason:@"Animator does not recognize selector " + CPStringFromSelector(aSelector)];
}
- (CPString)description
{
return [CPString stringWithFormat:@"%@ Animator Proxy for %@", [self class], _target];
}
- (void)setValue:(id)aTargetValue forKey:(id)aKeyPath
{
var animation = [_target animationForKey:aKeyPath],
context = [CPAnimationContext currentContext];
if (!animation || ![animation isKindOfClass:[CAAnimation class]] || (![context duration] && ![animation duration]) || !CPFeatureIsCompatible(CPCSSAnimationFeature))
[_target setValue:aTargetValue forKey:aKeyPath];
else
{
[context _enqueueActionForObject:_target keyPath:aKeyPath targetValue:aTargetValue animationCompletion:function()
{
[_target setValue:aTargetValue forKey:aKeyPath];
}];
}
}
@end