Browse Source

do not auto-attach interactions in component manager

David Sehnal 5 years ago
parent
commit
8e6b0b220a
1 changed files with 2 additions and 6 deletions
  1. 2 6
      src/mol-plugin-state/manager/structure/component.ts

+ 2 - 6
src/mol-plugin-state/manager/structure/component.ts

@@ -13,7 +13,6 @@ import { PluginContext } from '../../../mol-plugin/context';
 import { StateBuilder, StateTransformer } from '../../../mol-state';
 import { Task } from '../../../mol-task';
 import { UUID } from '../../../mol-util';
-import { arraySetAdd } from '../../../mol-util/array';
 import { ColorNames } from '../../../mol-util/color/names';
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { StructureRepresentationPresetProvider } from '../../builder/structure/representation-preset';
@@ -88,12 +87,11 @@ class StructureComponentManager extends PluginComponent<StructureComponentManage
             const interactionParams = InteractionsProvider.getParams(s.cell.obj?.data!);
 
             if (s.properties) {
-                const params = s.properties.cell.transform.params;
-                if (PD.areEqual(interactionParams, params, this.state.options.interactions)) continue;
+                const oldParams = s.properties.cell.transform.params?.properties[InteractionsProvider.descriptor.name];
+                if (PD.areEqual(interactionParams, oldParams, this.state.options.interactions)) continue;
 
                 const b = this.dataState.build();
                 b.to(s.properties.cell).update(old => {
-                    arraySetAdd(old.autoAttach, InteractionsProvider.descriptor.name);
                     old.properties[InteractionsProvider.descriptor.name] = this.state.options.interactions;
                 });
                 await this.plugin.updateDataState(b);
@@ -101,8 +99,6 @@ class StructureComponentManager extends PluginComponent<StructureComponentManage
                 const pd = this.plugin.customStructureProperties.getParams(s.cell.obj?.data);
                 const params = PD.getDefaultValues(pd);
                 if (PD.areEqual(interactionParams, params.properties[InteractionsProvider.descriptor.name], this.state.options.interactions)) continue;
-
-                arraySetAdd(params.autoAttach, InteractionsProvider.descriptor.name);
                 params.properties[InteractionsProvider.descriptor.name] = this.state.options.interactions;
                 await this.plugin.builders.structure.insertStructureProperties(s.cell, params);
             }