Skip to content

Commit

Permalink
#1249 fixed inconsistent coloring of rendered objects on activating R…
Browse files Browse the repository at this point in the history
…HS/LHS compound buttons
  • Loading branch information
matej-vavrek committed Jan 17, 2024
1 parent 5168efe commit a7e655b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ const DatasetMoleculeView = memo(
}
const moleculeTitleNext = nextItem && nextItem.name;

let dataValue = { colourToggle, isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };
let dataValue = { isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };

dispatch(setCrossReferenceCompoundName(moleculeTitleNext));
if (setRef && ref.current) {
Expand Down Expand Up @@ -778,7 +778,7 @@ const DatasetMoleculeView = memo(
}
const moleculeTitleNext = nextItem && nextItem.name;

let dataValue = { colourToggle, isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };
let dataValue = { isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };

dispatch(setCrossReferenceCompoundName(moleculeTitleNext));
if (setRef && ref.current) {
Expand Down Expand Up @@ -819,7 +819,7 @@ const DatasetMoleculeView = memo(
}
const moleculeTitlePrev = previousItem && previousDatasetID.name;

let dataValue = { colourToggle, isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };
let dataValue = { isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };

dispatch(setCrossReferenceCompoundName(moleculeTitlePrev));
if (setRef && ref.current) {
Expand Down Expand Up @@ -865,7 +865,7 @@ const DatasetMoleculeView = memo(
}
const moleculeTitlePrev = previousItem && previousItem.name;

let dataValue = { colourToggle, isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };
let dataValue = { isLigandOn, isProteinOn, isComplexOn, isSurfaceOn };

dispatch(setCrossReferenceCompoundName(moleculeTitlePrev));
if (setRef && ref.current) {
Expand Down
16 changes: 8 additions & 8 deletions js/components/datasets/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,34 +1320,34 @@ export const moveSelectedMoleculeSettings = (
const promises = [];
if (newItem && data) {
if (data.isLigandOn) {
let representations = getRepresentationsByType(data.objectsInView, item, OBJECT_TYPE.LIGAND, datasetID);
let representations = getRepresentationsByType(data.objectsInView, newItem, OBJECT_TYPE.LIGAND, datasetID);
promises.push(
dispatch(
addDatasetLigand(stage, newItem, data.colourToggle, datasetIdOfMolecule, skipTracking, representations)
addDatasetLigand(stage, newItem, getRandomColor(newItem), datasetIdOfMolecule, skipTracking, representations)
)
);
}
if (data.isProteinOn) {
let representations = getRepresentationsByType(data.objectsInView, item, OBJECT_TYPE.PROTEIN, datasetID);
let representations = getRepresentationsByType(data.objectsInView, newItem, OBJECT_TYPE.PROTEIN, datasetID);
promises.push(
dispatch(
addDatasetHitProtein(stage, newItem, data.colourToggle, datasetIdOfMolecule, skipTracking, representations)
addDatasetHitProtein(stage, newItem, getRandomColor(newItem), datasetIdOfMolecule, skipTracking, representations)
)
);
}
if (data.isComplexOn) {
let representations = getRepresentationsByType(data.objectsInView, item, OBJECT_TYPE.COMPLEX, datasetID);
let representations = getRepresentationsByType(data.objectsInView, newItem, OBJECT_TYPE.COMPLEX, datasetID);
promises.push(
dispatch(
addDatasetComplex(stage, newItem, data.colourToggle, datasetIdOfMolecule, skipTracking, representations)
addDatasetComplex(stage, newItem, getRandomColor(newItem), datasetIdOfMolecule, skipTracking, representations)
)
);
}
if (data.isSurfaceOn) {
let representations = getRepresentationsByType(data.objectsInView, item, OBJECT_TYPE.SURFACE, datasetID);
let representations = getRepresentationsByType(data.objectsInView, newItem, OBJECT_TYPE.SURFACE, datasetID);
promises.push(
dispatch(
addDatasetSurface(stage, newItem, data.colourToggle, datasetIdOfMolecule, skipTracking, representations)
addDatasetSurface(stage, newItem, getRandomColor(newItem), datasetIdOfMolecule, skipTracking, representations)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ const ObservationCmpView = memo(
const disableMoleculeNglControlButtons =
useSelector(state => state.previewReducers.molecule.disableNglControlButtons[currentID]) || {};

const colourToggle = getRandomColor(data);
const colourToggle = getRandomColor(getFirstObservation());

const getCalculatedProps = useCallback(
() => [
Expand Down

0 comments on commit a7e655b

Please sign in to comment.