plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js
https://dash.plot.ly/cytoscape
MIT License
602 stars 119 forks source link

Allow user to obtain mouse coordinates #160

Open JohannesWiesner opened 2 years ago

JohannesWiesner commented 2 years ago

It would be nice if it was possible to obtain mouse coordinates from dash_cytoscape.Cytoscape. In my current project, I would like to create new nodes whenever I click on 'white space' within the cytoscape object. I guess, since mouseoverNodeData and mouseoverEdgeData are already available, there must be some code running in the background that gets the current mouse position? I already posted this question on the plotly forum and there's already the same question but for cytoscape.js

pitris90 commented 1 year ago

It would be nice if it was possible to obtain mouse coordinates from dash_cytoscape.Cytoscape. In my current project, I would like to create new nodes whenever I click on 'white space' within the cytoscape object. I guess, since mouseoverNodeData and mouseoverEdgeData are already available, there must be some code running in the background that gets the current mouse position? I already posted this question on the plotly forum and there's already the same question but for cytoscape.js

Hi @JohannesWiesner , have you discovered some way how to get this position? I'm facing the same problem..

JohannesWiesner commented 1 year ago

Hi! No, I haven't found a way yet, although admittedly I've never delved deeper into the code. There must be some way to use do this as dash-cytoscape is just a python wrapper around cytoscape.js. I guess this link could somehow point in the right direction