David Catuhe 9 anos atrás
pai
commit
118661598d

Diferenças do arquivo suprimidas por serem muito extensas
+ 22 - 22
dist/preview release/babylon.core.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 8624 - 8612
dist/preview release/babylon.d.ts


Diferenças do arquivo suprimidas por serem muito extensas
+ 39 - 39
dist/preview release/babylon.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 429 - 425
dist/preview release/babylon.max.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 38 - 38
dist/preview release/babylon.noworker.js


+ 7 - 7
src/Canvas2d/babylon.prim2dBase.js

@@ -1494,7 +1494,7 @@ var BABYLON;
                     return;
                 }
                 this._position = value;
-                this.markAsDirty("actualPosition");
+                this._triggerPropertyChanged(Prim2DBase.actualPositionProperty, value);
             },
             enumerable: true,
             configurable: true
@@ -1521,8 +1521,8 @@ var BABYLON;
                     return;
                 }
                 this._position.x = value;
-                this.markAsDirty("position");
-                this.markAsDirty("actualPosition");
+                this._triggerPropertyChanged(Prim2DBase.positionProperty, value);
+                this._triggerPropertyChanged(Prim2DBase.actualPositionProperty, value);
             },
             enumerable: true,
             configurable: true
@@ -1549,8 +1549,8 @@ var BABYLON;
                     return;
                 }
                 this._position.y = value;
-                this.markAsDirty("position");
-                this.markAsDirty("actualPosition");
+                this._triggerPropertyChanged(Prim2DBase.positionProperty, value);
+                this._triggerPropertyChanged(Prim2DBase.actualPositionProperty, value);
             },
             enumerable: true,
             configurable: true
@@ -1602,7 +1602,7 @@ var BABYLON;
                     return;
                 }
                 this.size.width = value;
-                this.markAsDirty("size");
+                this._triggerPropertyChanged(Prim2DBase.sizeProperty, value);
                 this._positioningDirty();
             },
             enumerable: true,
@@ -1628,7 +1628,7 @@ var BABYLON;
                     return;
                 }
                 this.size.height = value;
-                this.markAsDirty("size");
+                this._triggerPropertyChanged(Prim2DBase.sizeProperty, value);
                 this._positioningDirty();
             },
             enumerable: true,

+ 2 - 8
src/Canvas2d/babylon.smartPropertyPrim.js

@@ -277,20 +277,14 @@ var BABYLON;
             }
             return false;
         };
-        SmartPropertyPrim.prototype.markAsDirty = function (propertyName) {
+        SmartPropertyPrim.prototype._triggerPropertyChanged = function (propInfo, newValue) {
             if (this.isDisposed) {
                 return;
             }
-            var i = propertyName.indexOf(".");
-            if (i !== -1) {
-                propertyName = propertyName.substr(0, i);
-            }
-            var propInfo = this.propDic.get(propertyName);
             if (!propInfo) {
                 return;
             }
-            var newValue = this[propertyName];
-            this._handlePropChanged(undefined, newValue, propertyName, propInfo, propInfo.typeLevelCompare);
+            this._handlePropChanged(undefined, newValue, propInfo.name, propInfo, propInfo.typeLevelCompare);
         };
         SmartPropertyPrim.prototype._boundingBoxDirty = function () {
             this._setFlags(SmartPropertyPrim.flagLevelBoundingInfoDirty);

+ 7 - 6
src/Mesh/babylon.geometry.js

@@ -505,13 +505,14 @@ var BABYLON;
             }
             return geometry.copy(id);
         };
-        // from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
-        // be aware Math.random() could cause collisions
+        /**
+         * You should now use Tools.RandomId(), this method is still here for legacy reasons.
+         * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
+         * Be aware Math.random() could cause collisions, but:
+         * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
+         */
         Geometry.RandomId = function () {
-            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
-                var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
-                return v.toString(16);
-            });
+            return BABYLON.Tools.RandomId();
         };
         Geometry.ImportGeometry = function (parsedGeometry, mesh) {
             var scene = mesh.getScene();

+ 11 - 0
src/Tools/babylon.tools.js

@@ -639,6 +639,17 @@ var BABYLON;
             }
             return false;
         };
+        /**
+         * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523
+         * Be aware Math.random() could cause collisions, but:
+         * "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
+         */
+        Tools.RandomId = function () {
+            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+                var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
+                return v.toString(16);
+            });
+        };
         Object.defineProperty(Tools, "NoneLogLevel", {
             get: function () {
                 return Tools._NoneLogLevel;