Open cleblond opened 9 months ago
The molecule can be retrieved by accessing the parent
property recursively on atom or bond, or by calling the getStandaloneAncestor()
function e.g.:
chemViewer.addEventListener('hotTrackOnObjects', e => {
let hotTrackedMolecules = [];
e.objects.forEach(obj => {
if (obj.getStandaloneAncestor)
Kekule.ArrayUtils.pushUnique(hotTrackedMolecules, obj.getStandaloneAncestor());
});
chemViewer.setHotTrackedObjects(hotTrackedMolecules);
});
getStandaloneAncestor did the trick. Thank you!
I want to hover over a molecule in a chemViewer, have it highlighted and then run some code based on the molecule hovered over. I have been playing with hot tracking event but it seems to focus on atoms and bonds, not molecules.
Kekule.X.Event.addListener(chemViewer, 'hotTrackOnObjects', function(e) {
console.log(e]); // if molecule A is selected run code });
Thank you for your help! Carl