ngl
ngl copied to clipboard
Select the entire molecule by clicking on its atom
How to implement the behavior: highlight a molecule and display information about all its atoms when you click on an atom in this molecule?
I guess what I need to use:
stage.signals.clicked.add((pickingProxy: any) => {
if (pickingProxy && (pickingProxy.atom || pickingProxy.bond)) {
const atom = pickingProxy.atom || pickingProxy.closestBondAtom;
console.log(atom); // Update selected residues
}
});
but I don’t understand the implementation
Right, with this code atom
will be a reference to an AtomProxy object.
This object has many properties which are useful to get the element name, the corresponding residue and chain, etc...