Skip to content
Snippets Groups Projects
Commit 73a883df authored by David Sehnal's avatar David Sehnal
Browse files

mol-plugin: fixed a bug where behaviors were not assigned correct default params

parent 21aae7ec
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,7 @@ function getLabelsText(data: LabelsData, props: PD.Values<Text.Params>, text?: T ...@@ -74,6 +74,7 @@ function getLabelsText(data: LabelsData, props: PD.Values<Text.Params>, text?: T
export const SceneLabels = PluginBehavior.create<SceneLabelsProps>({ export const SceneLabels = PluginBehavior.create<SceneLabelsProps>({
name: 'scene-labels', name: 'scene-labels',
display: { name: 'Scene Labels', group: 'Labels' }, display: { name: 'Scene Labels', group: 'Labels' },
canAutoUpdate: () => true,
ctor: class extends PluginBehavior.Handler<SceneLabelsProps> { ctor: class extends PluginBehavior.Handler<SceneLabelsProps> {
private data: LabelsData = { private data: LabelsData = {
transforms: [Mat4.identity()], transforms: [Mat4.identity()],
......
...@@ -136,7 +136,7 @@ export class PluginContext { ...@@ -136,7 +136,7 @@ export class PluginContext {
const tree = this.state.behaviorState.tree.build(); const tree = this.state.behaviorState.tree.build();
for (const b of this.spec.behaviors) { for (const b of this.spec.behaviors) {
tree.toRoot().apply(b.transformer, b.defaultParams || { }, { ref: b.transformer.id }); tree.toRoot().apply(b.transformer, b.defaultParams, { ref: b.transformer.id });
} }
await this.runTask(this.state.behaviorState.update(tree)); await this.runTask(this.state.behaviorState.update(tree));
......
...@@ -14,8 +14,6 @@ import { PluginSpec } from './spec'; ...@@ -14,8 +14,6 @@ import { PluginSpec } from './spec';
import { DownloadStructure, CreateComplexRepresentation, OpenStructure } from './state/actions/basic'; import { DownloadStructure, CreateComplexRepresentation, OpenStructure } from './state/actions/basic';
import { StateTransforms } from './state/transforms'; import { StateTransforms } from './state/transforms';
import { PluginBehaviors } from './behavior'; import { PluginBehaviors } from './behavior';
import { ParamDefinition as PD } from 'mol-util/param-definition'
import { SceneLabelsParams } from './behavior/dynamic/labels';
function getParam(name: string, regex: string): string { function getParam(name: string, regex: string): string {
let r = new RegExp(`${name}=(${regex})[&]?`, 'i'); let r = new RegExp(`${name}=(${regex})[&]?`, 'i');
...@@ -40,7 +38,7 @@ const DefaultSpec: PluginSpec = { ...@@ -40,7 +38,7 @@ const DefaultSpec: PluginSpec = {
PluginSpec.Behavior(PluginBehaviors.Representation.DefaultLociLabelProvider), PluginSpec.Behavior(PluginBehaviors.Representation.DefaultLociLabelProvider),
PluginSpec.Behavior(PluginBehaviors.Camera.FocusLociOnSelect, { minRadius: 20, extraRadius: 4 }), PluginSpec.Behavior(PluginBehaviors.Camera.FocusLociOnSelect, { minRadius: 20, extraRadius: 4 }),
PluginSpec.Behavior(PluginBehaviors.Animation.StructureAnimation, { rotate: false, rotateValue: 0, explode: false, explodeValue: 0 }), PluginSpec.Behavior(PluginBehaviors.Animation.StructureAnimation, { rotate: false, rotateValue: 0, explode: false, explodeValue: 0 }),
PluginSpec.Behavior(PluginBehaviors.Labels.SceneLabels, { ...PD.getDefaultValues(SceneLabelsParams) }), // TODO how to properly call PluginBehaviors.Labels.SceneLabels.definition.params() PluginSpec.Behavior(PluginBehaviors.Labels.SceneLabels),
PluginSpec.Behavior(PluginBehaviors.CustomProps.PDBeStructureQualityReport, { autoAttach: true }), PluginSpec.Behavior(PluginBehaviors.CustomProps.PDBeStructureQualityReport, { autoAttach: true }),
PluginSpec.Behavior(PluginBehaviors.CustomProps.RCSBAssemblySymmetry, { autoAttach: true }), PluginSpec.Behavior(PluginBehaviors.CustomProps.RCSBAssemblySymmetry, { autoAttach: true }),
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment