0

I am trying to get a function call on click on tool-options so that I can change the label name of link. I am able to get a function call using cell:pointerdown event but that is giving me the id of whole link, and that event is getting called on click at any position of the link. So to be specific I want to get call on click on tool-options image (settings tab).

The code which I am trying is:

paper.on('cell:pointerdown', 
            function(cellView, evt, x, y) { 
     if (cellView.model.isLink()) {
         var links = graph.getLinks();
         console.log(cellView.model.id);
         for (var i = 0; i < links.length; i++){
             console.log(links[i].id);
             links[i].label(0, { attrs: { text: { text: 'my label' } } }); 
         }
        }

This is working fine but I want the same event on click on tool-options image on link and not at anywhere on the link.

DEV1205
  • 352
  • 1
  • 6
  • 18

1 Answers1

0

Your question has been answered here: Can I inject JointJS as an AngularJS module like any other library?

Basically, you need to do something like this:

diagram.on('link:options', function (cellView, evt, x, y) {
    // your logic here: e.g. select a link by its options tool             
});
Anil Saini
  • 627
  • 3
  • 17