David Catuhe пре 7 година
родитељ
комит
26c629e470

Разлика између датотеке није приказан због своје велике величине
+ 12014 - 12014
Playground/babylon.d.txt


Разлика између датотеке није приказан због своје велике величине
+ 16608 - 16608
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/babylon.js


+ 2 - 2
dist/preview release/babylon.max.js

@@ -9654,7 +9654,6 @@ var BABYLON;
         InternalPromise.prototype._resolve = function (value) {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 var returnedValue = null;
                 if (this._onFulfilled) {
                     returnedValue = this._onFulfilled(value);
@@ -9669,6 +9668,7 @@ var BABYLON;
                         value = returnedValue;
                     }
                 }
+                this._result = value;
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
                     child._resolve(value);
@@ -52552,11 +52552,11 @@ var BABYLON;
          */
         ParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {
             var particleEmitter = new BABYLON.BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
         // Clone

Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/babylon.worker.js


Разлика између датотеке није приказан због своје велике величине
+ 628 - 628
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 3 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 5 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -9654,7 +9654,6 @@ var BABYLON;
         InternalPromise.prototype._resolve = function (value) {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 var returnedValue = null;
                 if (this._onFulfilled) {
                     returnedValue = this._onFulfilled(value);
@@ -9669,6 +9668,7 @@ var BABYLON;
                         value = returnedValue;
                     }
                 }
+                this._result = value;
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
                     child._resolve(value);
@@ -52552,11 +52552,11 @@ var BABYLON;
          */
         ParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {
             var particleEmitter = new BABYLON.BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
         // Clone
@@ -96060,7 +96060,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

+ 5 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -9627,7 +9627,6 @@ var BABYLON;
         InternalPromise.prototype._resolve = function (value) {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 var returnedValue = null;
                 if (this._onFulfilled) {
                     returnedValue = this._onFulfilled(value);
@@ -9642,6 +9641,7 @@ var BABYLON;
                         value = returnedValue;
                     }
                 }
+                this._result = value;
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
                     child._resolve(value);
@@ -52525,11 +52525,11 @@ var BABYLON;
          */
         ParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {
             var particleEmitter = new BABYLON.BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
         // Clone
@@ -96033,7 +96033,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

+ 2 - 2
dist/preview release/es6.js

@@ -9627,7 +9627,6 @@ var BABYLON;
         InternalPromise.prototype._resolve = function (value) {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 var returnedValue = null;
                 if (this._onFulfilled) {
                     returnedValue = this._onFulfilled(value);
@@ -9642,6 +9641,7 @@ var BABYLON;
                         value = returnedValue;
                     }
                 }
+                this._result = value;
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
                     child._resolve(value);
@@ -52525,11 +52525,11 @@ var BABYLON;
          */
         ParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {
             var particleEmitter = new BABYLON.BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
         // Clone

+ 3 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1792,7 +1792,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 3 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -3990,7 +3990,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 3 - 1
dist/preview release/loaders/babylonjs.loaders.js

@@ -4973,7 +4973,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


Разлика између датотеке није приказан због своје велике величине
+ 10 - 10
dist/preview release/viewer/babylon.viewer.js


+ 5 - 3
dist/preview release/viewer/babylon.viewer.max.js

@@ -9737,7 +9737,6 @@ var BABYLON;
         InternalPromise.prototype._resolve = function (value) {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 var returnedValue = null;
                 if (this._onFulfilled) {
                     returnedValue = this._onFulfilled(value);
@@ -9752,6 +9751,7 @@ var BABYLON;
                         value = returnedValue;
                     }
                 }
+                this._result = value;
                 for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                     var child = _a[_i];
                     child._resolve(value);
@@ -52635,11 +52635,11 @@ var BABYLON;
          */
         ParticleSystem.prototype.createBoxEmitter = function (direction1, direction2, minEmitBox, maxEmitBox) {
             var particleEmitter = new BABYLON.BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         };
         // Clone
@@ -100526,7 +100526,9 @@ var BABYLON;
                 return (BABYLON.Tools.IsBase64(uri) || uri.indexOf("..") === -1);
             };
             GLTFLoader._GetDrawMode = function (context, mode) {
-                mode = mode || 4 /* TRIANGLES */;
+                if (mode == undefined) {
+                    mode = 4 /* TRIANGLES */;
+                }
                 switch (mode) {
                     case 0 /* POINTS */: return BABYLON.Material.PointListDrawMode;
                     case 1 /* LINES */: return BABYLON.Material.LineListDrawMode;

+ 1 - 1
src/Particles/babylon.particleSystem.ts

@@ -997,11 +997,11 @@
          */
         public createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter {
             var particleEmitter = new BoxParticleEmitter();
+            this.particleEmitterType = particleEmitter;
             this.direction1 = direction1;
             this.direction2 = direction2;
             this.minEmitBox = minEmitBox;
             this.maxEmitBox = maxEmitBox;
-            this.particleEmitterType = particleEmitter;
             return particleEmitter;
         }
 

+ 2 - 1
src/Tools/babylon.promise.ts

@@ -94,7 +94,6 @@ module BABYLON {
         private _resolve(value?: Nullable<T>): Nullable<InternalPromise<T>> | T {
             try {
                 this._state = PromiseStates.Fulfilled;
-                this._result = value;
                 let returnedValue: Nullable<InternalPromise<T>> | T = null;
 
                 if (this._onFulfilled) {
@@ -112,6 +111,8 @@ module BABYLON {
                     }
                 }
 
+                this._result = value;
+
                 for (var child of this._children) {
                     child._resolve(value);
                 }

+ 29 - 0
tests/unit/babylon/src/Tools/babylon.promise.tests.ts

@@ -122,6 +122,35 @@ describe('Babylon.Promise', function () {
 
             tempString += " second";
         });
+
+        it('should chain promises correctly #5', (done) => {
+            var tempString = "";
+            var promise = new Promise(function (resolve) {
+                setTimeout(function () {
+                    resolve(44);
+                }, 100);
+            });
+        
+            promise = promise.then(function () {
+                return 55;
+            });
+        
+            promise.then(function (value) {
+                tempString += "1: " + value;
+                setTimeout(function () {
+                    promise.then(function (value) {
+                        tempString += " 2: " + value;
+                        try {
+                            expect(tempString).to.eq("1: 55 2: 55");
+                            done();
+                        }
+                        catch(error) {
+                            done(error);
+                        }                        
+                    });
+                }, 0);
+            });
+        });
     });
 
     describe('#Promise.all', () => {