Explorar o código

Merge pull request #2085 from bghgary/animatable-lazy-var-init-fix

Fix lazy variable initialization bug in animatable class
David Catuhe %!s(int64=8) %!d(string=hai) anos
pai
achega
f41a7800b2
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      src/Animations/babylon.animatable.ts

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

@@ -1,7 +1,7 @@
 module BABYLON {
     export class Animatable {
-        private _localDelayOffset: number;
-        private _pausedDelay: number;
+        private _localDelayOffset: number = null;
+        private _pausedDelay: number = null;
         private _animations = new Array<Animation>();
         private _paused = false;
         private _scene: Scene;
@@ -149,15 +149,15 @@
         public _animate(delay: number): boolean {
             if (this._paused) {
                 this.animationStarted = false;
-                if (!this._pausedDelay) {
+                if (this._pausedDelay === null) {
                     this._pausedDelay = delay;
                 }
                 return true;
             }
 
-            if (!this._localDelayOffset) {
+            if (this._localDelayOffset === null) {
                 this._localDelayOffset = delay;
-            } else if (this._pausedDelay) {
+            } else if (this._pausedDelay !== null) {
                 this._localDelayOffset += delay - this._pausedDelay;
                 this._pausedDelay = null;
             }