dhotson/springy

Add node/edge click listener

Closed this issue · 1 comments

Hi,
I am not sure if this support is already there.

Can you add onClick listener for node and edge?

I need to show set of properties associated with node or edge upon clicking it.

Hi,

You can add a doubleclick handler like this:

var graph = new Graph();
var node = graph.newNode({
  ondoubleclick: function() {
    // Go crazy.. :)
  }
});

You can see how it's implemented here:

jQuery(canvas).dblclick(function(e) {

.. making a single click handler is possible with some modification, which should be fairly straightforward. Good luck! :)