@@ -27,7 +27,7 @@ import {
27
27
setVectorOnList
28
28
} from '../../../../reducers/selection/actions' ;
29
29
import { setCountOfRemainingMoleculeGroups , setMoleculeOrientations } from '../../../../reducers/ngl/actions' ;
30
- import { setMolGroupList , setMolGroupOn } from '../../../../reducers/api/actions' ;
30
+ import { setMolGroupList , setMolGroupOn , setMolGroupOff } from '../../../../reducers/api/actions' ;
31
31
import { getUrl , loadFromServer } from '../../../../utils/genericList' ;
32
32
import { OBJECT_TYPE } from '../../../nglView/constants' ;
33
33
import { setSortDialogOpen } from '../../molecule/redux/actions' ;
@@ -43,7 +43,13 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup
43
43
44
44
let site ;
45
45
const state = getState ( ) ;
46
- const vector_list = state . selectionReducers . vector_list ;
46
+ const { fragmentDisplayList, complexList, proteinList, surfaceList, vectorOnList, vector_list } = state . selectionReducers ;
47
+
48
+ const actionFragmentDisplayList = [ ] ;
49
+ const actionComplexList = [ ] ;
50
+ const actionProteinList = [ ] ;
51
+ const actionSurfaceList = [ ] ;
52
+ const actionVectorOnList = [ ] ;
47
53
48
54
// loop through all molecules
49
55
selectJoinedMoleculeList ( state ) . forEach ( mol => {
@@ -69,7 +75,20 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup
69
75
)
70
76
) ;
71
77
} ) ;
78
+
79
+ if ( fragmentDisplayList . find ( ligand => ligand === mol . id ) ) actionFragmentDisplayList . push ( mol ) ;
80
+ if ( complexList . find ( ligand => ligand === mol . id ) ) actionComplexList . push ( mol ) ;
81
+ if ( proteinList . find ( ligand => ligand === mol . id ) ) actionProteinList . push ( mol ) ;
82
+ if ( surfaceList . find ( ligand => ligand === mol . id ) ) actionSurfaceList . push ( mol ) ;
83
+ if ( vectorOnList . find ( ligand => ligand === mol . id ) ) actionVectorOnList . push ( mol ) ;
72
84
} ) ;
85
+ dispatch ( setMolGroupOff ( molGroupId , {
86
+ ligand : actionFragmentDisplayList ,
87
+ protein : actionProteinList ,
88
+ complex : actionComplexList ,
89
+ surface : actionSurfaceList ,
90
+ vector : actionVectorOnList
91
+ } ) ) ;
73
92
74
93
// remove all Vectors
75
94
vector_list
@@ -87,15 +106,15 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup
87
106
currentMolGroup . mol_id . forEach ( moleculeID => {
88
107
// remove Ligand, Complex, Vectors from selection
89
108
//Ligand
90
- dispatch ( removeFromFragmentDisplayList ( { id : moleculeID } ) ) ;
109
+ dispatch ( removeFromFragmentDisplayList ( { id : moleculeID } , true ) ) ;
91
110
// Complex
92
- dispatch ( removeFromComplexList ( { id : moleculeID } ) ) ;
111
+ dispatch ( removeFromComplexList ( { id : moleculeID } , true ) ) ;
93
112
// Protein
94
- dispatch ( removeFromProteinList ( { id : moleculeID } ) ) ;
113
+ dispatch ( removeFromProteinList ( { id : moleculeID } , true ) ) ;
95
114
// Surface
96
- dispatch ( removeFromSurfaceList ( { id : moleculeID } ) ) ;
115
+ dispatch ( removeFromSurfaceList ( { id : moleculeID } , true ) ) ;
97
116
// Vectors
98
- dispatch ( removeFromVectorOnList ( { id : moleculeID } ) ) ;
117
+ dispatch ( removeFromVectorOnList ( { id : moleculeID } , true ) ) ;
99
118
} ) ;
100
119
} ;
101
120
0 commit comments