From 73a883dfbae5688b0607973e4cbd42057ab67baf Mon Sep 17 00:00:00 2001
From: David Sehnal <david.sehnal@gmail.com>
Date: Tue, 5 Feb 2019 14:06:28 +0100
Subject: [PATCH] mol-plugin: fixed a bug where behaviors were not assigned
 correct default params

---
 src/mol-plugin/behavior/dynamic/labels.ts | 1 +
 src/mol-plugin/context.ts                 | 2 +-
 src/mol-plugin/index.ts                   | 4 +---
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mol-plugin/behavior/dynamic/labels.ts b/src/mol-plugin/behavior/dynamic/labels.ts
index f71717893..f30f4464e 100644
--- a/src/mol-plugin/behavior/dynamic/labels.ts
+++ b/src/mol-plugin/behavior/dynamic/labels.ts
@@ -74,6 +74,7 @@ function getLabelsText(data: LabelsData, props: PD.Values<Text.Params>, text?: T
 export const SceneLabels = PluginBehavior.create<SceneLabelsProps>({
     name: 'scene-labels',
     display: { name: 'Scene Labels', group: 'Labels' },
+    canAutoUpdate: () => true,
     ctor: class extends PluginBehavior.Handler<SceneLabelsProps> {
         private data: LabelsData = {
             transforms: [Mat4.identity()],
diff --git a/src/mol-plugin/context.ts b/src/mol-plugin/context.ts
index 069805cb0..6de25de94 100644
--- a/src/mol-plugin/context.ts
+++ b/src/mol-plugin/context.ts
@@ -136,7 +136,7 @@ export class PluginContext {
         const tree = this.state.behaviorState.tree.build();
 
         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));
diff --git a/src/mol-plugin/index.ts b/src/mol-plugin/index.ts
index 55eed51e3..169ab4037 100644
--- a/src/mol-plugin/index.ts
+++ b/src/mol-plugin/index.ts
@@ -14,8 +14,6 @@ import { PluginSpec } from './spec';
 import { DownloadStructure, CreateComplexRepresentation, OpenStructure } from './state/actions/basic';
 import { StateTransforms } from './state/transforms';
 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 {
     let r = new RegExp(`${name}=(${regex})[&]?`, 'i');
@@ -40,7 +38,7 @@ const DefaultSpec: PluginSpec = {
         PluginSpec.Behavior(PluginBehaviors.Representation.DefaultLociLabelProvider),
         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.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.RCSBAssemblySymmetry, { autoAttach: true }),
     ]
-- 
GitLab