David Catuhe пре 6 година
родитељ
комит
85290e0941

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


+ 12 - 21
dist/preview release/inspector/babylon.inspector.bundle.js

@@ -38968,9 +38968,7 @@ var Inspector = /** @class */ (function () {
                 extensibilityGroups: options.explorerExtensibility,
                 noExpand: !options.enablePopup, popupMode: options.popup, onPopup: function () {
                     react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](_this._SceneExplorerHost);
-                    if (_this._SceneExplorerHost && _this._SceneExplorerHost.parentElement) {
-                        _this._SceneExplorerHost.parentElement.removeChild(_this._SceneExplorerHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._SceneExplorerHost);
                     if (options.popup) {
                         _this._SceneExplorerWindow.close();
                     }
@@ -38982,9 +38980,7 @@ var Inspector = /** @class */ (function () {
                 }, onClose: function () {
                     react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](_this._SceneExplorerHost);
                     Inspector._OpenedPane--;
-                    if (_this._SceneExplorerHost && _this._SceneExplorerHost.parentElement) {
-                        _this._SceneExplorerHost.parentElement.removeChild(_this._SceneExplorerHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._SceneExplorerHost);
                     _this._Cleanup();
                     if (options.popup) {
                         _this._SceneExplorerWindow.close();
@@ -39022,9 +39018,7 @@ var Inspector = /** @class */ (function () {
             var actionTabsElement = react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_components_actionTabs_actionTabsComponent__WEBPACK_IMPORTED_MODULE_2__["ActionTabsComponent"], {
                 globalState: this._GlobalState, scene: scene, noExpand: !options.enablePopup, popupMode: options.popup, onPopup: function () {
                     react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](_this._ActionTabsHost);
-                    if (_this._ActionTabsHost && _this._ActionTabsHost.parentElement) {
-                        _this._ActionTabsHost.parentElement.removeChild(_this._ActionTabsHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._ActionTabsHost);
                     if (options.popup) {
                         _this._ActionTabsWindow.close();
                     }
@@ -39037,9 +39031,7 @@ var Inspector = /** @class */ (function () {
                     react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](_this._ActionTabsHost);
                     Inspector._OpenedPane--;
                     _this._Cleanup();
-                    if (_this._ActionTabsHost && _this._ActionTabsHost.parentElement) {
-                        _this._ActionTabsHost.parentElement.removeChild(_this._ActionTabsHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._ActionTabsHost);
                     if (options.popup) {
                         _this._ActionTabsWindow.close();
                     }
@@ -39077,9 +39069,7 @@ var Inspector = /** @class */ (function () {
                     if (options.popup) {
                         _this._EmbedHostWindow.close();
                     }
-                    if (_this._EmbedHost && _this._EmbedHost.parentElement) {
-                        _this._EmbedHost.parentElement.removeChild(_this._EmbedHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._EmbedHost);
                     options.popup = !options.popup;
                     options.embedMode = true;
                     options.showExplorer = true;
@@ -39090,9 +39080,7 @@ var Inspector = /** @class */ (function () {
                     react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](_this._EmbedHost);
                     _this._OpenedPane = 0;
                     _this._Cleanup();
-                    if (_this._EmbedHost && _this._EmbedHost.parentElement) {
-                        _this._EmbedHost.parentElement.removeChild(_this._EmbedHost);
-                    }
+                    _this._RemoveElementFromDOM(_this._EmbedHost);
                     if (options.popup) {
                         _this._EmbedHostWindow.close();
                     }
@@ -39256,12 +39244,15 @@ var Inspector = /** @class */ (function () {
             this._Scene.getEngine().resize();
         }
     };
+    Inspector._RemoveElementFromDOM = function (element) {
+        if (element && element.parentElement) {
+            element.parentElement.removeChild(element);
+        }
+    };
     Inspector.Hide = function () {
         if (this._ActionTabsHost) {
             react_dom__WEBPACK_IMPORTED_MODULE_1__["unmountComponentAtNode"](this._ActionTabsHost);
-            if (this._ActionTabsHost.parentElement) {
-                this._ActionTabsHost.parentElement.removeChild(this._ActionTabsHost);
-            }
+            this._RemoveElementFromDOM(this._ActionTabsHost);
             this._ActionTabsHost = null;
         }
         if (this._SceneExplorerHost) {

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


+ 51 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -70,6 +70,57 @@ declare module BabylonViewer {
     export let viewerGlobals: ViewerGlobals;
 }
 declare module BabylonViewer {
+    /**
+        * The viewer manager is the container for all viewers currently registered on this page.
+        * It is possible to have more than one viewer on a single page.
+        */
+    export class ViewerManager {
+            /**
+                * A callback that will be triggered when a new viewer was added
+                */
+            onViewerAdded: (viewer: AbstractViewer) => void;
+            /**
+                * Will notify when a new viewer was added
+                */
+            onViewerAddedObservable: BABYLON.Observable<AbstractViewer>;
+            /**
+                * Will notify when a viewer was removed (disposed)
+                */
+            onViewerRemovedObservable: BABYLON.Observable<string>;
+            constructor();
+            /**
+                * Adding a new viewer to the viewer manager and start tracking it.
+                * @param viewer the viewer to add
+                */
+            addViewer(viewer: AbstractViewer): void;
+            /**
+                * remove a viewer from the viewer manager
+                * @param viewer the viewer to remove
+                */
+            removeViewer(viewer: AbstractViewer): void;
+            /**
+                * Get a viewer by its baseId (if the container element has an ID, it is the this is. if not, a random id was assigned)
+                * @param id the id of the HTMl element (or the viewer's, if none provided)
+                */
+            getViewerById(id: string): AbstractViewer;
+            /**
+                * Get a viewer using a container element
+                * @param element the HTML element to search viewers associated with
+                */
+            getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
+            /**
+                * Get a promise that will fullfil when this viewer was initialized.
+                * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
+                * you will get the viewer after everything was already configured.
+                * @param id the viewer id to find
+                */
+            getViewerPromiseById(id: string): Promise<AbstractViewer>;
+            /**
+                * dispose the manager and all of its associated viewers
+                */
+            dispose(): void;
+    }
+    export let viewerManager: ViewerManager;
 }
 declare module BabylonViewer {
     /**

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


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


+ 53 - 1
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -94,7 +94,59 @@ declare module 'babylonjs-viewer/configuration/globals' {
 }
 
 declare module 'babylonjs-viewer/viewer/viewerManager' {
-    
+    import { Observable } from 'babylonjs';
+    import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
+    /**
+        * The viewer manager is the container for all viewers currently registered on this page.
+        * It is possible to have more than one viewer on a single page.
+        */
+    export class ViewerManager {
+            /**
+                * A callback that will be triggered when a new viewer was added
+                */
+            onViewerAdded: (viewer: AbstractViewer) => void;
+            /**
+                * Will notify when a new viewer was added
+                */
+            onViewerAddedObservable: Observable<AbstractViewer>;
+            /**
+                * Will notify when a viewer was removed (disposed)
+                */
+            onViewerRemovedObservable: Observable<string>;
+            constructor();
+            /**
+                * Adding a new viewer to the viewer manager and start tracking it.
+                * @param viewer the viewer to add
+                */
+            addViewer(viewer: AbstractViewer): void;
+            /**
+                * remove a viewer from the viewer manager
+                * @param viewer the viewer to remove
+                */
+            removeViewer(viewer: AbstractViewer): void;
+            /**
+                * Get a viewer by its baseId (if the container element has an ID, it is the this is. if not, a random id was assigned)
+                * @param id the id of the HTMl element (or the viewer's, if none provided)
+                */
+            getViewerById(id: string): AbstractViewer;
+            /**
+                * Get a viewer using a container element
+                * @param element the HTML element to search viewers associated with
+                */
+            getViewerByHTMLElement(element: HTMLElement): AbstractViewer | undefined;
+            /**
+                * Get a promise that will fullfil when this viewer was initialized.
+                * Since viewer initialization and template injection is asynchronous, using the promise will guaranty that
+                * you will get the viewer after everything was already configured.
+                * @param id the viewer id to find
+                */
+            getViewerPromiseById(id: string): Promise<AbstractViewer>;
+            /**
+                * dispose the manager and all of its associated viewers
+                */
+            dispose(): void;
+    }
+    export let viewerManager: ViewerManager;
 }
 
 declare module 'babylonjs-viewer/viewer/defaultViewer' {

+ 3 - 3
sandbox/index.html

@@ -77,10 +77,10 @@
                 </a>
             </div>
         </div>
+        <div id="logo">
+        </div>
+        <div id="errorZone"></div>
     </div>
-    <div id="logo">
-    </div>
-    <div id="errorZone"></div>
     <script src="index.js"></script>
 </body>