瀏覽代碼

Inspector : Rename "onGlobalPropertyChange" to "onPropertyChangedObservable"

Jaskar 7 年之前
父節點
當前提交
12dbad59ff
共有 3 個文件被更改,包括 6 次插入14 次删除
  1. 4 4
      inspector/src/details/Property.ts
  2. 1 1
      inspector/test/index.js
  3. 1 9
      src/Debug/babylon.debugLayer.ts

+ 4 - 4
inspector/src/details/Property.ts

@@ -28,7 +28,7 @@ module INSPECTOR {
         public set value(newValue: any) {
             if (newValue != undefined && this._obj[this._property] != undefined) {
                 if (this._obj instanceof BABYLON.Scene) {
-                    (<BABYLON.Scene>this._obj).debugLayer.onGlobalPropertyChangeCallback({
+                    (<BABYLON.Scene>this._obj).debugLayer.onPropertyChangedObservable.notifyObservers({
                         object: this._obj,
                         property: this._property,
                         value: newValue,
@@ -40,7 +40,7 @@ module INSPECTOR {
                         // Object that have "children" properties : Color, Vector, imageProcessingConfiguration
 
                         if (this._parentObj instanceof BABYLON.Scene) {
-                            (<BABYLON.Scene>this._parentObj).debugLayer.onGlobalPropertyChangeCallback({
+                            (<BABYLON.Scene>this._parentObj).debugLayer.onPropertyChangedObservable.notifyObservers({
                                 object: this._parentObj,
                                 property: this._property,
                                 value: newValue,
@@ -48,7 +48,7 @@ module INSPECTOR {
                             });
                         }
                         else {
-                            this._parentObj.getScene().debugLayer.onGlobalPropertyChangeCallback({
+                            this._parentObj.getScene().debugLayer.onPropertyChangedObservable.notifyObservers({
                                 object: this._parentObj,
                                 property: this._property,
                                 value: newValue,
@@ -57,7 +57,7 @@ module INSPECTOR {
                         }
                     }
                     else {
-                        this._obj.getScene().debugLayer.onGlobalPropertyChangeCallback({
+                        this._obj.getScene().debugLayer.onPropertyChangedObservable.notifyObservers({
                             object: this._obj,
                             property: this._property,
                             value: newValue,

+ 1 - 1
inspector/test/index.js

@@ -85,7 +85,7 @@ var Test = (function () {
         scene.createDefaultCameraOrLight(true);
         scene.activeCamera.attachControl(canvas);
         scene.debugLayer.show();
-        scene.debugLayer.onGlobalPropertyChange.push((result) => {
+        scene.debugLayer.onPropertyChangedObservable.add((result) => {
             console.log(result.object);
             console.log("Property : " + result.property);
             console.log("New value : " + result.value);

+ 1 - 9
src/Debug/babylon.debugLayer.ts

@@ -12,13 +12,11 @@ module BABYLON {
 
         private BJSINSPECTOR = typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
 
-        public onGlobalPropertyChange: Array<Function>;
+        public onPropertyChangedObservable = new Observable<{ object: any, property: string, value: any, initialValue: any }>();
 
         constructor(scene: Scene) {
             this._scene = scene;
             // load inspector using require, if it doesn't exist on the global namespace.
-
-            this.onGlobalPropertyChange = new Array<Function>();
         }
 
         /** Creates the inspector window. */
@@ -116,11 +114,5 @@ module BABYLON {
         public getActiveTab(): number {
             return this._inspector ? this._inspector.getActiveTabIndex() : -1;
         }
-
-        public onGlobalPropertyChangeCallback(result: {}) {
-            this.onGlobalPropertyChange.forEach((callback) => {
-                callback(result);
-            });
-        }
     }
 }