ソースを参照

Fixed auto start bug & animation length bug & default to no help

Szeyin Lee 7 年 前
コミット
443b6c4d91

+ 3 - 6
Viewer/assets/templates/default/navbar.html

@@ -297,12 +297,7 @@
         justify-content: space-between;
     }
 </style>
-{{/if}}
-<style>
-    nav-bar .fullscreen {
-        margin-left: 4px;
-    }
-</style> {{/if}}
+{{/if}} {{/if}}
 
 <div class="nav-container" id="navbar-control">
     {{#unless hideLogo}}
@@ -316,7 +311,9 @@
                 <span class="icon types-icon"></span>
                 <span class="control-text animation-label">Animation</span>
                 <span class="control-text animation-number">{{selectedAnimation}}</span>
+                {{#if (gt (count animations) 1)}}
                 <span class="icon up-icon"></span>
+                {{/if}}
             </button>
             <div class="menu-options">
                 {{#each animations}} {{#unless (eq ../selectedAnimation (add @index 1))}}

+ 2 - 1
Viewer/src/configuration/types/default.ts

@@ -35,7 +35,8 @@ export let defaultConfiguration: ViewerConfiguration = {
                     "2.0x": "2.0",
                 },
                 logoImg: require('../../../assets/img/BabylonJS_logo_Small.png'),
-                logoText: 'BabylonJS'
+                logoText: 'BabylonJS',
+                hideHelp: true,
             },
             events: {
                 pointerdown: {

+ 9 - 0
Viewer/src/templateManager.ts

@@ -262,6 +262,15 @@ Handlebars.registerHelper('not', function (a) {
     return out;
 });
 
+Handlebars.registerHelper('count', function (map) {
+    return map.length;
+});
+
+Handlebars.registerHelper('gt', function (a, b) {
+    var out = a > b;
+    return out;
+});
+
 /**
  * This class represents a single template in the viewer's template tree.
  * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.

+ 2 - 2
Viewer/src/viewer/defaultViewer.ts

@@ -225,17 +225,17 @@ export class DefaultViewer extends AbstractViewer {
         if (!navbar) return;
 
         if (model.getAnimationNames().length >= 1) {
+            this._isAnimationPaused = (model.configuration.animation && !model.configuration.animation.autoStart) || !model.configuration.animation;
             this._animationList = model.getAnimationNames(),
                 navbar.updateParams({
                     animations: this._animationList,
+                    paused: this._isAnimationPaused,
                 });
 
             // default animation & speed
             this._updateAnimationSpeed("1.0");
-            this._isAnimationPaused = !!(model.configuration.animation && model.configuration.animation.autoStart);
             this._updateAnimationType(this._animationList[0]);
         }
-
         let modelConfiguration = model.configuration;
     }