3dmol / 3Dmol.js

WebGL accelerated JavaScript molecular graphics library
https://3dmol.org/
Other
801 stars 194 forks source link

[BUG] Atom click handlers sometimes get erroneously triggered #481

Closed andfaulkner closed 3 years ago

andfaulkner commented 3 years ago

Sometimes clicking locations where one atom is present triggers the click handler for another atom. Other times, clicking an area with no atom present at all will trigger the handler on an atom.

I've attached a video demonstrating the issue including steps to produce it. The halos appear on clicking an atom in my 3DMol configuration. It tends to happen with larger, more complex molecules.

3dmol-bug-video.mp4.zip

Desktop:

dkoes commented 3 years ago

Can you please provide the structure and code used in the example?

andfaulkner commented 3 years ago

Here's the molecular structure used in the example: C111tiny.xyz.zip

As for the code...there are over 7000 lines across over 20 separate files used to instantiate that, since we have a custom UI wrapper around 3DMol (to implement various features involving re-rendering the 3DMol view with different characteristics changed, such as which atoms to highlight), so there isn't really a nice way to attach it.

However, it can be replicated with any 3DMol viewer that attaches click handlers to atoms and has said atoms respond in some way - nothing low-level has been touched on our end. I don't know if you have a setup like that already somewhere? i.e. some example where atoms respond to click handlers, and it's visible which atom was clicked?

dkoes commented 3 years ago

Yes, we do have a test for click handling, but it was using a spheres only representation and it turns out the issue was with sticks. This has now been fixed.

andfaulkner commented 3 years ago

Got it. What version is the fix in?

dkoes commented 3 years ago

1.6.1

andfaulkner commented 3 years ago

Great, I'll upgrade 👍

Thanks so much