Bladeren bron

Inspector - Fix bug when the header column width was not correct in popup mode

Temechon 8 jaren geleden
bovenliggende
commit
9b1a68c967

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


+ 2 - 0
dist/preview release/inspector/babylon.inspector.d.ts

@@ -12,6 +12,8 @@ declare module INSPECTOR {
         private _scene;
         /** The HTML document relative to this inspector (the window or the popup depending on its mode) */
         static DOCUMENT: HTMLDocument;
+        /** The HTML window. In popup mode, it's the popup itself. Otherwise, it's the current tab */
+        static WINDOW: Window;
         /** True if the inspector is built as a popup tab */
         private _popupMode;
         /** The original canvas style, before applying the inspector*/

+ 4 - 2
dist/preview release/inspector/babylon.inspector.js

@@ -11,8 +11,9 @@ var INSPECTOR;
             this._popupMode = false;
             // get canvas parent only if needed.
             this._scene = scene;
-            // Save HTML document
+            // Save HTML document and window
             Inspector.DOCUMENT = window.document;
+            Inspector.WINDOW = window;
             // POPUP MODE if parent is defined
             if (parent) {
                 // Build the inspector in the given parent
@@ -176,6 +177,7 @@ var INSPECTOR;
             this._popupMode = true;
             // Save the HTML document
             Inspector.DOCUMENT = popup.document;
+            Inspector.WINDOW = popup;
             // Build the inspector wrapper
             this._c2diwrapper = INSPECTOR.Helpers.CreateDiv('insp-wrapper', popup.document.body);
             // add inspector     
@@ -808,7 +810,7 @@ var INSPECTOR;
             // Create header row
             this._createHeaderRow();
             this._div.appendChild(this._headerRow);
-            window.addEventListener('resize', function (e) {
+            INSPECTOR.Inspector.WINDOW.addEventListener('resize', function (e) {
                 // adapt the header row max width according to its parent size;
                 _this._headerRow.style.maxWidth = _this._headerRow.parentElement.clientWidth + 'px';
             });

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/inspector/babylon.inspector.min.js


+ 6 - 2
inspector/src/Inspector.ts

@@ -15,6 +15,8 @@ module INSPECTOR {
         private _scene          : BABYLON.Scene;
         /** The HTML document relative to this inspector (the window or the popup depending on its mode) */
         public static DOCUMENT  : HTMLDocument;
+        /** The HTML window. In popup mode, it's the popup itself. Otherwise, it's the current tab */
+        public static WINDOW : Window;
         /** True if the inspector is built as a popup tab */
         private _popupMode      : boolean = false;
         /** The original canvas style, before applying the inspector*/
@@ -29,8 +31,9 @@ module INSPECTOR {
             // get canvas parent only if needed.
             this._scene     = scene;
             
-            // Save HTML document
-            Inspector.DOCUMENT = window.document;                       
+            // Save HTML document and window
+            Inspector.DOCUMENT = window.document;   
+            Inspector.WINDOW = window;                       
             
             // POPUP MODE if parent is defined
             if (parent) {    
@@ -209,6 +212,7 @@ module INSPECTOR {
             this._popupMode = true;
             // Save the HTML document
             Inspector.DOCUMENT = popup.document;
+            Inspector.WINDOW = popup;
             // Build the inspector wrapper
             this._c2diwrapper  = Helpers.CreateDiv('insp-wrapper', popup.document.body);
             // add inspector     

+ 1 - 1
inspector/src/details/DetailPanel.ts

@@ -37,7 +37,7 @@
             this._createHeaderRow();
             this._div.appendChild(this._headerRow);
             
-            window.addEventListener('resize', (e) => {
+            Inspector.WINDOW.addEventListener('resize', (e) => {
                 // adapt the header row max width according to its parent size;
                 this._headerRow.style.maxWidth = this._headerRow.parentElement.clientWidth+'px';
             });