|
@@ -154,7 +154,7 @@ export class DefaultViewer extends AbstractViewer {
|
|
|
/**
|
|
|
* Update Current Animation Speed
|
|
|
*/
|
|
|
- private _updateAnimationSpeed = (speed: string) => {
|
|
|
+ private _updateAnimationSpeed = (speed: string, paramsObject?: any) => {
|
|
|
let navbar = this.templateManager.getTemplate('navBar');
|
|
|
if (!navbar) return;
|
|
|
|
|
@@ -163,16 +163,21 @@ export class DefaultViewer extends AbstractViewer {
|
|
|
if (!this._isAnimationPaused) {
|
|
|
this._currentAnimation.restart();
|
|
|
}
|
|
|
- navbar.updateParams({
|
|
|
- selectedSpeed: speed + "x",
|
|
|
- });
|
|
|
+
|
|
|
+ if (paramsObject) {
|
|
|
+ paramsObject.selectedSpeed = speed + "x"
|
|
|
+ } else {
|
|
|
+ navbar.updateParams({
|
|
|
+ selectedSpeed: speed + "x",
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Update Current Animation Type
|
|
|
*/
|
|
|
- private _updateAnimationType = (label: string) => {
|
|
|
+ private _updateAnimationType = (label: string, paramsObject?: any) => {
|
|
|
let navbar = this.templateManager.getTemplate('navBar');
|
|
|
if (!navbar) return;
|
|
|
|
|
@@ -180,12 +185,15 @@ export class DefaultViewer extends AbstractViewer {
|
|
|
this._currentAnimation = this.sceneManager.models[0].setCurrentAnimationByName(label);
|
|
|
}
|
|
|
|
|
|
- navbar.updateParams({
|
|
|
- selectedAnimation: (this._animationList.indexOf(label) + 1),
|
|
|
- });
|
|
|
+ if (paramsObject) {
|
|
|
+ paramsObject.selectedAnimation = (this._animationList.indexOf(label) + 1)
|
|
|
+ } else {
|
|
|
+ navbar.updateParams({
|
|
|
+ selectedAnimation: (this._animationList.indexOf(label) + 1),
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- // reset speed when a new animation is selected
|
|
|
- this._updateAnimationSpeed("1.0");
|
|
|
+ this._updateAnimationSpeed("1.0", paramsObject);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -224,19 +232,26 @@ export class DefaultViewer extends AbstractViewer {
|
|
|
let navbar = this.templateManager.getTemplate('navBar');
|
|
|
if (!navbar) return;
|
|
|
|
|
|
- if (model.getAnimationNames().length >= 1) {
|
|
|
+ let newParams: any = {};
|
|
|
+
|
|
|
+ let animationNames = model.getAnimationNames();
|
|
|
+ if (animationNames.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,
|
|
|
- });
|
|
|
+ this._animationList = animationNames;
|
|
|
+ newParams.animations = this._animationList;
|
|
|
+ newParams.paused = this._isAnimationPaused;
|
|
|
+ let animationIndex = 0;
|
|
|
+ if (model.configuration.animation && model.configuration.animation.autoStartIndex) {
|
|
|
+ animationIndex = model.configuration.animation.autoStartIndex;
|
|
|
+ }
|
|
|
+ this._updateAnimationSpeed("1.0", newParams);
|
|
|
+ this._updateAnimationType(animationNames[animationIndex]);
|
|
|
+ }
|
|
|
|
|
|
- // default animation & speed
|
|
|
- this._updateAnimationSpeed("1.0");
|
|
|
- this._updateAnimationType(this._animationList[0]);
|
|
|
+ if (model.configuration.thumbnail) {
|
|
|
+ newParams.logoImage = model.configuration.thumbnail
|
|
|
}
|
|
|
- let modelConfiguration = model.configuration;
|
|
|
+ navbar.updateParams(newParams);
|
|
|
}
|
|
|
|
|
|
/**
|