Przeglądaj źródła

Changing config to params, fixing basicExample

Raanan Weber 7 lat temu
rodzic
commit
73b057820d

+ 1 - 1
Viewer/dist/basicExample.html

@@ -18,7 +18,7 @@
 
     <body>
         <babylon model.title="Amazing Rabbit" model.subtitle="BabylonJS" model.thumbnail="https://www.babylonjs.com/img/favicon/apple-icon-144x144.png"
-            model.url="https://playground.babylonjs.com/scenes/Rabbit.babylon" default-viewer="true" template.children.viewer.children.nav-bar.config.disable-on-fullscreen="true"></babylon>
+            model.url="https://playground.babylonjs.com/scenes/Rabbit.babylon" default-viewer="true" templates.nav-bar.params.disable-on-fullscreen="true"></babylon>
         <script src="viewer.js"></script>
     </body>
 

Plik diff jest za duży
+ 3 - 3
Viewer/src/configuration/configuration.ts


+ 2 - 2
Viewer/src/templateManager.ts

@@ -6,7 +6,7 @@ export interface ITemplateConfiguration {
     location?: string; // #template-id OR http://example.com/loading.html
     html?: string; // raw html string
     id?: string;
-    config?: { [key: string]: string | number | boolean | object };
+    params?: { [key: string]: string | number | boolean | object };
     events?: {
         // pointer events
         pointerdown?: boolean | Array<string>;
@@ -180,7 +180,7 @@ export class Template {
         this.initPromise = htmlContentPromise.then(htmlTemplate => {
             if (htmlTemplate) {
                 let compiledTemplate = Handlebars.compile(htmlTemplate);
-                let config = this._configuration.config || {};
+                let config = this._configuration.params || {};
                 let rawHtml = compiledTemplate(config);
                 this.fragment = document.createRange().createContextualFragment(rawHtml);
                 this.isLoaded = true;

+ 5 - 1
Viewer/src/viewer/defaultViewer.ts

@@ -42,11 +42,15 @@ export class DefaultViewer extends AbstractViewer {
                 navbar.parent.style.bottom = show ? '0px' : '-' + navbarHeight;
                 navbarShown = show;
             } else {
+                let visibilityTimeout = 2000;
+                if (navbar.configuration.params && navbar.configuration.params.visibilityTimeout !== undefined) {
+                    visibilityTimeout = <number>navbar.configuration.params.visibilityTimeout;
+                }
                 // not showing? set timeout until it is removed.
                 timeoutCancel = setTimeout(function () {
                     navbar.parent.style.bottom = '-' + navbarHeight;
                     navbarShown = show;
-                }, navbar.configuration.config ? navbar.configuration.config.visibilityTimeout || 2000 : 2000);
+                }, visibilityTimeout);
             }
         }