nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
659 stars 168 forks source link

How to track a specific element in a complex presented by buffer #518

Open ilyiaZhao opened 6 years ago

ilyiaZhao commented 6 years ago

I use sphere buffer to show up thousands of proteins and the spheres do show up. I map the position and the protein id. I want to use mouseclick to get the position of a specific sphere, so that to return the protein id. However I meet a problem that it is hard for me to click at the specific center pos of the sphere.

ilyiaZhao commented 6 years ago

I notice that in your gallery, if load the elements one by one, the viewer will show tags for each element. However, if use the buffer, no tags showing up. I tried a small test for my case by loading a few elements one by one, and figure out that when the cursor passes by the target object with the tag showing up, and click it will return the correct position. So I also wonder that is it available show up these tags when using the buffer? if so , how?

arose commented 6 years ago

Could you give an example on CodePen (https://codepen.io/pen?template=JNLMXb) of what your are trying to do?

ilyiaZhao commented 6 years ago

https://codepen.io/ilyiaZhao/pen/XqpvwN?&editors=001 The link above show is the elements add on one by one, without using buffer. And when the mouse move on an element, a tag of the element will show. And when a tag show up, we click it, the protein structure will show up.

https://codepen.io/ilyiaZhao/pen/PepYoV?&editors=001 However, when I load the element by buffer, no tags show up when the mouse clicking around, so it is harder to click to the correct position so that we can get the protein structure showing up.

arose commented 6 years ago

If you use the buffer approach, the labels and picking of individual elements (e.g. spheres) is not supported.