Browse Source

Hide method implemented correctly

Temechon 8 years ago
parent
commit
715a9fc8c0
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/Debug/babylon.debugLayer.ts

+ 10 - 3
src/Debug/babylon.debugLayer.ts

@@ -5,7 +5,9 @@ module BABYLON {
 
     export class DebugLayer {
         private _scene: Scene;
-        public static InspectorURL = 'http://www.babylonjs.com/babylon.inspector.bundle.js'
+        public static InspectorURL = 'http://www.babylonjs.com/babylon.inspector.bundle.js';
+        // The inspector instance
+        private _inspector : any;
 
         constructor(scene: Scene) {
             this._scene = scene;
@@ -13,7 +15,9 @@ module BABYLON {
 
         /** Creates the inspector window. */
         private _createInspector() {
-            new INSPECTOR.Inspector(this._scene);
+            if (!this._inspector) {
+                this._inspector = new INSPECTOR.Inspector(this._scene);
+            } // else nothing to do,; instance is already existing
         }
         
         public isVisible(): boolean {
@@ -21,7 +25,10 @@ module BABYLON {
         }
 
         public hide() {
-            console.warn('')
+            if (this._inspector) {
+                this._inspector.dispose();
+                this._inspector = null;
+            }
         }
         
         public show() {