Skip to content

Commit

Permalink
- checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Feb 5, 2025
1 parent 36a569b commit 4396015
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions js/reducers/ngl/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,25 @@ export const setOrientationByInteraction = (div_id, orientation) => (dispatch, g
}
};

export const centerOnLigandByMoleculeID = (stage, moleculeID) => (dispatch, getState) => {
export const centerOnLigandByMoleculeID = (stage, moleculeID, datasetId = null) => (dispatch, getState) => {
if (moleculeID && stage) {
const state = getState();
const all_mol_lists = state.apiReducers.all_mol_lists;
const observation = all_mol_lists.find(mol => mol.id === moleculeID);
let observation = null;
if (!datasetId) {
const all_mol_lists = state.apiReducers.all_mol_lists;
observation = all_mol_lists.find(mol => mol.id === moleculeID);
} else {
const datasetCompounds = state.datasetsReducers.moleculeLists[datasetId] || [];
observation = datasetCompounds.find(mol => mol.id === moleculeID);
}
if (observation) {
const colourToggle = getRandomColor(observation);
let obsObject = generateMoleculeObject(observation, colourToggle);
let obsObject = null;
if (!datasetId) {
obsObject = generateMoleculeObject(observation, colourToggle);
} else {
obsObject = generateMoleculeObject(observation, colourToggle, datasetId);
}
const component = stage.getComponentsByName(obsObject.name).first;
component?.autoView();
}
Expand Down

0 comments on commit 4396015

Please sign in to comment.