Browse Source

fix interactions/valence-model label behavior

Alexander Rose 5 years ago
parent
commit
4379d818ab

+ 2 - 1
src/mol-plugin/behavior/dynamic/custom-props/computed/interactions.ts

@@ -14,6 +14,7 @@ import StructureElement from '../../../../../mol-model/structure/structure/eleme
 import { OrderedSet } from '../../../../../mol-data/int';
 import { featureGroupLabel, featureTypeLabel } from '../../../../../mol-model-props/computed/interactions/common';
 import { Loci } from '../../../../../mol-model/loci';
+import { arraySetAdd } from '../../../../../mol-util/array';
 
 export const Interactions = PluginBehavior.create<{ autoAttach: boolean, showTooltip: boolean }>({
     name: 'computed-interactions-prop',
@@ -29,7 +30,7 @@ export const Interactions = PluginBehavior.create<{ autoAttach: boolean, showToo
                 const state = this.ctx.state.dataState
                 const selections = state.select(StateSelection.Generators.ofType(PluginStateObject.Molecule.Structure, root.transform.ref));
                 for (const s of selections) {
-                    if (s.obj) structures.push(s.obj.data)
+                    if (s.obj) arraySetAdd(structures, s.obj.data)
                 }
             }
             return structures

+ 2 - 1
src/mol-plugin/behavior/dynamic/custom-props/computed/valence-model.ts

@@ -13,6 +13,7 @@ import { StateSelection } from '../../../../../mol-state';
 import { Structure, StructureElement } from '../../../../../mol-model/structure';
 import { OrderedSet } from '../../../../../mol-data/int';
 import { geometryLabel } from '../../../../../mol-model-props/computed/chemistry/geometry';
+import { arraySetAdd } from '../../../../../mol-util/array';
 
 export const ValenceModel = PluginBehavior.create<{ autoAttach: boolean, showTooltip: boolean }>({
     name: 'computed-valence-model-prop',
@@ -28,7 +29,7 @@ export const ValenceModel = PluginBehavior.create<{ autoAttach: boolean, showToo
                 const state = this.ctx.state.dataState
                 const selections = state.select(StateSelection.Generators.ofType(PluginStateObject.Molecule.Structure, root.transform.ref));
                 for (const s of selections) {
-                    if (s.obj) structures.push(s.obj.data)
+                    if (s.obj) arraySetAdd(structures, s.obj.data)
                 }
             }
             return structures