Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render3dMol() {
if (!this.glviewer && Molecule3d.isModelDataEmpty(this.props.modelData)) {
return;
}
const glviewer = this.glviewer || $3Dmol.createViewer(jQuery(this.container), {
defaultcolors: $3Dmol.elementColors.rasmol,
});
const renderingSameModelData = moleculeUtils.modelDataEquivalent(
this.oldModelData, this.props.modelData
);
if (!renderingSameModelData) {
this.lastStylesByAtom = null;
Molecule3d.render3dMolModel(glviewer, this.props.modelData);
}
const styleUpdates = Object.create(null); // style update strings to atom ids needed
const stylesByAtom = Object.create(null); // all atom ids to style string
this.props.modelData.atoms.forEach((atom, i) => {
const selected = this.state.selectedAtomIds.indexOf(atom.serial) !== -1;
const libStyle = libUtils.getLibStyle(
atom, selected, this.props.atomLabelsShown, this.props.styles[i]