Changed how AnimationDelegateImpl is created to be in sync with the new approach

This commit is contained in:
Tsvetan Raikov
2016-02-03 14:52:29 +02:00
parent a0020453e5
commit dbfa09f8ef

View File

@ -12,19 +12,17 @@ var _skip = "_skip";
var FLT_MAX = 340282346638528859811704183484516925440.000000; var FLT_MAX = 340282346638528859811704183484516925440.000000;
class AnimationDelegateImpl extends NSObject { class AnimationDelegateImpl extends NSObject {
static new(): AnimationDelegateImpl {
return <AnimationDelegateImpl>super.new();
}
public nextAnimation: Function; public nextAnimation: Function;
private _finishedCallback: Function; private _finishedCallback: Function;
private _propertyAnimation: common.PropertyAnimation; private _propertyAnimation: common.PropertyAnimation;
public initWithFinishedCallback(finishedCallback: Function, propertyAnimation: common.PropertyAnimation): AnimationDelegateImpl { public static initWithFinishedCallback(finishedCallback: Function, propertyAnimation: common.PropertyAnimation): AnimationDelegateImpl {
this._finishedCallback = finishedCallback; let delegate = <AnimationDelegateImpl>AnimationDelegateImpl.new();
this._propertyAnimation = propertyAnimation; delegate._finishedCallback = finishedCallback;
return this; delegate._propertyAnimation = propertyAnimation;
return delegate;
} }
animationDidStart(anim: CAAnimation): void { animationDidStart(anim: CAAnimation): void {
@ -242,7 +240,7 @@ export class Animation extends common.Animation implements definition.Animation
nativeAnimation.timingFunction = animation.curve; nativeAnimation.timingFunction = animation.curve;
} }
var animationDelegate: AnimationDelegateImpl = AnimationDelegateImpl.new().initWithFinishedCallback(finishedCallback, animation); var animationDelegate: AnimationDelegateImpl = AnimationDelegateImpl.initWithFinishedCallback(finishedCallback, animation);
nativeAnimation.setValueForKey(animationDelegate, "delegate"); nativeAnimation.setValueForKey(animationDelegate, "delegate");
nativeView.layer.addAnimationForKey(nativeAnimation, null); nativeView.layer.addAnimationForKey(nativeAnimation, null);