Sfoglia il codice sorgente

fixing an issue with contained viewers and body/html def

Raanan Weber 7 anni fa
parent
commit
c916967257

+ 4 - 0
Viewer/assets/templates/default/defaultTemplate.html

@@ -9,7 +9,10 @@
     .icon {
         font-family: "babylon";
     }
+</style>
 
+{{#if fillScreen}}
+<style>
     html,
     body {
         width: 100%;
@@ -19,5 +22,6 @@
         padding: 0;
     }
 </style>
+{{/if}}
 
 <fill-container></fill-container>

+ 0 - 1
Viewer/assets/templates/default/defaultViewer.html

@@ -3,7 +3,6 @@
         position: relative;
         overflow: hidden;
         /* Start stage */
-        flex: 1;
         z-index: 1;
         justify-content: center;
         align-items: center;

+ 1 - 1
Viewer/dist/ufoExample.html

@@ -16,7 +16,7 @@
     </head>
 
     <body>
-        <babylon extends="default, shadowDirectionalLight, environmentMap" templates.nav-bar.params.disable-on-fullscreen="true">
+        <babylon extends="default, shadowDirectionalLight, environmentMap" templates.main.params.fill-screen="true">
             <scene glow="true">
             </scene>
             <lab>

+ 6 - 4
Viewer/src/viewer/defaultViewer.ts

@@ -242,11 +242,13 @@ export class DefaultViewer extends AbstractViewer {
             newParams.animations = this._animationList;
             newParams.paused = this._isAnimationPaused;
             let animationIndex = 0;
-            if (model.configuration.animation && model.configuration.animation.autoStartIndex) {
-                animationIndex = model.configuration.animation.autoStartIndex;
+            if (model.configuration.animation && typeof model.configuration.animation.autoStart === 'string') {
+                animationIndex = animationNames.indexOf(model.configuration.animation.autoStart);
+                if (animationIndex === -1) {
+                    animationIndex = 0;
+                }
             }
-            this._updateAnimationSpeed("1.0", newParams);
-            this._updateAnimationType(animationNames[animationIndex]);
+            this._updateAnimationType(animationNames[animationIndex], newParams);
         }
 
         if (model.configuration.thumbnail) {