Skip to content

Commit

Permalink
#190 remove selected ALCV items after deselecting of site
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-postek-m2ms committed Mar 26, 2020
1 parent 4cf33f0 commit b6175c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions js/components/nglView/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const toggleMoleculeGroup = (molGroupId, summaryViewStage, majorViewStage
dispatch(
clearAfterDeselectingMoleculeGroup({
molGroupId,
currentMolGroup,
majorViewStage
})
);
Expand Down
20 changes: 19 additions & 1 deletion js/components/preview/moleculeGroups/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import {
} from '../../../../reducers/ngl/dispatchActions';
import { getJoinedMoleculeList } from '../../molecule/redux/selectors';
import {
removeFromComplexList,
removeFromFragmentDisplayList,
removeFromVectorOnList,
resetSelectionState,
setComplexList,
setFilterSettings,
Expand All @@ -25,7 +28,10 @@ import { SCENES } from '../../../../reducers/ngl/constants';
import { setSortDialogOpen } from '../../molecule/redux/actions';
import { resetCurrentCompoundsSettings } from '../../compounds/redux/actions';

export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, majorViewStage }) => (dispatch, getState) => {
export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup, majorViewStage }) => (
dispatch,
getState
) => {
dispatch(setObjectSelection([molGroupId]));

let site;
Expand Down Expand Up @@ -66,6 +72,17 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, majorViewStage

// remove molecule orientation for given site
dispatch(removeMoleculeOrientation(site));

// remove all selected ALCV of given site
currentMolGroup.mol_id.forEach(moleculeID => {
// remove Ligand, Complex, Vectors from selection
//Ligand
dispatch(removeFromFragmentDisplayList({ id: moleculeID }));
// Complex
dispatch(removeFromComplexList({ id: moleculeID }));
// Vectors
dispatch(removeFromVectorOnList({ id: moleculeID }));
});
};

export const saveMoleculeGroupsToNglView = (molGroupList, stage) => dispatch => {
Expand Down Expand Up @@ -203,6 +220,7 @@ export const onSelectMoleculeGroup = ({ moleculeGroup, stageSummaryView, majorVi
dispatch(
clearAfterDeselectingMoleculeGroup({
molGroupId: moleculeGroup.id,
currentMolGroup,
majorViewStage
})
);
Expand Down

0 comments on commit b6175c8

Please sign in to comment.