@@ -19,7 +19,8 @@ import {
19
19
updateVectorCompounds ,
20
20
updateBondColorMapOfCompounds ,
21
21
resetBondColorMapOfVectors ,
22
- setCurrentVector
22
+ setCurrentVector ,
23
+ setHideAll
23
24
} from '../../../../reducers/selection/actions' ;
24
25
import { base_url } from '../../../routes/constants' ;
25
26
import {
@@ -115,11 +116,11 @@ const handleVector = (json, stage, data) => (dispatch, getState) => {
115
116
dispatch ( updateBondColorMapOfCompounds ( data . smiles , vectorBondColorMap ) ) ;
116
117
} ;
117
118
118
- export const addVector = ( stage , data ) => async ( dispatch , getState ) => {
119
+ export const addVector = ( stage , data , skipTracking = false ) => async ( dispatch , getState ) => {
119
120
const currentVector = getState ( ) . selectionReducers . currentVector ;
120
121
121
122
dispatch ( incrementCountOfPendingVectorLoadRequests ( ) ) ;
122
- dispatch ( appendVectorOnList ( generateMoleculeId ( data ) ) ) ;
123
+ dispatch ( appendVectorOnList ( generateMoleculeId ( data ) , skipTracking ) ) ;
123
124
dispatch ( selectVectorAndResetCompounds ( currentVector ) ) ;
124
125
125
126
return api ( { url : getViewUrl ( 'graph' , data ) } )
@@ -226,7 +227,7 @@ export const removeComplex = (stage, data, colourToggle, skipTracking = false) =
226
227
dispatch ( removeFromComplexList ( generateMoleculeId ( data ) , skipTracking ) ) ;
227
228
} ;
228
229
229
- export const addSurface = ( stage , data , colourToggle ) => dispatch => {
230
+ export const addSurface = ( stage , data , colourToggle , skipTracking = false ) => dispatch => {
230
231
dispatch (
231
232
loadObject ( {
232
233
target : Object . assign ( { display_div : VIEWS . MAJOR_VIEW } , generateSurfaceObject ( data , colourToggle , base_url ) ) ,
@@ -237,17 +238,17 @@ export const addSurface = (stage, data, colourToggle) => dispatch => {
237
238
const currentOrientation = stage . viewerControls . getOrientation ( ) ;
238
239
dispatch ( setOrientation ( VIEWS . MAJOR_VIEW , currentOrientation ) ) ;
239
240
} ) ;
240
- dispatch ( appendSurfaceList ( generateMoleculeId ( data ) ) ) ;
241
+ dispatch ( appendSurfaceList ( generateMoleculeId ( data ) , skipTracking ) ) ;
241
242
} ;
242
243
243
- export const removeSurface = ( stage , data , colourToggle ) => dispatch => {
244
+ export const removeSurface = ( stage , data , colourToggle , skipTracking = false ) => dispatch => {
244
245
dispatch (
245
246
deleteObject (
246
247
Object . assign ( { display_div : VIEWS . MAJOR_VIEW } , generateSurfaceObject ( data , colourToggle , base_url ) ) ,
247
248
stage
248
249
)
249
250
) ;
250
- dispatch ( removeFromSurfaceList ( generateMoleculeId ( data ) ) ) ;
251
+ dispatch ( removeFromSurfaceList ( generateMoleculeId ( data ) , skipTracking ) ) ;
251
252
} ;
252
253
253
254
export const addDensity = ( stage , data , colourToggle ) => dispatch => {
@@ -330,39 +331,51 @@ export const hideAllSelectedMolecules = (stage, currentMolecules) => (dispatch,
330
331
const vectorOnList = state . selectionReducers . vectorOnList ;
331
332
const surfaceList = state . selectionReducers . surfaceList ;
332
333
const proteinList = state . selectionReducers . proteinList ;
334
+ const vectorList = state . selectionReducers . vector_list ;
335
+
336
+ let ligandDataList = [ ] ;
337
+ let complexDataList = [ ] ;
338
+ let vectorOnDataList = [ ] ;
339
+ let surfaceDataList = [ ] ;
340
+ let proteinDataList = [ ] ;
333
341
334
342
fragmentDisplayList . forEach ( moleculeId => {
335
343
const data = currentMolecules . find ( molecule => molecule . id === moleculeId ) ;
336
344
if ( data ) {
337
- dispatch ( removeLigand ( stage , data ) ) ;
345
+ ligandDataList . push ( data ) ;
346
+ dispatch ( removeLigand ( stage , data , true ) ) ;
338
347
}
339
348
} ) ;
340
349
complexList . forEach ( moleculeId => {
341
350
const data = currentMolecules . find ( molecule => molecule . id === moleculeId ) ;
342
351
if ( data ) {
343
- dispatch ( removeComplex ( stage , data , colourList [ 0 ] ) ) ;
352
+ complexDataList . push ( data ) ;
353
+ dispatch ( removeComplex ( stage , data , colourList [ 0 ] , true ) ) ;
344
354
}
345
355
} ) ;
346
356
vectorOnList . forEach ( moleculeId => {
347
357
const data = currentMolecules . find ( molecule => molecule . id === moleculeId ) ;
348
358
if ( data ) {
349
- dispatch ( removeVector ( stage , data ) ) ;
359
+ vectorOnDataList . push ( data ) ;
360
+ dispatch ( removeVector ( stage , data , true ) ) ;
350
361
}
351
362
} ) ;
352
363
353
364
// remove Surface
354
365
surfaceList . forEach ( moleculeId => {
355
366
const data = currentMolecules . find ( molecule => molecule . id === moleculeId ) ;
356
367
if ( data ) {
357
- dispatch ( removeSurface ( stage , data ) ) ;
368
+ surfaceDataList . push ( data ) ;
369
+ dispatch ( removeSurface ( stage , data , colourList [ 0 ] , true ) ) ;
358
370
}
359
371
} ) ;
360
372
361
373
// remove Protein
362
374
proteinList . forEach ( moleculeId => {
363
375
const data = currentMolecules . find ( molecule => molecule . id === moleculeId ) ;
364
376
if ( data ) {
365
- dispatch ( removeHitProtein ( stage , data ) ) ;
377
+ proteinDataList . push ( data ) ;
378
+ dispatch ( removeHitProtein ( stage , data , colourList [ 0 ] , true ) ) ;
366
379
}
367
380
} ) ;
368
381
@@ -371,6 +384,15 @@ export const hideAllSelectedMolecules = (stage, currentMolecules) => (dispatch,
371
384
dispatch ( resetCompoundsOfVectors ( ) ) ;
372
385
dispatch ( resetBondColorMapOfVectors ( ) ) ;
373
386
dispatch ( setCompoundImage ( noCompoundImage ) ) ;
387
+
388
+ let data = {
389
+ ligandList : ligandDataList ,
390
+ proteinList : proteinDataList ,
391
+ complexList : complexDataList ,
392
+ surfaceList : surfaceDataList ,
393
+ vectorOnList : vectorOnDataList
394
+ } ;
395
+ dispatch ( setHideAll ( data ) ) ;
374
396
} ;
375
397
376
398
export const searchMoleculeGroupByMoleculeID = moleculeID => ( dispatch , getState ) =>
0 commit comments