Skip to content
Snippets Groups Projects
Commit 27ebbc50 authored by Alexander Rose's avatar Alexander Rose
Browse files

allow animation button to be hidden

parent 2a1b6e52
Branches
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ class PluginAnimationManager extends StatefulPluginComponent<PluginAnimationMana
}
updateParams(newParams: Partial<PluginAnimationManager.State['params']>) {
if (this.isEmpty) return;
this.updateState({ params: { ...this.state.params, ...newParams } });
const anim = this.map.get(this.state.params.current)!;
const params = anim.params(this.context) as PD.Params;
......@@ -59,6 +60,7 @@ class PluginAnimationManager extends StatefulPluginComponent<PluginAnimationMana
}
updateCurrentParams(values: any) {
if (this.isEmpty) return;
this._current.paramValues = { ...this._current.paramValues, ...values };
this.triggerUpdate();
}
......@@ -163,6 +165,7 @@ class PluginAnimationManager extends StatefulPluginComponent<PluginAnimationMana
}
setSnapshot(snapshot: PluginAnimationManager.Snapshot) {
if (this.isEmpty) return;
this.updateState({ animationState: snapshot.state.animationState });
this.updateParams(snapshot.state.params);
......
......@@ -29,6 +29,7 @@ import { StructureMeasurementsControls } from './structure/measurements';
import { StructureSelectionActionsControls } from './structure/selection';
import { StructureSourceControls } from './structure/source';
import { VolumeStreamingControls, VolumeSourceControls } from './structure/volume';
import { PluginConfig } from '../mol-plugin/config';
export class TrajectoryViewportControls extends PluginUIComponent<{}, { show: boolean, label: string }> {
state = { show: false, label: '' }
......@@ -219,9 +220,8 @@ export class AnimationViewportControls extends PluginUIComponent<{}, { isEmpty:
}
render() {
// if (!this.state.show) return null;
const isPlaying = this.plugin.managers.snapshot.state.isPlaying;
if (isPlaying || this.state.isEmpty) return null;
if (isPlaying || this.state.isEmpty || this.plugin.managers.animation.isEmpty || !this.plugin.config.get(PluginConfig.Viewport.ShowAnimation)) return null;
const isAnimating = this.state.isAnimating;
......
......@@ -34,7 +34,8 @@ export const PluginConfig = {
},
Viewport: {
ShowExpand: item('viewer.show-expand-button', true),
ShowSelectionMode: item('viewer.show-selection-model-button', true)
ShowSelectionMode: item('viewer.show-selection-model-button', true),
ShowAnimation: item('viewer.show-animation-button', true),
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment