cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
264 stars 62 forks source link

Is there a way to get the cursor position within the canvas? #277

Open TristanJordan99 opened 2 years ago

TristanJordan99 commented 2 years ago

I'm looking for a way to retrieve the mouse position within the canvas in a similar manner to ipycanvas' command:

def handle_mouse_move(x, y):
    # Do something
    pass

canvas.on_mouse_move(handle_mouse_move)
ianhi commented 2 years ago

I don't see a way to do this via https://js.cytoscape.org/#core/events but I would be happy to be wrong. Otherwise I think we need to find a way to grab the underlying canvas object and add our own event hooks to it.