Browse Source

Merge pull request #1629 from wyklion/master

animation stop bug. and canvas2d stopAnimation when dispose.
David Catuhe 8 years ago
parent
commit
d1fa418251
2 changed files with 4 additions and 3 deletions
  1. 1 0
      canvas2D/src/Engine/babylon.prim2dBase.ts
  2. 3 3
      src/Animations/babylon.animatable.ts

+ 1 - 0
canvas2D/src/Engine/babylon.prim2dBase.ts

@@ -3134,6 +3134,7 @@
                 this._actionManager.dispose();
                 this._actionManager = null;
             }
+            this.owner.scene.stopAnimation(this);
 
             // If there's a parent, remove this object from its parent list
             if (this._parent) {

+ 3 - 3
src/Animations/babylon.animatable.ts

@@ -99,9 +99,9 @@
         }
 
         public stop(animationName?: string): void {
-            var index = this._scene._activeAnimatables.indexOf(this);
+            var idx = this._scene._activeAnimatables.indexOf(this);
 
-            if (index > -1) {
+            if (idx > -1) {
                 var animations = this._animations;
                 var numberOfAnimationsStopped = 0;
                 for (var index = animations.length - 1; index >= 0; index--) {
@@ -114,7 +114,7 @@
                 }
 
                 if (animations.length == numberOfAnimationsStopped) {
-                    this._scene._activeAnimatables.splice(index, 1);
+                    this._scene._activeAnimatables.splice(idx, 1);
 
                     if (this.onAnimationEnd) {
                         this.onAnimationEnd();