rcsb / rcsb-saguaro

1D Feature Viewer
MIT License
42 stars 12 forks source link

elementEnterCallBack not working for line or area displayType #26

Closed gabrielctn closed 2 years ago

gabrielctn commented 2 years ago

Hi ! I would like things to happen when hovering my tracks data. I saw on the documentation that there is a elementEnterCallBack that exists. It works for what I want to do, except for line and area display types, which is a bit frustrating because it is specifically for these tracks that it would be important. Do you think it could be implemented easily ?

I created a codepen based on yours, "Click callback", to illustrate. As you can see, the positions are printed when hovering SEQUENCE, BLOCK and BOND tracks, but not AREA.

bioinsilico commented 2 years ago

Thank you, @gabrielctn. You are right. Currently, this callback is not implemented for some types of displays. Including this feature won't be that difficult. Could you describe what the callback context is? Does it need to be triggered when the cursor enters the area or, in addition, when it moves through?

gabrielctn commented 2 years ago

It needs to be triggered when the mouse enters and when it moves through as well, because I need to trigger events for reach data point change. An example of event I want to trigger is the modification of the "value: " text in the tooltip that is generated when hovering data tracks. But I have other things in mind that are independant of the plugin, I just need to retrieve the data of the track, so the positions, values, etc.

It would be really awesome 😎 Thanks !

bioinsilico commented 2 years ago

Thank you, @gabrielctn. I will extend the enter callback to the "continuous" displays. I have in mind to expose methods to overwrite the tooltip with custom calls, but this will require a bit more time.

bioinsilico commented 2 years ago

Hi @gabrielctn! I have updated the module (v2.0.5), and now it should trigger the elementEnterCallBack method when the mouse moves through the line and area displays. Please, let me know if that helps.

gabrielctn commented 2 years ago

Excellent thank you very much !